Simulation model packaging method, system, equipment and medium based on FMI standard

By configuring the remark items in the model description template file, generating a model description file containing model parameter category description information and compiling it into a binary dynamic library, the problems of slow construction speed and low operating efficiency caused by the difficulty in managing simulation model interface parameters in the existing technology are solved, and efficient simulation test system construction and deployment are achieved.

CN119578114BActive Publication Date: 2025-09-16CHANGSHA AIKESAIPU INSTR EQUIP CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510107269.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-09-16
Estimated Expiration
2045-01-23

AI Technical Summary

Technical Problem

In the existing technology, when building a complex simulation system based on the FMI standard simulation model, it is necessary to browse and set hundreds or even thousands of interface parameters one by one, resulting in slow construction speed and low operating efficiency of the simulation test system, and the efficiency of the parameterized simulation test system is not high.

Method used

By configuring the remark item under the parameter category directory of the model description template file, adding the preset model parameter category description information, generating a model description file containing the model parameter category description information, and compiling it into a binary dynamic library suitable for the specified system environment, and finally packaging it according to the FMI standard directory structure to form a deployable target simulation model file.

Benefits of technology

It realizes the classified management of simulation model interface parameters without affecting the compatibility of FMI standards, improves the construction efficiency of the simulation test system and the test deployment and operation efficiency, supports multiple repeated calls and parameter table-driven simulation tests, and enhances the reusability of the simulation model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119578114B_ABST
    Figure CN119578114B_ABST
Patent Text Reader

Abstract

The present invention relates to a simulation model packaging method, system, device, and medium based on the FMI standard, belonging to the field of computer simulation technology. The method comprises: creating a model description template file; configuring a remark description item under the parameter category directory of the model description template file to add preset model parameter category description information; generating a model description file based on the modified model description template file and in combination with a model code file of the FMI standard; compiling the model code file of the FMI standard to generate a binary dynamic library suitable for a specified system environment; and packaging the model description file, model code file, binary dynamic library, and model description file according to the model directory structure of the FMI standard to form a target simulation model file. The method solves the technical problems of low simulation test system construction efficiency and low test deployment and operation efficiency caused by the difficulty in classifying and identifying simulation model interface parameters in existing simulation model packaging methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer simulation technology, and in particular to a simulation model packaging method, system, device and medium based on the FMI standard. Background Art

[0002] A simulation model is a scientific or engineering model constructed using mathematical expressions and programming languages ​​in a computer simulation system. It is used to simulate real-world scientific or engineering physical processes. Simulation modeling tool platforms in different technical fields have different modeling methods, modeling languages, and model interface definitions, making them difficult to integrate and reuse.

[0003] In existing technology, an open standard for exchanging simulation models between different simulation tools has been established: the Functional Mock-up Interface for Model Exchange and Co-Simulation (FMI). The FMI standard defines a container and an interface for exchanging dynamic simulation models by defining XML files (model description files), binary files, and model code files. These files are then packaged into FMU model files. FMUs are FMI-compliant model units that can be imported and used by different simulation software.

[0004] However, when constructing a simulation test system based on the FMI standard, component models created by various simulation tools are imported and assembled into a complex simulation system. Since the FMI standard only roughly defines the interface properties such as input, output, data type, etc. of the model interface, there may be hundreds or thousands of interface parameters when simulating a complex simulation system. In the absence of parameter classification management, different types of parameters such as the entity parameters, test task parameters, and signal parameters of the simulation model need to be set and managed, and browsed, searched, and set one by one in a huge list of parameters. This limits the speed and accuracy of building the simulation test system, and when the parametric simulation test system is driven by a data table, the system operation efficiency is low.

[0005] Therefore, those skilled in the art are in urgent need of a simulation model encapsulation method that can implement classified management of simulation model interface parameters without affecting the compatibility of the FMI standard, so as to improve the efficiency of simulation test system construction and test deployment and operation. Summary of the Invention

[0006] (1) Technical issues to be resolved

[0007] In view of the above-mentioned shortcomings and deficiencies of the prior art, the present invention provides a simulation model packaging method, system, device and medium based on the FMI standard, which solves the technical problems of low efficiency in simulation test system construction and low efficiency in test deployment and operation caused by the difficulty in classification and identification management of simulation model interface parameters in the existing simulation model packaging method.

[0008] (2) Technical solution

