CN-115421940-B - Multi-source heterogeneous model white box integration method based on shared memory technology
Abstract
The invention discloses a multi-source heterogeneous model white box integration method based on a shared memory technology, which packages a shared memory, a clock synchronization algorithm and a data interface protocol into a shared memory FMU through an FMI protocol, and leads the communication FMU into each simulation tool, so that each simulation tool realizes interactive data through the FMU, thereby realizing the joint simulation of a multi-source heterogeneous model. Compared with the process of integrating the model-derived FMU, the method and the device can adjust the parameters of the model in each software at any time in the real-time simulation process and observe the output result of the model.
Inventors
- FU XIANG
- HAO KANGKANG
- SHANG YONGQUAN
- WANG JUN
Assignees
- 西安中锐创联科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20220902
Claims (4)
- 1. The multi-source heterogeneous model white-box integration method based on the shared memory technology is characterized by comprising the following operations: 1) The FMI protocol is used for packaging the shared memory FMU, which comprises an FMI description file and an executable file, and the shared memory, clock synchronization and data interface protocol to be followed by software participating in simulation are given; the shared memory is in an inter-process communication mode, and the communication between different processes is realized by directly modifying the memory in the address space by mapping the address space of the same physical memory into the address space of different processes; the clock synchronization sets the communication step length of each simulation software synchronization of the joint simulation; The data interface protocol establishes a unified interface protocol for each simulation tool, and comprises the steps of adding 'in' to the name of an input signal in each subsystem, adding 'out' to the name of an output signal, separating signals by English commas, separating the total input signal from the output signal by English semicolons, and not allowing the name of each signal to be repeated, wherein the information forms interface information of each subsystem in a character string form, and provides support for FMU processing interface relation; The shared memory FMU reserves a setting port of a communication step length of interface protocol and model interaction for a user; 2) Then the sharing memory FMU is imported into each simulation tool participating in the simulation, so that each simulation tool realizes interactive data through the sharing memory FMU, After the simulation software is imported into the FMU, defining parameters of model variables, and displaying and modifying the parameters in a parameter setting interface of the FMU; 3) According to the FMI simulation flow, after setting FMU parameter information, calling an FMI interface function to transmit the information to an executable file in the FMU in the initialization process of the FMU by simulation software; The method comprises the steps of setting interface parameters for executing file analysis, creating or reading a shared memory according to input and output parameters in interface information, writing output data of a model into the shared memory according to an interface protocol at specific communication step length moment, waiting for other models to write input data required by the model into the shared memory and then reading, entering the next communication step length, and circulating to all simulation ends.
- 2. The method for integrating the multi-source heterogeneous model white box based on the shared memory technology as claimed in claim 1, wherein the FMI description file is used for describing the attribute information of the FMU model in detail and comprises the structure and the content of a model framework; The executable file defines the interfaces of all the functions needed in the joint simulation for basic configuration before the simulation is executed.
- 3. The method for integrating the multi-source heterogeneous model white box based on the shared memory technology as claimed in claim 1 or 2, wherein the communication step length of interface information and model interaction of the subsystem is reserved for user setting by writing a model description file of the FMU; The ModelVariables in the model description file can be used for defining model variables, and XML of the model description file is written to define interface information, communication step length and input and output numbers as the model variables.
- 4. The method for integrating the white-box of the multi-source heterogeneous model based on the shared memory technology as claimed in claim 1, wherein the clock synchronization is realized by using data mutual exclusion and simulation time synchronization: Firstly, the total simulation time length requirements of all the models of the joint simulation are consistent; Secondly, the input data of a certain model is certainly from the output of other models, at the time T, the model A writes the output data and the own simulation time T into a shared memory named by a data name, after the model B reaches the time T, whether the shared memory with the data name exists or not is firstly searched, and if the shared memory with the data name does not exist, the interface information is set to be wrong; and then reading the moment of the current shared memory, if the moment of the current shared memory is consistent, directly reading the data, and if the moment of the current shared memory is T-1, circularly waiting for the refreshing moment and the data of the simulation software A for reading the data of the last communication step length.
Description
Multi-source heterogeneous model white box integration method based on shared memory technology Technical Field The invention belongs to the technical field of simulation, and relates to a multi-source heterogeneous model white box integration method based on a shared memory technology. Background With the wide application of computer simulation technology, model-based system engineering is increasingly applied to the research and development flow of products, and digital modeling simulation can comprehensively verify and optimize the design scheme of the products, so that the research and development period is obviously shortened, and the cost is reduced. Due to the difference of simulation technologies in various fields, the respective special commercial simulation software is gradually developed, and is accepted by industry and widely adopted. At present, because the concentration directions of commercial simulation software of various disciplines are different, when the simulation needs to be carried out on the whole system, one software cannot be qualified, and therefore, the joint simulation needs to be carried out by simulation tools of different disciplines. The European development information plan (ITEA) in 2010 proposes the FMI standard, which defines a common interface specification for joint simulation, based on which model joint simulation established by different simulation tools can be implemented. The specification defines two modes of joint simulation, one is Model Exchange (ME) and the other is Co-Simulation (CS), the difference being that the FMU in the first mode does not contain a Model solver, which contains a Model solver. The standard standardizes all simulation flows, all modeling and simulation software can export models of the modeling and simulation software into an FMU (Functional Mock-up Unit) file according to the standard, and other software can analyze and call the file based on the FMI standard, so that the joint simulation of the multidisciplinary simulation software is realized. The standard is upgraded to FMI2.0 in 2014, with variable parameter functions during simulation run, enhanced initialization behavior, implementation environment integration and processing simulator, etc., improving usability and compatibility. Currently, the standard is adopted by 110 commercial simulation software, including the common simulation software AMESim, simulink, and the like, and gradually develops into a widely accepted unified standard. The joint simulation nature of the multi-source heterogeneous model is that different simulation tools can interact data. In computer systems, this problem is expressed as process communication. Process communication is classified into low-level communication (only state and integer values can be transferred) and high-level communication (efficiency of signal communication is improved, a large amount of data is transferred, and complexity of programming is reduced) according to the amount and efficiency of information exchange. The high-level process communication is divided into three modes, namely a shared memory mode, a message passing mode and a shared file mode. When processing the integrated simulation of the multi-source heterogeneous model, foreign institutions commonly adopt simulation software (business or open source) of a specific version related to the integrated simulation to carry out secondary development, and compile a control matched with the defined data service, thereby completing the integrated simulation of the multi-source heterogeneous model. In order to get rid of the limitation of foreign Simulation software companies, some domestic institutions export the Simulation Model built in the commercial tool into FMU files (particularly, co-Simulation format, because only the FMU files in the format are provided with solvers, and FMUs in Model-Exchange format are not suitable for the method), and then load all FMU files on a Simulation platform for integrated Simulation, such as Mworks software of the same-element soft control company in Suzhou and GCair software of the Beijing crown science and technology company. The research of the distributed integrated simulation in China starts from 20 years and 90 years, the military of China has made great progress through many years of efforts, DIS and related technologies are overcome, and a multi-weapon integrated simulation demonstration system based on a DIS and HLA mixed system structure is built, but the system has obvious difference from America and Europe. At present, the research in the field in China is mainly insufficient from the aspects of America and Europe: firstly, the foreign technology is developed early, the input of the military is large, and the commercialization stage is finished at present. While domestic is always in tracking research and still limited to the standard specifications proposed by the united states military, not belonging to our autonomous specificati