Simulation model packaging method, system and equipment based on FMI standard and medium
By configuring the notes and description items in the model description template file, adding preset model parameter category description information, and generating a model description file containing model parameter category description information, the problem of difficult management of simulation model interface parameter classification identification in the existing technology is solved, and efficient simulation test system construction and experimental deployment operation is realized.
Patent Information
- Application Number
- CN202510107269.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2045-01-23
AI Technical Summary
In the existing simulation model packaging methods, it is difficult to manage the classification and identification parameters of the simulation model interface parameters, resulting in low construction efficiency of simulation test system and low operation efficiency of experiment deployment.
Use the configuration of the note description items in the parameter category directory of the model description template file, add preset model parameter category description information, generate a model description file containing the model parameter category description information, and package it according to the model directory structure of the FMI standard to form a deployable target simulation model file.
The classification identification of simulation model interface parameters is realized, the construction efficiency of simulation test system and the operation efficiency of experiment deployment are improved, and the reusability of the model and the flexible implementation of the experiment goal are supported.
Smart Images

Figure CN119578114A_ABST
Abstract
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 model or engineering model built with mathematical expressions and programming languages in a computer simulation system to simulate real scientific or engineering physical processes. The simulation modeling tool platforms in different technical fields have different modeling methods, modeling languages, and model interface definitions, which makes it impossible to universally use and reuse simulation models built by different simulation modeling tool platforms.
[0003] In the prior art, an interface standard for simulation model exchange and collaboration, FMI (Functional Mock-up Interface for Model Exchange and Co-Simulation), is developed. FMI is an open standard for exchanging simulation models between different simulation tools. The FMI standard defines a container and an interface, which defines XML files (model description files), binary files, and model code files to exchange dynamic simulation models, and packages them into FMU model files. FMU (Functional Mock-up Unit) is a model unit that complies with the FMI standard, and 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 attributes 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 they need to be browsed, searched, and set one by one in a huge list of parameters, which limits the speed and accuracy of building the simulation test system. In addition, when the parameterized 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 FMI standard compatibility, 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 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 building a simulation test system and low efficiency in test deployment and operation caused by the difficulty in classifying and identifying simulation model interface parameters in the existing simulation model packaging method.
[0007] (II) Technical solution In order to achieve the above object, the main technical solutions adopted by the present invention include: In a first aspect, an embodiment of the present invention provides a simulation model packaging method based on the FMI standard, comprising: In response to the requirement information encapsulated in the simulation model, a model description template file is created; 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; 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; 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 description file of the obtained simulation model are packaged to form a deployable target simulation model file.
[0008] Optionally, in response to encapsulating the requirement information in the simulation model, creating the model description template file includes: Obtaining packaging requirement information of the simulation model, the requirement information including 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.
[0009] Optionally, a parameter category directory is set in the model description template file, and a remark item is configured under the parameter category directory to add 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, wherein the model parameter category description information includes model entity parameters, model task parameters and model signal interface parameters; By controlling the preset automation tool, the parameter category directory is set in the model description template file, and the remark description item is configured 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.
[0010] 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: Get the model code source file of the simulation model and the header file of the FMI standard; 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 functions; 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.
[0011] Optionally, based on the modified model description template file and in combination with the acquired FMI standard model code file, a model description file containing model parameter category description information is generated, including: Parse the FMI standard model code file to obtain FMI model information including interface parameter type, interface parameter quantity and model function prototype; 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 an initial model description file; 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.
[0012] Optionally, according to the obtained system environment information for the simulation model to be simulated, compiling the model code file of the FMI standard to generate a binary dynamic library of the simulation model suitable for the specified system environment includes: 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; Calling 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 any one of the VS compiler and the GCC compiler.
[0013] Optionally, according to the model directory structure of the FMI standard, the model description file, the model code file, the binary dynamic library and the description file of the obtained simulation model 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.
[0014] In a second aspect, an embodiment of the present invention provides a simulation model packaging system based on the FMI standard, including: 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; 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 item under the parameter category directory to add preset model parameter category description information; 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 acquired FMI standard model code file; A model code file compiling module is used to compile the model code file of the FMI standard according to the obtained system environment information for the simulation model to perform simulation operation, so as 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 description file of the obtained simulation model according to the model directory structure of the FMI standard to form a deployable target simulation model file.
[0015] In a third aspect, an embodiment of the present invention provides an electronic device, including: processor; A memory stores the steps of the simulation model packaging method based on the FMI standard for the processor to control the above-mentioned method.
[0016] In a fourth aspect, an embodiment of the present invention provides a computer-readable medium having computer executable instructions stored thereon, and when the executable instructions are executed by a processor, the above-mentioned steps of a simulation model packaging method based on the FMI standard are implemented.
[0017] (III) Beneficial effects The beneficial effect of the present invention is that 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 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 realized without affecting the compatibility of the FMI standard. Compared with the prior art, when constructing a simulation test system, the 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., so as to establish a test simulation system composed of different simulation models and physical equipment, realize the reusability of the simulation model component, and flexibly realize the expected simulation test goals. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A schematic diagram of a flow chart of a simulation model packaging method based on the FMI standard provided by one embodiment of the present invention; Figure 2 A schematic diagram of the packaging process of an underwater unmanned submersible simulation model provided by an embodiment of the present invention; 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; Figure 4 A schematic diagram of the structure of a computer system of an electronic device provided by the present invention.
[0019] [Description of Reference Numerals] 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; 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
[0020] In order to better explain the present invention and facilitate understanding, the present invention is described in detail below through specific implementation modes in conjunction with the accompanying drawings.
[0021] refer to Figure 1As shown, an embodiment of the present invention proposes a simulation model packaging method based on the FMI standard, which includes: first, in response to the packaging requirement information in the simulation model, a model description template file is created; secondly, a parameter category directory is set in the model description template file, and a remark description item is configured under the parameter category directory to add preset model parameter category description information; then, based on the modified model description template file, in combination with the acquired FMI standard model code file, a model description file containing model parameter category description information is generated; then, based on the acquired 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, the model code file, the binary dynamic library and the acquired simulation model description file are packaged to form a deployable target simulation model file.
[0022] 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, so that the classification identification of the interface parameter information of the simulation model is realized without affecting the compatibility of the FMI standard. Compared with the prior art, when forming a simulation test system, the 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., so as to establish a test simulation system composed of different simulation models and physical equipment, realize the reusability of the simulation model component, and flexibly realize the expected simulation test goals.
[0023] In order to better understand the above technical solution, 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. On the contrary, 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.
[0024] Specifically, refer to Figure 1 As shown, this embodiment proposes a simulation model packaging method based on the FMI standard, which includes: S1. In response to the requirement information encapsulated in the simulation model, a model description template file is created.
[0025] For example, the simulation model is encapsulated as an FMU model according to the FMI standard, and the file structure of the FMU model includes at least the model implementation program structure, the model description file, and the model description file. The model implementation program structure also contains the model code file (Sources) and the binary code file (Binaries). The model description file is used to define all model information and interface parameter information, so that the FMU model provides a universal model interface across tool platforms through the model description file. The model description file is used to provide model-related documentation. Before generating the model description file, it is also necessary to create a model description template file to define the document structure and data type of the model description file to complete the automatic generation of the model description file and data consistency verification.
[0026] In this embodiment, step S1 may include the following sub-steps S11-S13: S11. Obtain packaging requirement information of the simulation model, where the requirement information includes data type, document structure, and data content.
[0027] S12. Create a model parameter category description template file based on the data type and document structure.
[0028] S13. Create a model description template file based on the model parameter category description template file, combined with the document structure and data content.
[0029] 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.
[0030] Since the structure of the model description file in the simulation model encapsulated according to the FMI standard cannot be modified at will, it is impossible to add specific model parameter category description information in the model description file. Therefore, this embodiment selects to add preset specific model parameter category description information in the model description template file, so that the subsequent model description file generated based on the model description template file can realize the classification identification of the interface parameter information of the simulation model without affecting the compatibility of the FMI standard.
[0031] Further explanation: the model description template file is provided with a parameter category directory and a model variable directory. The parameter category directory is used to define the category of interface parameters in the simulation model (such as position, velocity, acceleration, etc.) and the corresponding dimensional units, etc.; the model variable directory is used to define the name, data type (such as integer, floating point, Boolean, string, enumeration, etc.), input / output type, and reference to the interface parameter category defined in the parameter category directory. Furthermore, the remark item is configured under the parameter category directory. By adding a preset character string of model parameter category description information in the remark item, the purpose of classifying the simulation model interface parameters can be achieved without affecting the compatibility of the simulation model in the FMI standard.
[0032] In this embodiment, step S2 may include the following sub-steps S21-S23: S21. Generate model parameter category description information of the simulation model according to 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.
[0033] Furthermore, model entity parameters are mainly used to describe the physical characteristic parameters of simulation model entities (such as aircraft, cars, ships, boats, etc.), such as size, mass, center of gravity, center of buoyancy, fluid dynamic parameters and other parameters related to the inherent characteristics of specific entities. And when the simulation system is built, the model entity parameters can be defined in an independent data table. By changing the parameters, the simulation of different specifications and models of the same entity model can be realized without re-programming the model.
[0034] Model mission parameters are mainly used to describe variable condition parameters such as initial conditions, mission objectives, route planning, mission environment parameters, etc. during simulation tests. When building a simulation system, model mission parameters can be defined differently through multiple parameter tables to achieve multi-condition or multi-voyage simulation test management and batch operation during the simulation test.
[0035] Model signal interface parameters are mainly used for signal interfaces when multiple simulation models are assembled and connected, to achieve multi-model interconnection and communication during simulation of complex large systems, and to build a semi-physical simulation system.
[0036] S22. By controlling a preset 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.
[0037] S23. By controlling the automation tool, the model parameter category description information is added to the remarks item to obtain a modified model description template file.
[0038] S3. 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.
[0039] 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 functional 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.
[0040] In this embodiment, before step S3, steps F1-F2 are also included: F1. Obtain the model code source file of the simulation model and the FMI standard header file.
[0041] F2. Convert the source code file into the FMI standard model code file based on the FMI standard header file.
[0042] 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 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.
[0043] 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.
[0044] In this embodiment, step S3 may include the following sub-steps S31-S33: S31. Parse the FMI standard model code file to obtain FMI model information including interface parameter type, interface parameter quantity and model function prototype.
[0045] 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.
[0046] S33, 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.
[0047] S4. 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.
[0048] 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.
[0049] In this embodiment, step S4 may include the following sub-steps S41-S43: S41, obtaining system environment information for simulation model to perform simulation operation.
[0050] S42. Determine a compiler for compiling the content of the FMI standard model code file according to the system environment information.
[0051] 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.
[0052] The compiler is any one of the VS compiler and the GCC compiler.
[0053] S5. According to the model directory structure of the FMI standard, the model description file, model code file, binary dynamic library and the description file of the obtained simulation model are packaged to form a deployable target simulation model file.
[0054] In this embodiment, step S5 may include the following sub-steps S51-S54: S51, 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.
[0055] S52. Create a folder according to the directory structure of the FMI standard.
[0056] 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.
[0057] S54, compressing the target simulation model file package to obtain the target simulation model file to complete the packaging of the reusable simulation model.
[0058] In a specific embodiment, the simulation model packaging method based on the FMI standard described in the above steps S1-S5 is used to package the underwater unmanned submersible 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 plan management and operation can be performed by establishing different task parameter tables (such as different waypoint planning, etc.). Packaging process reference Figure 2 As shown, the specific packaging process is: (1) Use Matlab / Simulink modeling software to build the underwater unmanned submersible simulation model UUV.mdl: The underwater unmanned submersible simulation model UUV.mdl includes the unmanned submersible navigation control model, automatic driving model, fluid dynamics and kinematics model.
[0059] 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.
[0060] 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.
[0061] (2) In response to the requirement information encapsulated in the underwater unmanned underwater vehicle simulation model UUV.mdl, create a model parameter category description template file (fmi2TypeDefinition.xsd) and a model description template file (fmi2ModelDescription.xsd).
[0062] (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.
[0063] Model parameter category description information includes: 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.
[0064] Mission parameters of underwater unmanned submersibles: planning waypoints.
[0065] Signal interface parameters of underwater unmanned submersibles: position coordinates (latitude, longitude and depth data), yaw angle, pitch angle and roll angle.
[0066] (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.
[0067] (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, generate the model description file of the underwater unmanned submersible simulation model.
[0068] (6) According to the underwater unmanned submersible simulation platform, the FMI standard model code file is compiled using the GCC compiler to generate a .dll binary dynamic library for win64 and a .so binary dynamic library for Linux64.
[0069] (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.
[0070] 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, such as Figure 3 As shown, the present invention also provides a simulation model packaging system 100 based on the FMI standard, which includes: The model description template file creation module 101 is used to create a model description template file in response to the encapsulated requirement information in the simulation model.
[0071] 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.
[0072] The model description file generation 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.
[0073] The model code file compiling module 104 is used to compile the model code file of the FMI standard according to the acquired system environment information for the simulation model to perform simulation operation, so as to generate a binary dynamic library of the simulation model suitable for the specified system environment.
[0074] 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 model directory structure of the FMI standard to form a deployable target simulation model file.
[0075] The functions of each unit in the system refer to the relevant description in the above method embodiment, which will not be repeated here.
[0076] Furthermore, the present invention further 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.
[0077] Reference below Figure 4 , which shows a schematic diagram of the structure 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 bring any limitation to the functions and scope of use of the embodiments of the present application.
[0078] like Figure 4 As shown, the 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 part 208 into a random access memory (RAM) 203. In the RAM 203, various programs and data required for the operation of the system 200 are also stored. The CPU 201, the ROM 202, and the RAM 203 are connected to each other through a bus 204. An input / output (I / O) interface 205 is also connected to the bus 204.
[0079] The following components are connected to the I / O interface 205: an input section 206 including a keyboard, a mouse, etc.; an output section 207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 208 including a hard disk, etc.; and a communication section 209 including a network interface card such as a LAN card, a modem, etc. 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. A removable medium 211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 210 as needed, so that a computer program read therefrom is installed into the storage section 208 as needed.
[0080] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 209, and / or installed from a removable medium 211. When the computer program is executed by the central processing unit (CPU) 201, the above-mentioned functions defined in the system of the present application are executed.
[0081] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable medium or any combination of the above two. The computer-readable medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable medium that can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0082] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, 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, a program segment, or a part of a code, and the above-mentioned module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented 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 with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0083] The units involved in the embodiments described in this application may be implemented by software or hardware. The units described may also be arranged in a processor, wherein the names of these units do not constitute limitations on the units themselves in certain circumstances.
[0084] Finally, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes the following method steps: S1. In response to the requirement information encapsulated in the simulation model, a model description template file is created.
[0085] 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.
[0086] S3. 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.
[0087] S4. 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.
[0088] S5. According to the model directory structure of the FMI standard, the model description file, model code file, binary dynamic library and the description file of the obtained simulation model are packaged to form a deployable target simulation model file.
[0089] In summary, an embodiment of the present invention proposes a simulation model packaging 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 conversion; then compiling the model code file of the FMI standard 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 description file of the obtained simulation model to form a deployable target simulation model file.
[0090] 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.
[0091] 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.
[0092] Since the system / device described in the above embodiments of the present invention is a system / device used to implement the method of the above embodiments of the present invention, a person skilled in the art can understand the specific structure and deformation of the system / device based on the method described in the above embodiments of the present invention, and thus will not be described in detail here. All systems / devices used in the method of the above embodiments of the present invention belong to the scope of protection of the present invention.
[0093] It should be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, 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 disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0094] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions.
[0095] 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 different components and by means of a suitably programmed computer. The use of the words first, second, third, etc., is only for convenience of expression and does not indicate any order. These words may be understood as part of the name of the component.
[0096] 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" etc. 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 representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0097] Although preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments after obtaining the basic inventive concepts.
[0098] 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 the requirement information encapsulated in the simulation model, a model description template file is created; 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; 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; 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 description file of the obtained simulation model are packaged to form a deployable target simulation model file.
2. The method according to claim 1, characterized in that 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, the requirement information including 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, characterized in that 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 including: 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; By controlling the preset automation tool, the parameter category directory is set in the model description template file, and the remark description item is configured 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, characterized in that 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 is also included: Get the model code source file of the simulation model and the header file of the FMI standard; 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 functions; 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, characterized in that 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, including: Parse the FMI standard model code file to obtain FMI model information including interface parameter type, interface parameter quantity and model function prototype; 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 an initial model description file; 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.
6. The method according to claim 1, characterized in that According to the obtained system environment information for simulation model operation, 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; Calling 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 any one of the VS compiler and the GCC compiler.
7. The method according to claim 1, characterized in that 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.
8. 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 the encapsulated requirement information in the 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 item under the parameter category directory to add preset model parameter category description information; 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 acquired FMI standard model code file; A model code file compiling module is used to compile the model code file of the FMI standard according to the obtained system environment information for the simulation model to perform simulation operation, so as 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 description file of the obtained simulation model according to the model directory structure of the FMI standard to form a deployable target simulation model file.
9. 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 7 for the processor to control.
10. 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 a simulation model packaging method based on the FMI standard as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method for converting Python model to Modelica model
CN106681726A
Model packaging method and device, and electronic equipment
CN111985055A
Code packaging method and device
CN114721666A
Multi-field simulation model integration method and system
CN115061772A
Industrial digital twin system unit equipment computing interface construction method and device
CN115454395A