[0009] In order to achieve the above objectives, the main technical solutions adopted by the present invention include:

[0010] In a first aspect, an embodiment of the present invention provides a simulation model packaging method based on the FMI standard, comprising:

[0011] creating a model description template file in response to the requirement information encapsulated in the simulation model;

[0012] Set the parameter category directory in the model description template file and configure the remark item under the parameter category directory to add the preset model parameter category description information;

[0013] Based on the modified model description template file and the obtained FMI standard model code file, a model description file containing model parameter category description information is generated;

[0014] Compile the FMI standard model code file according to the obtained system environment information for simulation operation of the simulation model to generate a binary dynamic library of the simulation model suitable for the specified system environment;

[0015] According to the FMI standard model directory structure, the model description file, model code file, binary dynamic library and the obtained simulation model description file are packaged to form a deployable target simulation model file.

[0016] Optionally, in response to the requirement information encapsulated in the simulation model, creating the model description template file includes:

[0017] Obtaining packaging requirement information of the simulation model, which includes data type, document structure, and data content;

[0018] Create a model parameter category description template file based on the data type and document structure;

[0019] Create a model description template file based on the model parameter category description template file, combined with the document structure and data content.

[0020] Optionally, set a parameter category directory in the model description template file and configure a note item under the parameter category directory to add preset model parameter category description information including:

[0021] Generate model parameter category description information of the simulation model according to the packaging requirement information of the simulation model, wherein the model parameter category description information includes model entity parameters, model task parameters, and model signal interface parameters;

[0022] By controlling the pre-set automation tool, set the parameter category directory in the model description template file, and configure the remark description item under the parameter category directory;

[0023] By controlling the automation tool, the model parameter category description information is added to the remark item to obtain the modified model description template file.

[0024] Optionally, before generating a model description file containing model parameter category description information based on the modified model description template file and the acquired FMI standard model code file, the method further includes:

[0025] Obtain the model code source file and FMI standard header file of the simulation model;

[0026] According to the header file of FMI standard, convert the code source file into the model code file of FMI standard;

[0027] Among them, the header files of the FMI standard include:

[0028] Data type definition header file, used to determine the correspondence between C language data types and FMI standard language data types, as well as to determine the input and output parameter types of model function;

[0029] Function type definition header file, used to determine the model function type of the FMI standard;

[0030] Function interface header file, used to determine the prototype of the model function of the FMI standard.

[0031] Optionally, based on the modified model description template file and in combination with the obtained FMI standard model code file, a model description file containing model parameter category description information is generated, including:

[0032] Parse the FMI standard model code file to obtain FMI model information including interface parameter type, interface parameter quantity and model function prototype;

[0033] According to the structural information of the modified model description template file, the FMI model information is added to the modified model description template file to obtain the initial model description file;

[0034] The interface parameters in the initial model description file are classified according to the FMI standard to obtain a model description file containing model parameter category description information.

[0035] Optionally, based on the obtained system environment information for the simulation model to be simulated, compiling the FMI standard model code file to generate a binary dynamic library of the simulation model applicable to the specified system environment includes:

[0036] Obtain system environment information for simulation model to run simulation;

[0037] Determine the compiler used to compile the content of the FMI standard model code file according to the system environment information;

[0038] Call the compiler to compile the model code file of the FMI interface standard to generate a binary dynamic library of the simulation model suitable for the specified system environment;

[0039] The compiler is either VS compiler or GCC compiler.

[0040] Optionally, according to the FMI standard model directory structure, the model description file, the model code file, the binary dynamic library, and the obtained simulation model description file are packaged to form a deployable target simulation model file including:

[0041] Obtaining a description file of the simulation model, and obtaining a model directory structure including a model binary code file directory, a model description file directory, a model code file directory, and a model description file directory;

[0042] Create folders according to the FMI standard directory structure;

[0043] Copy the model description file, model code file, binary dynamic library and simulation model description file to the corresponding directory to obtain the target simulation model file package;

[0044] The target simulation model file package is compressed to obtain the target simulation model file to complete the packaging of the reusable simulation model.

[0045] In a second aspect, an embodiment of the present invention provides a simulation model packaging system based on the FMI standard, including:

[0046] A model description template file creation module is used to create a model description template file in response to the encapsulated requirement information in the simulation model;

[0047] The model description template file modification module is used to set the parameter category directory in the model description template file and configure the remark description item under the parameter category directory to add preset model parameter category description information;

[0048] A model description file generation module is used to generate a model description file containing model parameter category description information based on the modified model description template file and the obtained FMI standard model code file;

[0049] The model code file compilation module is used to compile the FMI standard model code file according to the obtained system environment information for simulation operation of the simulation model to generate a binary dynamic library of the simulation model suitable for the specified system environment;

[0050] The simulation model encapsulation module is used to package the model description file, model code file, binary dynamic library and the obtained simulation model description file according to the FMI standard model directory structure to form a deployable target simulation model file.

[0051] In a third aspect, an embodiment of the present invention provides an electronic device, including:

[0052] processor;

[0053] A memory stores steps for the processor to control the above-mentioned simulation model packaging method based on the FMI standard.

[0054] In a fourth aspect, an embodiment of the present invention provides a computer-readable medium having computer-executable instructions stored thereon, which, when executed by a processor, implement the above-mentioned steps of a simulation model packaging method based on the FMI standard.

[0055] (3) Beneficial effects

[0056] The beneficial effects of the present invention are as follows: the present invention proposes a simulation model encapsulation method based on the FMI standard. By adopting a technical solution of adding preset model parameter category description information to the remark description item configured under the parameter category directory of the model description template file, the classification identification of the interface parameter information of the simulation model is achieved without affecting the compatibility of the FMI standard. Compared with the existing technology, when constructing a simulation test system, a simulation model that uses the classification identification of interface parameters and is compatible with the FMI standard interface can repeatedly call the simulation model component and set different interface parameter tables according to the requirements of the simulation test purpose, system composition plan, test outline, etc., to establish a test simulation system composed of different simulation models and physical equipment, thereby achieving the reusability of the simulation model component and flexibly achieving the expected simulation test goals. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 A schematic diagram of a flow chart of a simulation model packaging method based on the FMI standard provided in one embodiment of the present invention;

[0058] Figure 2A schematic diagram of the packaging process of an underwater unmanned submersible simulation model provided by one embodiment of the present invention;

[0059] Figure 3 A schematic diagram of the composition of a simulation model package based on the FMI standard provided by one embodiment of the present invention;

[0060] Figure 4 A schematic structural diagram of a computer system of an electronic device provided by the present invention.

[0061] [Description of Reference Numerals]

[0062] 100: Simulation model packaging system based on FMI standard; 101: Model description template file creation module; 102: Model description template file modification module; 103: Model description file generation module; 104: Model code file compilation module; 105: Simulation model packaging module;

[0063] 200: Computer system; 201: CPU; 202: ROM; 203: RAM; 204: Bus; 205: I / O interface; 206: Input part; 207: Output part; 208: Storage part; 209: Communication part; 210: Drive; 211: Removable medium. DETAILED DESCRIPTION

[0064] In order to better explain the present invention and facilitate understanding, the present invention is described in detail below through specific implementation methods in conjunction with the accompanying drawings.

[0065] refer to Figure 1 As shown, an embodiment of the present invention proposes a simulation model packaging method based on the FMI standard, which includes: first, creating a model description template file in response to the packaging requirement information in the simulation model; second, setting a parameter category directory in the model description template file, and configuring a remark description item under the parameter category directory to add preset model parameter category description information; then, based on the modified model description template file and in combination with the obtained FMI standard model code file, a model description file containing model parameter category description information is generated; then, based on the obtained system environment information for simulation operation of the simulation model, the FMI standard model code file is compiled to generate a binary dynamic library of the simulation model suitable for the specified system environment; finally, according to the FMI standard model directory structure, the model description file, model code file, binary dynamic library and the obtained simulation model description file are packaged to form a deployable target simulation model file.

[0066] This embodiment adopts a technical solution of adding preset model parameter category description information to the remark item configured under the parameter category directory of the model description template file, thereby achieving the classification identification of the interface parameter information of the simulation model without affecting the compatibility of the FMI standard. Compared with the existing technology, when constructing a simulation test system, a simulation model that uses the classification identification of interface parameters and is compatible with the FMI standard interface can repeatedly call the simulation model component and set different interface parameter tables according to the requirements of the simulation test purpose, system composition plan, test outline, etc., to establish a test simulation system composed of different simulation models and physical equipment, realize the reusability of the simulation model component, and flexibly achieve the expected simulation test goals.

[0067] To better understand the above technical solutions, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. Rather, these embodiments are provided to enable a clearer and more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.

[0068] Specifically, refer to Figure 1 As shown, this embodiment proposes a simulation model packaging method based on the FMI standard, which includes:

[0069] S1. In response to the requirement information encapsulated in the simulation model, a model description template file is created.

[0070] For example, a simulation model is encapsulated as an FMU model according to the FMI standard. The file structure of the FMU model includes at least a model implementation program structure, a model description file, and a model specification file. The model implementation program structure further includes model code files (Sources) and binary code files (Binaries). The model description file defines all model information and interface parameter information, enabling the FMU model to use a universal model interface across tool platforms through the model description file. The model specification file provides model-related documentation. Before generating the model description file, a model description template file must be created to define the document structure and data types of the model description file, enabling automatic generation of the model description file and data consistency verification.

[0071] In this embodiment, step S1 may include the following sub-steps S11-S13:

[0072] S11. Obtain packaging requirement information of the simulation model, where the requirement information includes data type, document structure, and data content.

[0073] S12. Create a model parameter category description template file based on the data type and document structure.

[0074] S13. Create a model description template file based on the model parameter category description template file, combined with the document structure and data content.

[0075] S2. Set a parameter category directory in the model description template file, and configure a remark item under the parameter category directory to add preset model parameter category description information.

[0076] Because the structure of the model description file in a simulation model encapsulated according to the FMI standard cannot be modified at will, specific model parameter category description information cannot be added to the model description file. Therefore, this embodiment adds preset specific model parameter category description information to the model description template file. This allows the model description file subsequently generated based on the model description template file to implement the classification identification of the simulation model's interface parameter information without affecting FMI standard compatibility.

[0077] Further explanation: The model description template file includes a parameter category directory and a model variable directory. The parameter category directory is used to define the categories (such as position, velocity, acceleration, etc.) and corresponding dimensional units of the interface parameters in the simulation model; the model variable directory is used to define the interface parameter names, data types (such as integer, floating-point number, Boolean, string, enumeration, etc.), input / output types, and references to the interface parameter categories defined in the parameter category directory. Furthermore, a note item is configured under the parameter category directory. By adding a pre-set string describing the model parameter category in the note item, the simulation model interface parameters can be categorized without affecting the simulation model's compatibility with the FMI standard.

[0078] In this embodiment, step S2 may include the following sub-steps S21-S23:

[0079] S21. Generate model parameter category description information of the simulation model according to the packaging requirement information of the simulation model. The model parameter category description information includes model entity parameters, model task parameters, and model signal interface parameters.

[0080] Furthermore, model entity parameters are primarily used to describe the physical characteristics of simulation model entities (such as aircraft, vehicles, ships, and boats). These parameters, such as size, mass, center of gravity, center of buoyancy, and fluid dynamic parameters, are related to the inherent characteristics of a specific entity. Furthermore, when building a simulation system, model entity parameters can be defined in a separate data table. By changing these parameters, different specifications and models of the same entity model can be simulated without reprogramming the model.

[0081] Model mission parameters are primarily used to describe variable parameters during simulation tests, such as initial conditions, mission objectives, route planning, and mission environment parameters. When building a simulation system, these parameters can be defined differently using multiple parameter tables to enable multi-condition or multi-voyage simulation test management and batch processing.

[0082] Model signal interface parameters are mainly used for signal interfaces when assembling and connecting multiple simulation models, realizing multi-model interconnection and communication during simulation of complex large systems, and building a semi-physical simulation system.

[0083] S22. By controlling a pre-set automation tool, a parameter category directory is set in the model description template file, and a remark description item is configured under the parameter category directory.

[0084] S23. Add the model parameter category description information to the remarks item through the control automation tool to obtain a modified model description template file.

[0085] S3. Based on the modified model description template file and the obtained FMI standard model code file, a model description file containing model parameter category description information is generated.

[0086] According to the modified model description template file, the interface parameter type and number of interface parameters of the actual simulation model, as well as the function interface prototype, defined in the corresponding header file in the FMI standard model code file, are converted into a model description file, thereby completing the standardization and conversion process of the FMU model.

[0087] In this embodiment, steps F1-F2 are further included before step S3:

[0088] F1. Obtain the model code source file and FMI standard header file of the simulation model.

[0089] F2. Convert the source code file into the FMI standard model code file based on the FMI standard header file.

[0090] Among them, the header files of the FMI standard include: data type definition header file, which is used to determine the correspondence between C language data types and FMI standard language data types, as well as to determine the input and output parameter types of model function functions; function type definition header file, which is used to determine the model function type of the FMI standard; function interface header file, which is used to determine the prototype of the model function function of the FMI standard.

[0091] The original model code source file is converted into a model code file of the FMI standard, and the model code source file is added to the data type definition header file, the function type definition header file and the function interface header file. The C language data types of the relevant data and variables in the original code are replaced with the language data types of the FMI standard, and the model function and interface parameter types are replaced with the FMI standard definition types to form source code that conforms to the FMI standard, and the source code is packaged to obtain the model code file of the FMI standard.

[0092] In this embodiment, step S3 may include the following sub-steps S31-S33:

[0093] S31. Parse the FMI standard model code file to obtain FMI model information including interface parameter type, interface parameter quantity and model function prototype.

[0094] S32. Add the FMI model information to the modified model description template file according to the structural information of the modified model description template file to obtain an initial model description file.

[0095] S33. Classify the interface parameters in the initial model description file according to the FMI standard to obtain a model description file containing model parameter category description information.

[0096] S4. Compile the FMI standard model code file according to the obtained system environment information for the simulation model to generate a binary dynamic library of the simulation model suitable for the specified system environment.

[0097] According to the system environment information of the simulation model or the target platform for the expected simulation operation, select an appropriate compiler (such as VS compiler or GCC compiler), compile the FMI standard model code file to generate a binary dynamic library of the FMU model (.dll dynamic library under win64 or .so dynamic library under linux64, etc.), and package the compiled binary dynamic library to obtain the FMI standard binary code file.

[0098] In this embodiment, step S4 may include the following sub-steps S41-S43:

[0099] S41. Obtain system environment information for the simulation model to perform simulation operation.

[0100] S42. Determine a compiler for compiling the content of the FMI standard model code file according to the system environment information.

[0101] S43. Calling a compiler to compile the model code file of the FMI interface standard to generate a binary dynamic library of the simulation model suitable for the specified system environment.

[0102] The compiler is either VS compiler or GCC compiler.

[0103] S5. According to the FMI standard model directory structure, the model description file, model code file, binary dynamic library and the obtained simulation model description file are packaged to form a deployable target simulation model file.

[0104] In this embodiment, step S5 may include the following sub-steps S51-S54:

[0105] S51. Obtain a description file of the simulation model, and obtain a model directory structure including a model binary code file directory, a model description file directory, a model code file directory, and a model description file directory.

[0106] S52. Create a folder according to the directory structure of the FMI standard.

[0107] S53, copying the model description file, the model code file, the binary dynamic library and the description file of the simulation model to the corresponding directory to obtain the target simulation model file package.

[0108] S54 , compressing the target simulation model file package to obtain the target simulation model file, thereby completing the packaging of the reusable simulation model.

[0109] In a specific embodiment, the simulation model packaging method based on the FMI standard described in steps S1-S5 above is used to package the underwater unmanned underwater vehicle simulation model UUV.mdl into a reusable semi-physical simulation model UUV.fmu. This model is reusable when assembling and building a semi-physical test system and does not rely on the original modeling platform. In addition, parameterized test plans can be managed and run by establishing different task parameter tables (such as different waypoint planning, etc.). Figure 2 As shown, the specific packaging process is:

[0110] (1) Using Matlab / Simulink modeling software, construct the underwater unmanned submersible simulation model UUV.mdl:

[0111] The underwater unmanned submersible simulation model UUV.mdl includes the unmanned submersible navigation control model, automatic driving model, fluid dynamics and kinematics model.

[0112] The input interface parameters of the underwater unmanned submersible simulation model UUV.mdl include navigation control look-ahead distance, turning radius, heading control coefficient, movement speed, maximum turning overload coefficient and planned waypoints.

[0113] The output interface parameters of the underwater unmanned submersible simulation model UUV.mdl include position coordinates (latitude, longitude and depth data), yaw angle, pitch angle and roll angle.

[0114] (2) In response to the requirement information encapsulated in the underwater unmanned submersible simulation model UUV.mdl, create a model parameter category description template file (fmi2TypeDefinition.xsd) and a model description template file (fmi2ModelDescription.xsd).

[0115] (3) Through the script program, set the remark item under the parameter category directory of the model description template file, and add the model parameter category description information to the remark item to complete the modification of the model description template file.

[0116] Model parameter category description information includes:

[0117] The physical parameters of the underwater unmanned submersible include: navigation control look-ahead distance, turning radius, heading control coefficient, movement speed and maximum turning overload coefficient.

[0118] Mission parameters of underwater unmanned submersible: planning waypoints.

[0119] Signal interface parameters of underwater unmanned submersibles: position coordinates (latitude, longitude and depth data), yaw angle, pitch angle and roll angle.

[0120] (4) Use the Simulink Embedded Coder code generation tool to call the code generation template to generate the FMI standard model code file of the underwater unmanned submersible simulation model.

[0121] (5) Based on the model parameter category description template file (fmi2TypeDefinition.xsd) and the modified model description template file (fmi2ModelDescription.xsd), combined with the FMI standard model code file, the model description file of the underwater unmanned submersible simulation model is generated.

[0122] (6) According to the underwater unmanned submersible simulation platform, the FMI standard model code file is compiled using the GCC compiler to generate a win64 .dll binary dynamic library and a Linux64 .so binary dynamic library.

[0123] (7) According to the FMI standard model directory structure, the model description file, model code file, binary dynamic library and model description file of the underwater unmanned submersible simulation model UUV.mdl are packaged and compressed into a ZIP package. The suffix of the compressed package file name is changed to .fmu to obtain the UUV.fmu model.

[0124] also, Figure 3 A schematic diagram of the composition of a simulation model packaging system based on the FMI standard provided by the present invention is shown as follows: Figure 3 As shown, the present invention also provides a simulation model packaging system 100 based on the FMI standard, which includes:

[0125] The model description template file creation module 101 is used to create a model description template file in response to the requirement information encapsulated in the simulation model.

[0126] The model description template file modification module 102 is used to set a parameter category directory in the model description template file and configure a remark item under the parameter category directory to add preset model parameter category description information.

[0127] The model description file generating module 103 is used to generate a model description file containing model parameter category description information based on the modified model description template file and the acquired FMI standard model code file.

[0128] The model code file compiling module 104 is used to compile the FMI standard model code file according to the acquired system environment information for simulation operation of the simulation model, so as to generate a binary dynamic library of the simulation model applicable to the specified system environment.

[0129] The simulation model packaging module 105 is used to package the model description file, model code file, binary dynamic library and the obtained simulation model description file according to the FMI standard model directory structure to form a deployable target simulation model file.

[0130] The functions of each unit in the system can be found in the relevant description in the above method embodiment, which will not be repeated here.

[0131] Furthermore, the present invention provides an electronic device including a processor and a memory, wherein the memory stores steps for the processor to control the above-mentioned simulation model packaging method based on the FMI standard.

[0132] Reference below Figure 4 , which shows a schematic structural diagram of a computer system 200 suitable for implementing the electronic device of this embodiment. Figure 4 The electronic device shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.

[0133] like Figure 4As shown, computer system 200 includes a central processing unit (CPU) 201, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 202 or a program loaded from a storage unit 208 into a random access memory (RAM) 203. Various programs and data required for the operation of system 200 are also stored in RAM 203. CPU 201, ROM 202, and RAM 203 are connected to each other via a bus 204. An input / output (I / O) interface 205 is also connected to bus 204.

[0134] The following components are connected to the I / O interface 205: an input section 206 including a keyboard, a mouse, and the like; an output section 207 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and speakers; a storage section 208 including a hard disk; and a communication section 209 including a network interface card such as a LAN card or a modem. The communication section 209 performs communication processing via a network such as the Internet. A drive 210 is also connected to the I / O interface 205 as needed. Removable media 211, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 210 as needed, so that computer programs read from the media can be installed in the storage section 208 as needed.

[0135] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for executing the methods illustrated in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 209 and / or installed from removable media 211. When executed by the central processing unit (CPU) 201, the computer program performs the aforementioned functions defined in the system of the present application.

[0136] It should be noted that the computer-readable medium described herein may be a computer-readable signal medium or a computer-readable medium, or any combination thereof. Computer-readable media may include, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable media may include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this application, a computer-readable medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such a propagated data signal may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.

[0137] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or part of the code, and the above-mentioned module, program segment or part of the code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the boxes can also occur in an order different from that marked in the accompanying drawings. For example, two boxes shown in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart and the combination of boxes in the block diagram or flowchart can be implemented using a dedicated hardware-based system that performs the specified functions or operations, or can be implemented using a combination of dedicated hardware and computer instructions.

[0138] The units involved in the embodiments described in this application may be implemented by software or hardware. The units described may also be provided in a processor, wherein the names of these units do not, in certain circumstances, constitute limitations on the units themselves.

[0139] Finally, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments, or may exist independently without being incorporated into the device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the device, the device includes the following method steps:

[0140] S1. In response to the requirement information encapsulated in the simulation model, a model description template file is created.

[0141] S2. Set a parameter category directory in the model description template file, and configure a remark item under the parameter category directory to add preset model parameter category description information.

[0142] S3. Based on the modified model description template file and the obtained FMI standard model code file, a model description file containing model parameter category description information is generated.

[0143] S4. Compile the FMI standard model code file according to the obtained system environment information for the simulation model to generate a binary dynamic library of the simulation model suitable for the specified system environment.

[0144] S5. According to the FMI standard model directory structure, the model description file, model code file, binary dynamic library and the obtained simulation model description file are packaged to form a deployable target simulation model file.

[0145] In summary, an embodiment of the present invention proposes a simulation model encapsulation method, system, device and medium based on the FMI standard, and the method includes: first, configuring a remark description item in the created model description template file to add preset model parameter category description information; then, generating a model description file based on the modified model description template file; then compiling the FMI standard model code file to generate a binary dynamic library of the simulation model suitable for the specified system environment; finally, according to the model directory structure of the FMI standard, packaging the model description file, model code file, binary dynamic library and the obtained simulation model description file to form a deployable target simulation model file.

[0146] Without affecting the compatibility of the FMI standard, the present invention realizes the classified management of simulation model interface parameters, further realizes the data table driven simulation test process of model entity parameters, test task parameters, signal parameters, etc. during semi-physical simulation of complex large systems, supports batch simulation test operation of multiple parameter tables, and can greatly improve the efficiency of semi-physical simulation test system construction and test deployment and operation.

[0147] At the same time, the FMU model encapsulated by the present invention through the FMI standard interface can achieve the separation and independence of the model and the simulation tool platform, so that the model can be reused in different simulation platforms and user simulation application systems, and can also integrate simulation models established by multiple different modeling tools.

[0148] Since the systems / devices described in the above embodiments of the present invention are systems / devices used to implement the methods of the above embodiments of the present invention, those skilled in the art will be able to understand the specific structures and variations of these systems / devices based on the methods described in the above embodiments of the present invention, and thus will not be described in detail here. All systems / devices used in the methods of the above embodiments of the present invention are within the scope of protection of the present invention.

[0149] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.

[0150] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions.

[0151] It should be noted that, in the description of the present invention, the word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The present invention can be implemented by means of hardware comprising several distinct components and by means of a suitably programmed computer. The use of the words first, second, third, etc., is merely for convenience and does not imply any order. These words should be understood as part of the component name.

[0152] In addition, it should be noted that, in the description of this specification, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.

[0153] Although preferred embodiments of the present invention have been described, those skilled in the art will readily appreciate additional variations and modifications to these embodiments upon obtaining the basic inventive concepts.

[0154] Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from the spirit and scope of the invention.

Claims

1. A simulation model packaging method based on the FMI standard, characterized in that: include: In response to packaging requirement information for packaging the simulation model into a reusable hardware-in-the-loop simulation model, creating a model description template file; Set a parameter category directory in the model description template file and configure a remark item under the parameter category directory to add preset model parameter category description information. The model parameter category description information includes model entity parameters used to describe the physical characteristics of the simulation model entity, model task parameters used to describe variable conditions of the simulation test, and model signal interface parameters used for simulation model interaction; Generating a model description file containing model parameter category description information based on the modified model description template file and the obtained FMI standard model code file, including: parsing the FMI standard model code file to obtain FMI model information including interface parameter type, interface parameter quantity, and model function prototype; adding the FMI model information to the modified model description template file based on the structural information of the modified model description template file to obtain an initial model description file; and classifying the interface parameters in the initial model description file according to the FMI standard to obtain a model description file containing model parameter category description information; Compile the FMI standard model code file according to the obtained system environment information for simulation operation of the simulation model to generate a binary dynamic library of the simulation model suitable for the specified system environment; According to the FMI standard model directory structure, the model description file, model code file, binary dynamic library and the obtained simulation model description file are packaged to form a deployable target simulation model file.

2. The method according to claim 1, wherein In response to the requirement information encapsulated in the simulation model, creating a model description template file includes: Obtaining packaging requirement information of the simulation model, which includes data type, document structure, and data content; Create a model parameter category description template file based on the data type and document structure; Create a model description template file based on the model parameter category description template file, combined with the document structure and data content.

3. The method according to claim 1, wherein Set the parameter category directory in the model description template file and configure the note item under the parameter category directory to add the preset model parameter category description information including: Generate model parameter category description information of the simulation model according to the packaging requirement information of the simulation model; By controlling the pre-set automation tool, set the parameter category directory in the model description template file, and configure the remark description item under the parameter category directory; By controlling the automation tool, the model parameter category description information is added to the remark item to obtain the modified model description template file.

4. The method according to claim 1, wherein Before generating a model description file containing model parameter category description information based on the modified model description template file and the obtained FMI standard model code file, the following steps are also included: Obtain the model code source file and FMI standard header file of the simulation model; According to the header file of FMI standard, convert the code source file into the model code file of FMI standard; Among them, the header files of the FMI standard include: Data type definition header file, used to determine the correspondence between C language data types and FMI standard language data types, as well as to determine the input and output parameter types of model function; Function type definition header file, used to determine the model function type of the FMI standard; Function interface header file, used to determine the prototype of the model function of the FMI standard.

5. The method according to claim 1, wherein According to the obtained system environment information for the simulation model, the FMI standard model code file is compiled to generate a binary dynamic library of the simulation model suitable for the specified system environment, including: Obtain system environment information for simulation model to run simulation; Determine the compiler used to compile the content of the FMI standard model code file according to the system environment information; Call the compiler to compile the model code file of the FMI interface standard to generate a binary dynamic library of the simulation model suitable for the specified system environment; The compiler is either VS compiler or GCC compiler.

6. The method according to claim 1, wherein According to the FMI standard model directory structure, the model description file, model code file, binary dynamic library and the obtained simulation model description file are packaged to form a deployable target simulation model file including: Obtaining a description file of the simulation model, and obtaining a model directory structure including a model binary code file directory, a model description file directory, a model code file directory, and a model description file directory; Create folders according to the FMI standard directory structure; Copy the model description file, model code file, binary dynamic library and simulation model description file to the corresponding directory to obtain the target simulation model file package; The target simulation model file package is compressed to obtain the target simulation model file to complete the packaging of the reusable simulation model.

7. A simulation model packaging system based on the FMI standard, characterized in that: include: A model description template file creation module is used to create a model description template file in response to packaging requirement information for packaging the simulation model into a reusable semi-physical simulation model; A model description template file modification module is used to set a parameter category directory in the model description template file and configure a remark description item under the parameter category directory to add preset model parameter category description information. The model parameter category description information includes model entity parameters for describing the physical characteristics of the simulation model entity, model task parameters for describing the variable conditions of the simulation test, and model signal interface parameters for simulation model interaction; A model description file generation module is used to generate a model description file containing model parameter category description information based on the modified model description template file and the obtained FMI standard model code file, including: parsing the FMI standard model code file to obtain FMI model information including interface parameter type, interface parameter quantity and model function prototype; adding the FMI model information to the modified model description template file according to the structural information of the modified model description template file to obtain an initial model description file; and classifying the interface parameters in the initial model description file according to the FMI standard to obtain a model description file containing model parameter category description information; The model code file compilation module is used to compile the FMI standard model code file according to the obtained system environment information for simulation operation of the simulation model to generate a binary dynamic library of the simulation model suitable for the specified system environment; The simulation model encapsulation module is used to package the model description file, model code file, binary dynamic library and the obtained simulation model description file according to the FMI standard model directory structure to form a deployable target simulation model file.

8. An electronic device, characterized in that: include: processor; A memory storing steps of a simulation model packaging method based on the FMI standard as described in any one of claims 1 to 6 for the processor to control.

9. A computer-readable medium having computer-executable instructions stored thereon, characterized in that: When the executable instructions are executed by the processor, the steps of the simulation model packaging method based on the FMI standard as described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Method for converting Python model to Modelica model

    CN106681726A

  • Model packaging method and device, and electronic equipment

    CN111985055A

  • Collaborative simulation test method for IEC61131-3 standard control program

    CN117435498A