Joint simulation method and device for multi-source heterogeneous model
By integrating the DDS data interaction network and scheduler into the FMU file, the problems of poor interface compatibility and high cost in the joint simulation of multi-source heterogeneous models are solved, and efficient visualization of simulation results and ease of operation are achieved.
Patent Information
- Application Number
- CN202510976941.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-15
- Publication Date
- 2025-11-04
AI Technical Summary
Existing multi-source heterogeneous model co-simulation methods suffer from poor co-simulation interface adaptability, high development and maintenance costs, and poor visualization effects. In particular, the stability of the interface is difficult to guarantee after different simulation tools and version upgrades.
By integrating the DDS data interaction network and scheduler into the FMU file and importing them into various simulation tools, co-simulation is performed, avoiding the need to export the model and solver to generate the FMU file. The model variables are configured using XML description files, enabling model variable binding and clock synchronization. The simulation results are output in a user interface mode.
It improves the versatility and visualization of the co-simulation interface, reduces development and maintenance costs, avoids the frequent export problems of model downgrading and parameter modification, and improves the ease of operation and visualization of simulation results.
Smart Images

Figure CN120893088A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of multidisciplinary simulation software, in particular to a joint simulation method and device of multi-source heterogeneous models. BACKGROUND
[0002] In order to solve the problem of model exchange and joint simulation between different simulation tools, a series of industrial and academic organizations jointly formulated an open standard FMI (Functional Mock-up Interface) for model exchange and joint simulation in 2010, and it has been widely applied and promoted since then and has become the current general joint simulation standard. The file generated by using the standard is called FMU (Functional Mock-up Unit) file.
[0003] The existing joint simulation method of multi-source heterogeneous models usually takes the joint simulation platform as the master node of joint simulation. In this method, the simulation tools of each field are regarded as slave nodes, and the models built by them are hung on the master node to realize the synchronous scheduling and data exchange between multi-source heterogeneous models. At present, the simulation tools of each field are integrated as slave nodes in the joint simulation platform, and the following two schemes are usually adopted:
[0004] The first is to build a model in the simulation tool and export the model as a black-box joint simulation file in the FMI standard for the master node to call. The FMU file mainly consists of a model and a solver.
[0005] The second is to develop a secondary development for a specific version of the simulation tool, adapt a special joint simulation white-box interface, and integrate the joint simulation white-box interface into the model of the simulation tool.
[0006] For the above two schemes, the following problems exist:
[0007] The first one: due to the consideration of protecting intellectual property rights and other reasons, only a few simulation tools can be used as slave nodes to export the model and the solver and generate the FMU file. Some simulation tools even support exporting the FMU file, but there are problems such as not being able to perform white-box simulation, model order reduction, and the need to re-export the FMU file when modifying model parameters, resulting in poor adaptability of the joint simulation interface, and poor visualization effect of the joint simulation in the form of a black box file.
[0008] The second scheme supports integration in a white-box mode, but the development difficulty is extremely great. Different simulation tools and versions need to be separately adapted. More troublesome is that when the simulation tool is upgraded, the current specially adapted joint simulation white-box interface can be invalid or unstable, which leads to high development and maintenance costs. SUMMARY
[0009] The application provides a joint simulation method and device for multi-source heterogeneous models, which can improve the visual effect and reduce the development and maintenance costs. The specific technical solutions are as follows.
[0010] In the first aspect, the application provides a joint simulation method for multi-source heterogeneous models, which comprises the following steps.
[0011] For each multi-source heterogeneous model in the simulation tools for joint simulation through a multi-disciplinary joint simulation platform, a data distribution service (DDS) data interaction network and a scheduler are encapsulated into a dynamic library, functional mock-up unit (FMU) variables corresponding to model variables used for interaction of the multi-source heterogeneous model are configured in an extensible markup language (XML) description file, and the dynamic library and the configured XML description file are packaged to generate an FMU file corresponding to the multi-source heterogeneous model, wherein each FMU variable is used for sending or receiving data.
[0012] The corresponding FMU file is imported into each multi-source heterogeneous model, and each model variable used for interaction is bound to the corresponding FMU variable to obtain first binding information.
[0013] The XML description file in the FMU file corresponding to each multi-source heterogeneous model is parsed through the multi-disciplinary joint simulation platform to obtain each FMU variable, and each FMU variable and the FMU variable interacting therewith are bound to obtain second binding information. After it is determined that each multi-source heterogeneous model has entered a simulation blocking state, scheduling information is sent to each scheduler.
[0014] Each multi-source heterogeneous model is clock-synchronized by each scheduler based on the received scheduling information, and at the same time, each multi-source heterogeneous model receives and transmits model data corresponding to each model variable from the DDS data interaction network according to the first binding information and the second binding information to run simulation in a user interface (UI) mode, and outputs each simulation result.
[0015] Optionally, the step of configuring, in the XML description file, functional mock-up unit (FMU) variables corresponding to model variables used for interaction of the multi-source heterogeneous model comprises the following steps.
[0016] Variable names, initial values, variable types, description information and reference information of the functional mock-up unit (FMU) variables corresponding to the model variables used for interaction of the multi-source heterogeneous model are set in the XML description file.
[0017] Optionally, the step of binding each FMU variable and the FMU variable interacting with it to obtain the second binding information comprises:
[0018] receiving an FMU variable binding instruction, for each FMU variable in the FMU variable binding instruction, binding the FMU variable and the FMU variable interacting with it to generate a pair of bound variables, and determining the FMU variable and the FMU variable not bound with it as a pair of unbound variables, wherein the FMU variable binding instruction contains the correspondence between each FMU variable and each FMU variable interacting with it;
[0019] setting the DDS topic partition value of each FMU variable in each pair of bound variables to the same value, and setting the DDS topic partition value of each FMU variable in each pair of unbound variables to different values, wherein the DDS topic partition value represents the partition and topic to which the FMU variable belongs in the DDS data interaction network.
[0020] Optionally, the step of synchronizing the clock of each multi-source heterogeneous model based on the received scheduling information by each scheduler comprises:
[0021] synchronizing the clock of each multi-source heterogeneous model by releasing the named semaphore in each fmi2DoStep interface based on the received scheduling information by each scheduler.
[0022] Optionally, the step of running simulation in a user interface (UI) mode by each multi-source heterogeneous model according to the first binding information and the second binding information to receive and transmit the model data corresponding to each model variable from the DDS data interaction network, and outputting each simulation result comprises:
[0023] for each model variable in each multi-source heterogeneous model, when the interaction mode of the model variable is to send data, sending the model data corresponding to the model variable through the first FMU variable bound with the model variable to the DDS data interaction network, so that the second FMU variable bound with the first FMU variable can receive the model data corresponding to the model variable from the DDS data interaction network; when the interaction mode of the model variable is to receive data, based on the third FMU variable bound with the model variable, receiving the model data sent by the fourth FMU variable bound with the third FMU variable from the DDS data interaction network, and running simulation in a user interface (UI) mode to output simulation results.
[0024] In a second aspect, the present application provides a joint simulation device for multi-source heterogeneous models, the device comprising:
[0025] a packaging module, configured to: encapsulate, for each multi-source heterogeneous model in simulation tools for joint simulation by a multidisciplinary simulation platform, a data distribution service (DDS) data interaction network and a scheduler into a dynamic library, configure, in an extensible markup language (XML) description file, functional mock-up unit (FMU) variables corresponding to model variables used for interaction of the multi-source heterogeneous model, and package the dynamic library and the configured XML description file to generate an FMU file corresponding to the multi-source heterogeneous model, wherein each FMU variable is used for sending or receiving data;
[0026] an importing module, configured to: import the corresponding FMU file in each multi-source heterogeneous model, and bind each model variable used for interaction with the corresponding FMU variable to obtain first binding information;
[0027] a scheduling module, configured to: parse the XML description file in the FMU file corresponding to each multi-source heterogeneous model by the multidisciplinary simulation platform to obtain each FMU variable, bind each FMU variable with FMU variables used for interaction to obtain second binding information, and send scheduling information to each scheduler after determining that each multi-source heterogeneous model has entered a simulation blocking state;
[0028] a simulation module, configured to: synchronize, by each scheduler, a clock of each multi-source heterogeneous model based on the received scheduling information, and simultaneously run simulation in a user interface (UI) mode by each multi-source heterogeneous model according to the first binding information and the second binding information to receive and send model data corresponding to each model variable from the DDS data interaction network, and output each simulation result.
[0029] Optionally, the packaging module is specifically configured to:
[0030] set, in the XML description file, a variable name, an initial value, a variable type, description information, and reference information of a functional mock-up unit (FMU) variable corresponding to a model variable used for interaction of the multi-source heterogeneous model.
[0031] Optionally, the scheduling module includes:
[0032] a binding unit, configured to: receive an FMU variable binding instruction, bind, for each FMU variable in the FMU variable binding instruction, the FMU variable with FMU variables used for interaction to generate a pair of bound variables, and determine the FMU variable and FMU variables not bound therewith as a pair of unbound variables, wherein the FMU variable binding instruction contains a correspondence between each FMU variable and FMU variables used for interaction.
[0033] The setting unit is configured to set the DDS topic partition value of each FMU variable in each pair of bound variables to the same value, and set the DDS topic partition value of each FMU variable in each pair of unbound variables to different values, wherein the DDS topic partition value represents a partition and a topic to which the FMU variable belongs in the DDS data interaction network.
[0034] Optionally, the simulation module is specifically configured to:
[0035] The multiple-source heterogeneous models are clock-synchronized by releasing the named semaphore in each fmi2DoStep interface based on the received scheduling information through each scheduler.
[0036] Optionally, the simulation module is specifically configured to:
[0037] For each model variable in each multiple-source heterogeneous model, when the interaction mode of the model variable is data sending, the model data corresponding to the model variable is sent to the DDS data interaction network through the first FMU variable bound to the model variable, so that the second FMU variable bound to the first FMU variable can receive the model data corresponding to the model variable from the DDS data interaction network; when the interaction mode of the model variable is data receiving, the model data sent by the fourth FMU variable bound to the third FMU variable is received from the DDS data interaction network based on the third FMU variable bound to the model variable, and a simulation result is output by running simulation in the form of a user interface (UI).
[0038] According to the above, the multi-source heterogeneous model joint simulation method and device provided by the embodiment of the application can encapsulate a data distribution service (DDS) data interaction network and a scheduler into a dynamic library for each multi-source heterogeneous model in simulation tools that are jointly simulated by a multidisciplinary joint simulation platform, configure functional mock-up unit (FMU) variables corresponding to model variables used for interaction of the multi-source heterogeneous model in an extensible markup language (XML) description file, pack the dynamic library and the configured XML description file to generate an FMU file corresponding to the multi-source heterogeneous model, wherein each FMU variable is used for sending or receiving data, import the corresponding FMU file in each multi-source heterogeneous model, and bind each model variable used for interaction to the corresponding FMU variable to obtain first binding information, parse the XML description file in the FMU file corresponding to each multi-source heterogeneous model by the multidisciplinary joint simulation platform to obtain each FMU variable, bind each FMU variable to an FMU variable used for interaction to obtain second binding information, send scheduling information to each scheduler after it is determined that each multi-source heterogeneous model has entered a simulation blocking state, synchronize clocks of each multi-source heterogeneous model based on the received scheduling information by each scheduler, simultaneously, collect and transmit model data corresponding to each model variable from the DDS data interaction network by each multi-source heterogeneous model according to the first binding information and the second binding information to run simulation in a user interface (UI) mode, and output each simulation result. Thus, the DDS data interaction network and the scheduler are integrated in the FMU file, and are used by each simulation tool in a joint simulation manner, without the need to export models and solvers and generate FMU files, thereby improving operability, most simulation tools support joint simulation in the form of imported FMU files, thus, there is no need to develop corresponding joint simulation interfaces for each simulation tool, thereby greatly improving the universality of the joint simulation interface, reducing the development cost and maintenance cost of the software interface, and collecting and transmitting model data corresponding to each model variable by each multi-source heterogeneous model and running simulation in the UI mode, thereby solving the problem that the traditional method of exporting FMU files can only perform joint simulation in the form of a black box, and improving the visual effect.
[0039] The innovation points of the embodiment of the application include:
[0040] 1. The joint simulation is performed by integrating the DDS data interaction network and the scheduler in the FMU file and importing and using by each simulation tool, without exporting and generating the FMU file from the model and the solver, the operability is improved, and most of the simulation tools support the joint simulation in the form of importing the FMU file, therefore, the corresponding joint simulation interface of each simulation tool does not need to be developed, the universality of the joint simulation interface is greatly improved, the development cost and the maintenance cost of the software interface are reduced, and each multi-source heterogeneous model transmits the model data corresponding to each model variable and runs the simulation in the user interface (UI) mode, the problem that the joint simulation is mostly performed in the form of a black box in the traditional method of exporting the FMU file is solved, and the visual effect is improved.
[0041] 2. Since the simulation tool does not need to integrate the model in the FMU file, the problem that the model is reduced in order and the FMU file needs to be re-exported when the model parameters are modified does not exist, and the convenience is improved.
[0042] 3. The second binding information is obtained by setting the DDS topic partition value of each FMU variable in each pair of bound variables to the same value and setting the DDS topic partition value of each FMU variable in each pair of unbound variables to different values, the second binding information not only includes the information of the bound variable but also includes the information of the unbound variable, so that errors are not prone to occur during subsequent data interaction.
[0043] 4. Using the method of the embodiment of the application, each simulation tool does not need to export the FMU model in the form of a black box, only needs to use the simulation model in the form of a white box, imports the corresponding FMU file, and can perform joint simulation in the form of a white box, the operation convenience is improved.
[0044] 5. The joint simulation device of the multi-source heterogeneous model provided by the application performs joint simulation by integrating the DDS data interaction network and the scheduler in the FMU file and importing and using by each simulation tool, without exporting and generating the FMU file from the model and the solver, the operability is improved, and most of the simulation tools support the joint simulation in the form of importing the FMU file, therefore, the corresponding joint simulation interface of each simulation tool does not need to be developed, the universality of the joint simulation interface is greatly improved, the development cost and the maintenance cost of the software interface are reduced, and each multi-source heterogeneous model transmits the model data corresponding to each model variable and runs the simulation in the user interface (UI) mode, the problem that the joint simulation is mostly performed in the form of a black box in the traditional method of exporting the FMU file is solved, and the visual effect is improved.
[0045] Of course, implementing any product or method of the application does not necessarily require achieving all the advantages described above at the same time. BRIEF DESCRIPTION OF DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description only represent some of the embodiments of the present application. For those skilled in the art, other drawings can also be obtained from these drawings without any creative effort.
[0047] Figure 1 A flowchart of a joint simulation method of a multi-source heterogeneous model provided by the embodiment of the present application;
[0048] Figure 2 A schematic diagram of interaction of a multi-source heterogeneous model and a multi-disciplinary joint simulation platform provided by the embodiment of the present application through a MusimFMU white box special interface file;
[0049] Figure 3 A schematic diagram of configuring a MusimFMU file;
[0050] Figure 4 A structural schematic diagram of a joint simulation device of a multi-source heterogeneous model provided by the embodiment of the present application. DETAILED DESCRIPTION
[0051] The technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments only represent some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without any creative effort fall within the scope of protection of the present application.
[0052] It should be noted that the terms "include" and "have" and any variations thereof in the embodiments of the present application and the drawings are intended to cover non-exclusive inclusion. For example, the processes, methods, systems, products or devices including a series of steps or units are not limited to the listed steps or units, but optionally further include steps or units not listed or optionally further include other steps or units inherent to these processes, methods, products or devices.
[0053] The embodiments of the present application disclose a joint simulation method and device of a multi-source heterogeneous model, which can improve the visual effect and reduce the development cost and maintenance cost. The embodiments of the present application will be described in detail in the following.
[0054] Figure 1 A flowchart of a joint simulation method of a multi-source heterogeneous model provided by the embodiment of the present application. The method is applied to an electronic device. The method specifically includes the following steps.
[0055] S110: for each multi-source heterogeneous model in the simulation tools for joint simulation through the multidisciplinary joint simulation platform, encapsulate the data distribution service DDS data interaction network and the scheduler into a dynamic library, configure the functional mock-up unit FMU variable corresponding to the model variable used for interaction of the multi-source heterogeneous model in the extensible markup language XML description file, and pack the dynamic library and the configured XML description file to generate the FMU file corresponding to the multi-source heterogeneous model, wherein each FMU variable is used for sending data or receiving data.
[0056] To solve the problems in the prior art, embodiments of the present application provide a joint simulation method of multi-source heterogeneous models, which integrates a DDS (Data Distribution Service) data interaction network and a scheduler in an FMU (Functional Mock-up Unit) file (hereinafter also referred to as a MusimFMU white box special interface or a MusimFMU file), so that each commercial simulation tool performs joint simulation of multi-source heterogeneous models in a standard and universal manner by importing the FMU file.
[0057] Figure 2 A schematic diagram of interaction of multi-source heterogeneous models and a multidisciplinary joint simulation platform through a MusimFMU white box special interface file is provided for embodiments of the present application. Referring to Figure 2 , the simulation tool can be a simulation software or other third-party tool, and the simulation software can be Matlab simulation software, Ansys CFX simulation software or AMESim simulation software. Figure 2 The simulation model in is a multi-source heterogeneous model.
[0058] For each multi-source heterogeneous model in the simulation tools for joint simulation through the multidisciplinary joint simulation platform, the data distribution service DDS data interaction network and the scheduler are encapsulated into a dynamic library, specifically, the DDS data interaction network and the scheduler are encapsulated into a DLL (Dynamic Link Library) dynamic library or a SO dynamic library according to the FMI-Cosimulation 2.0 standard.
[0059] Meanwhile, the FMU variables corresponding to the model variables used for interaction of the multi-source heterogeneous model are configured in an XML (Extensible Markup Language) file, wherein each FMU variable is used for sending data or receiving data.
[0060] The above configuration of the FMU variables corresponding to the model variables used for interaction of the multi-source heterogeneous model in the XML description file can include:
[0061] The variable name, initial value, variable type, description information and reference information of the functional mock-up unit (FMU) variable corresponding to the model variable of the multi-source heterogeneous model used for interaction are set in the XML description file.
[0062] Figure 3 is a schematic diagram of configuring the MusimFMU file, see Figure 3 The user can add and delete the FMU variable corresponding to the model variable, specifically, the variable name (var1, var2, var3), variable type (input / output / parameter), initial value, description information and Ref (reference) information of the FMU variable corresponding to the model variable can be customized. These information will be packaged into the XML description file for the multi-disciplinary simulation platform and each simulation tool to identify.
[0063] The variable name: the variable name of the FMU variable customized by the user, corresponding to the name field in the XML description file in the FMU.
[0064] The initial value: the initial value of the FMU variable at the start of the simulation, corresponding to the start field in the XML description file in the FMU.
[0065] The variable type: the interface type of the FMU variable, optional input (input variable), output (output variable), parameter (parameter), corresponding to the causality field in the XML description file in the FMU.
[0066] The description information: the description text customized by the user, corresponding to the description field in the XML description file in the FMU.
[0067] Ref: the reference information of the FMU variable, corresponding to the value Reference field in the XML description file in the FMU.
[0068] Then the dynamic library and the configured XML description file are packaged to generate the FMU file corresponding to the multi-source heterogeneous model. As shown in Figure 3 , specifically, the above DLL dynamic library / SO dynamic library and the XML description file are compressed in.zip format and renamed as.fmu file to complete the packaging of the FMU file, and then the packaged FMU file corresponding to the multi-source heterogeneous model is exported and placed in a position that can be called by the multi-disciplinary simulation platform and each simulation tool, for example, the hard disk of the electronic device.
[0069] According to the joint simulation scene, different FMU files need to be packaged for different multi-source heterogeneous models, and each FMU file at least contains different XML description files.
[0070] And the dynamic library of the FMU file also encapsulates an initialization function to complete the initialization of the DDS data interaction network and the scheduler.
[0071] S120: Import the corresponding FMU file in each multi-source heterogeneous model, and bind each model variable used for interaction with the corresponding FMU variable to obtain first binding information.
[0072] After generating the FMU file corresponding to each multi-source heterogeneous model, the corresponding FMU file can be imported into each multi-source heterogeneous model.
[0073] As shown in Figure 2 , after each multi-source heterogeneous model imports the corresponding FMU file, the visualized FMU file can be seen in each multi-source heterogeneous model, so it has a white-box dedicated interface, and in Figure 2 , only the DDS data interaction network and the scheduler in the white-box dedicated interface are displayed.
[0074] Then, each model variable used for interaction is bound with the corresponding FMU variable to obtain first binding information, specifically, each model variable used for interaction can be bound with the corresponding FMU variable to obtain first binding information.
[0075] Receive a model variable binding instruction, and bind each model variable used for interaction with the corresponding FMU variable according to the model variable binding instruction to obtain first binding information, wherein the model variable binding instruction contains the corresponding relationship between each model variable and each FMU variable.
[0076] After each model variable is bound with the corresponding FMU variable, each model variable can send or receive data through the corresponding FMU variable, wherein the binding mode can be any one of the binding modes in the prior art, and the embodiments of the present application do not make any limitation thereto.
[0077] Each multi-source heterogeneous model interacts with the DDS data interaction network in the white-box dedicated interface through the fmi2GetReal interface or the fmi2SetReal interface.
[0078] Each simulation tool and the multidisciplinary co-simulation platform interact with each other through the DDS data interaction network, the DDS data interaction network is a data-centric middleware protocol and API (Application Programming Interface) standard, data is identified by Topic, and the publisher can publish data according to the Topic, and the subscriber subscribes to data according to the Topic of interest.
[0079] Each multi-source heterogeneous model in each simulation tool sends or receives model data corresponding to the variables that need to be interacted by calling the dynamic library in the imported FMU file, see the following description for specific manners.
[0080] S130: Obtain each FMU variable by parsing the XML description file in the FMU file corresponding to each multi-source heterogeneous model through the multidisciplinary joint simulation platform, bind each FMU variable with the FMU variable that interacts with it to obtain second binding information, and send scheduling information to each scheduler after determining that each multi-source heterogeneous model has entered a simulation blocking state.
[0081] When joint simulation is needed, obtain each FMU variable by parsing the XML description file in the FMU file corresponding to each multi-source heterogeneous model through the multidisciplinary joint simulation platform.
[0082] Then, bind each FMU variable with the FMU variable that interacts with it to obtain second binding information. The binding of each FMU variable with the FMU variable that interacts with it to obtain second binding information can include:
[0083] Receive an FMU variable binding instruction, for each FMU variable in the FMU variable binding instruction, bind the FMU variable with the FMU variable that interacts with it to generate a pair of bound variables, and determine the FMU variable and the FMU variable that is not bound to it as a pair of unbound variables, wherein the FMU variable binding instruction contains the corresponding relationship between each FMU variable and each FMU variable that interacts with it;
[0084] Set the DDS topic partition value of each FMU variable in each pair of bound variables to the same value, and set the DDS topic partition value of each FMU variable in each pair of unbound variables to different values, wherein the DDS topic partition value represents the partition and topic to which the FMU variable belongs in the DDS data interaction network.
[0085] A pair of bound variables refers to data interaction between two FMU variables, for example: the AFMU variable needs to send data to the BFMU variable, or the AFMU variable needs to receive data from the BFMU variable, then the AFMU variable and the BFMU variable are a pair of bound variables; a pair of unbound variables refers to no data interaction between two FMU variables, for example, no data interaction between the AFMU variable and the CFMU variable, then the AFMU variable and the CFMU variable are a pair of unbound variables. Moreover, two FMU variables that interact with each other must be located in different FMU files, therefore, the two FMU variables in a pair of bound variables must be located in different FMU files.
[0086] Topic is the basic unit for defining data type and data name in the DDS data interaction network. Topic is used to classify different types of data, and Partition is a logical partition in the DDS data interaction network, which is used to classify and isolate Topic in a more fine-grained manner. It can be simply understood that: Topic is a large area in the DDS data interaction network, and partition is a small area in Topic. The DDS topic partition value represents the partition and topic to which the FMU variable belongs in the DDS data interaction network, and the DDS topic partition value is the DDS topic&Partition value.
[0087] A pair of bound variables must belong to the same partition and topic, so the DDS topic partition value of each FMU variable in each pair of bound variables is set to the same value, for example: the topic is set to 1 and the partition is set to 2, so Topic&Partition is 1&2. A pair of unbound variables belongs to different partitions and topics, so the DDS topic partition value of each FMU variable in each pair of unbound variables is set to a different value.
[0088] Therefore, by setting the DDS topic partition value of each FMU variable in each pair of bound variables to the same value and setting the DDS topic partition value of each FMU variable in each pair of unbound variables to a different value, the second binding information is obtained. The second binding information not only includes the information of the bound variables but also includes the information of the unbound variables, so that errors are less likely to occur during subsequent data interaction.
[0089] Referring back to Figure 2 , the multi-disciplinary simulation platform is provided with a plurality of scheduling engines, each scheduling engine is in communication connection with each scheduler through an IPC (Inter-Process Communication) interface, each scheduler is in single-step execution with each multi-source heterogeneous model through an mdlUpdate interface or an fmi2DoStep interface, and different multi-source heterogeneous models are clock-synchronized through the scheduler.
[0090] The fmi2DoStep interface of the dynamic library in the FMU file is a single-step simulation interface or a step interface, which encapsulates a scheduler for synchronizing scheduling information with the multi-disciplinary simulation platform, and realizes the scheduling of the multi-source heterogeneous model through blocking or releasing the named semaphore in the interface, thereby achieving clock synchronization.
[0091] Specifically, when the named semaphore in the fmi2DoStep interface has not received the scheduling information sent by the multi-disciplinary simulation platform, the named semaphore will be blocked in the fmi2DoStep interface, and the simulation time in each multi-source heterogeneous model will continue to wait at a certain time point, for example, it is blocked at the beginning of simulation, that is, it waits at 0 time, and when the named semaphore in the fmi2DoStep interface is released, the multi-source heterogeneous model is allowed to advance the simulation time once.
[0092] In each multi-source heterogeneous model, the simulation time continues to wait at a certain time point, that is, enters a simulation blocking state, and at this time, the blocking notification information is sent to the multi-disciplinary simulation platform. After receiving each blocking notification information and determining that each multi-source heterogeneous model has entered the simulation blocking state, the multi-disciplinary simulation platform sends scheduling information to each scheduler.
[0093] S140: Synchronizing the clock of each multi-source heterogeneous model through each scheduler based on the received scheduling information, running simulation through each multi-source heterogeneous model according to the first binding information and the second binding information to receive and transmit the model data corresponding to each model variable from the DDS data interaction network in the user interface (UI) mode, and outputting each simulation result.
[0094] Each scheduler receives the scheduling information, and then synchronizes the clock based on the received scheduling information, so that each multi-source heterogeneous model in each simulation tool realizes clock synchronization under the unified scheduling of the multi-disciplinary simulation platform, thereby realizing joint simulation.
[0095] In this way, the clock of each multi-source heterogeneous model is synchronized through each scheduler based on the received scheduling information, which can include:
[0096] The clock of each multi-source heterogeneous model is synchronized through each scheduler based on the received scheduling information to release the named semaphore in each fmi2DoStep interface.
[0097] After each scheduler receives the scheduling information, the named semaphore in each fmi2DoStep interface is released to synchronize the clock of each multi-source heterogeneous model.
[0098] After the clock is synchronized, the simulation is run through each multi-source heterogeneous model according to the first binding information and the second binding information to receive and transmit the model data corresponding to each model variable from the DDS data interaction network in the user interface (UI) mode, and each simulation result is output.
[0099] In this way, the simulation is run through each multi-source heterogeneous model according to the first binding information and the second binding information to receive and transmit the model data corresponding to each model variable from the DDS data interaction network in the user interface (UI) mode, and each simulation result is output, which can include:
[0100] For each model variable in each multi-source heterogeneous model, when the interaction mode of the model variable is sending data, the model data corresponding to the model variable is sent to the DDS data interaction network through the first FMU variable bound with the model variable, so that the second FMU variable bound with the first FMU variable can receive the model data corresponding to the model variable from the DDS data interaction network; when the interaction mode of the model variable is receiving data, the model data sent by the fourth FMU variable bound with the third FMU variable is received from the DDS data interaction network based on the third FMU variable bound with the model variable, and a simulation result is output in the form of a user interface (UI).
[0101] For each model variable in each multi-source heterogeneous model, when the interaction mode of the model variable is sending data, the model data corresponding to the model variable is sent to the DDS data interaction network through the first FMU variable bound with the model variable, so that the second FMU variable bound with the first FMU variable can receive the model data corresponding to the model variable from the DDS data interaction network; when the interaction mode of the model variable is receiving data, the model data sent by the fourth FMU variable bound with the third FMU variable is received from the DDS data interaction network based on the third FMU variable bound with the model variable, and a simulation result is output in the form of a user interface (UI).
[0102] For each model variable in each multi-source heterogeneous model, when the interaction mode of the model variable is sending data, the model data corresponding to the model variable is sent to the DDS data interaction network through the first FMU variable bound with the model variable, so that the second FMU variable bound with the first FMU variable can receive the model data corresponding to the model variable from the DDS data interaction network; when the interaction mode of the model variable is receiving data, the model data sent by the fourth FMU variable bound with the third FMU variable is received from the DDS data interaction network based on the third FMU variable bound with the model variable, and a simulation result is output in the form of a user interface (UI).
[0103] That is, a complete model data interaction process can be: the model data corresponding to the model variable is sent to the DDS data interaction network through the first FMU variable bound with the model variable, and the model variable bound with the second FMU variable receives the model data sent by the first FMU variable bound with the second FMU variable from the DDS data interaction network.
[0104] For example, the D model variable is bound with the E FMU variable, the E FMU variable is bound with the F FMU variable, and the F FMU variable is bound with the G model variable, the model data H corresponding to the D model variable is sent to the DDS data interaction network through the E FMU variable, and the G model variable receives the model data H from the DDS data interaction network through the F FMU variable.
[0105] After receiving each model data, the simulation can be run in the form of a user interface (UI), and after running the simulation of each multi-source heterogeneous model, each simulation result can be output, wherein the output mode of each simulation result can be: outputting each simulation result in a visual form, specifically, outputting each simulation result in a table form or outputting each simulation result in an image form.
[0106] According to the above, the multi-source heterogeneous model joint simulation method provided by the embodiment of the application can encapsulate a data distribution service (DDS) data interaction network and a scheduler into a dynamic library for each multi-source heterogeneous model in a simulation tool that is jointly simulated by a multidisciplinary joint simulation platform, configure functional mock-up unit (FMU) variables corresponding to model variables used for interaction of the multi-source heterogeneous model in an extensible markup language (XML) description file, and pack the dynamic library and the configured XML description file to generate an FMU file corresponding to the multi-source heterogeneous model, wherein each FMU variable is used for sending or receiving data; import the corresponding FMU file in each multi-source heterogeneous model, and bind each model variable used for interaction to the corresponding FMU variable to obtain first binding information; parse the XML description file in the FMU file corresponding to each multi-source heterogeneous model by the multidisciplinary joint simulation platform to obtain each FMU variable, and bind each FMU variable to an FMU variable used for interaction to obtain second binding information; after it is determined that each multi-source heterogeneous model has entered a simulation blocking state, send scheduling information to each scheduler; synchronize the clock of each multi-source heterogeneous model based on the received scheduling information by each scheduler, and at the same time, collect and transmit model data corresponding to each model variable from the DDS data interaction network according to the first binding information and the second binding information by each multi-source heterogeneous model to run simulation in a user interface (UI) mode, and output each simulation result. In this way, the DDS data interaction network and the scheduler are integrated in the FMU file, and the joint simulation is performed by importing and using the FMU file by each simulation tool, without the need to export and generate the FMU file from the model and the solver, thereby improving the operability, and most simulation tools support joint simulation in the form of importing the FMU file, so that the corresponding joint simulation interface does not need to be developed for each simulation tool, thereby greatly improving the universality of the joint simulation interface, reducing the development cost and maintenance cost of the software interface, and collecting and transmitting the model data corresponding to each model variable and running simulation in the UI mode, thereby solving the problem that the traditional method of exporting the FMU file can only perform joint simulation in the form of a black box, and improving the visualization effect.
[0107] Meanwhile, since the simulation tool does not need to integrate the model in the FMU file, there is no problem of model reduction caused by the exported FMU file, and the model parameters need to be re-exported, thereby improving the convenience.
[0108] In addition, using the method of the embodiment of the application, each simulation tool does not need to export a black-box FMU model, but only needs to use a white-box simulation model, import the corresponding FMU file, and perform joint simulation in the form of a white box, thereby improving the operation convenience.
[0109] Figure 4A structural schematic diagram of a multi-source heterogeneous model joint simulation device provided by an embodiment of the present application. Referring to Figure 4 The multi-source heterogeneous model joint simulation device provided by the embodiment of the present application comprises:
[0110] The packaging module 401 is configured to encapsulate, for each multi-source heterogeneous model in the simulation tools for joint simulation by the multi-disciplinary joint simulation platform, a data distribution service (DDS) data interaction network and a scheduler into a dynamic library, configure, in an extensible markup language (XML) description file, function simulation unit (FMU) variables corresponding to model variables used for interaction of the multi-source heterogeneous model, and package the dynamic library and the configured XML description file to generate an FMU file corresponding to the multi-source heterogeneous model, wherein each FMU variable is used for sending or receiving data.
[0111] The importing module 402 is configured to import the corresponding FMU file in each multi-source heterogeneous model, and bind each model variable used for interaction with the corresponding FMU variable to obtain first binding information.
[0112] The scheduling module 403 is configured to parse the XML description file in the FMU file corresponding to each multi-source heterogeneous model by the multi-disciplinary joint simulation platform to obtain each FMU variable, bind each FMU variable with the FMU variable used for interaction to obtain second binding information, and send scheduling information to each scheduler after determining that each multi-source heterogeneous model has entered a simulation blocking state.
[0113] The simulation module 404 is configured to perform clock synchronization on each multi-source heterogeneous model by each scheduler based on the received scheduling information, and simultaneously perform simulation in a user interface (UI) mode by each multi-source heterogeneous model according to the first binding information and the second binding information to receive and send model data corresponding to each model variable from the DDS data interaction network, and output each simulation result.
[0114] The multi-source heterogeneous model joint simulation device provided by the embodiment of the present application can encapsulate a data distribution service (DDS) data interaction network and a scheduler into a dynamic library for each multi-source heterogeneous model in simulation tools that are jointly simulated through a multidisciplinary joint simulation platform, configure functional mock-up unit (FMU) variables corresponding to model variables used for interaction of the multi-source heterogeneous model in an extensible markup language (XML) description file, pack the dynamic library and the configured XML description file to generate an FMU file corresponding to the multi-source heterogeneous model, wherein each FMU variable is used for sending or receiving data, import the corresponding FMU file in each multi-source heterogeneous model, and bind each model variable used for interaction with the corresponding FMU variable to obtain first binding information, parse the XML description file in the FMU file corresponding to each multi-source heterogeneous model through the multidisciplinary joint simulation platform to obtain each FMU variable, bind each FMU variable with FMU variables used for interaction to obtain second binding information, send scheduling information to each scheduler after it is determined that each multi-source heterogeneous model has entered a simulation blocking state, synchronize clocks of each multi-source heterogeneous model based on the received scheduling information through each scheduler, simultaneously, receive and send model data corresponding to each model variable from the DDS data interaction network according to the first binding information and the second binding information through each multi-source heterogeneous model to run simulation in a user interface (UI) mode, and output each simulation result. In this way, the DDS data interaction network and the scheduler are integrated in the FMU file, and are used in a manner of being imported by each simulation tool for joint simulation, without the need to export models and solvers and generate FMU files, thereby improving operability, most simulation tools support joint simulation in the manner of importing FMU files, thus, there is no need to develop corresponding joint simulation interfaces for each simulation tool, thereby greatly improving the universality of the joint simulation interface, reducing the development cost and maintenance cost of the software interface, and receiving and sending model data corresponding to each model variable and running simulation in the UI mode, thereby solving the problem that joint simulation can only be performed in a black box form in the traditional method of exporting FMU files, and improving the visual effect.
[0115] In an implementation manner, the packing module 401 can be specifically used for:
[0116] The variable name, initial value, variable type, description information, and reference information of the FMU variable corresponding to the model variable used for interaction of the multi-source heterogeneous model are set in the XML description file.
[0117] In an implementation manner, the scheduling module 403 can include:
[0118] The binding unit is configured to receive FMU variable binding instructions, bind, for each FMU variable in the FMU variable binding instructions, the FMU variable and an FMU variable interacting with the FMU variable to generate a pair of bound variables, and determine the FMU variable and an FMU variable not bound to the FMU variable as a pair of unbound variables, wherein the FMU variable binding instructions include a correspondence between each FMU variable and each FMU variable interacting with the FMU variable;
[0119] The setting unit is configured to set a DDS topic partition value of each FMU variable in each pair of bound variables to a same value, and set a DDS topic partition value of each FMU variable in each pair of unbound variables to different values, wherein the DDS topic partition value represents a partition and a topic to which the FMU variable belongs in the DDS data interaction network.
[0120] In an implementation manner, the simulation module 404 can be specifically configured to:
[0121] The plurality of heterogeneous models are clock-synchronized by releasing, by each scheduler, a named semaphore in each fmi2DoStep interface based on the received scheduling information.
[0122] In an implementation manner, the simulation module 404 can be specifically configured to:
[0123] For each model variable in each of the plurality of heterogeneous models, when the interaction mode of the model variable is data sending, model data corresponding to the model variable is sent to the DDS data interaction network through a first FMU variable bound to the model variable, so that a second FMU variable bound to the first FMU variable can receive the model data corresponding to the model variable from the DDS data interaction network; when the interaction mode of the model variable is data receiving, model data sent by a fourth FMU variable bound to a third FMU variable is received from the DDS data interaction network based on the third FMU variable bound to the model variable, and a simulation result is output by running simulation in a user interface (UI) form.
[0124] The device embodiment corresponds to the method embodiment and has the same technical effects as the method embodiment. For specific descriptions, refer to the method embodiment. The device embodiment is based on the method embodiment, and specific descriptions can be found in the method embodiment, which will not be repeated here.
[0125] Those skilled in the art can understand that the drawings are only schematic diagrams of an embodiment, and the modules or flows in the drawings are not necessarily necessary for implementing the present application.
[0126] Those skilled in the art can understand that the modules in the device in the embodiments can be distributed in the device in the embodiments as described in the embodiments, or can be changed to be located in one or more devices different from the embodiments. The modules in the above embodiments can be combined into one module, or can be further split into multiple sub-modules.
[0127] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A co-simulation method for multi-source heterogeneous models, characterized in that, The method includes: For each multi-source heterogeneous model in the simulation tool that performs joint simulation through a multi-disciplinary joint simulation platform, the Data Distribution Service (DDS) data interaction network and scheduler are encapsulated into a dynamic library. The Functional Model Unit (FMU) variables corresponding to the model variables used for interaction of the multi-source heterogeneous model are configured in the Extensible Markup Language (XML) description file. The dynamic library and the configured XML description file are packaged to generate the FMU file corresponding to the multi-source heterogeneous model. Each FMU variable is used to send or receive data. Import the corresponding FMU file into each multi-source heterogeneous model, and bind each model variable used for interaction with the corresponding FMU variable to obtain the first binding information; The multidisciplinary joint simulation platform parses the XML description files in the FMU files corresponding to each multi-source heterogeneous model to obtain each FMU variable, and binds each FMU variable and the FMU variable that interacts with it to obtain the second binding information. After determining that each multi-source heterogeneous model has entered the simulation blocking state, the scheduling information is sent to each scheduler. Each scheduler synchronizes the clocks of each multi-source heterogeneous model based on the received scheduling information. Each multi-source heterogeneous model sends and receives model data corresponding to each model variable from the DDS data interaction network according to the first binding information and the second binding information, runs the simulation in the user interface (UI) mode, and outputs each simulation result.
2. The co-simulation method for multi-source heterogeneous models as described in claim 1, characterized in that, The step of configuring the functional simulation unit (FMU) variables corresponding to the model variables used for interaction in the XML description file for the multi-source heterogeneous model includes: In the XML description file, set the variable name, initial value, variable type, description information, and reference information of the functional simulation unit (FMU) variables corresponding to the model variables used for interaction in this multi-source heterogeneous model.
3. The co-simulation method for multi-source heterogeneous models as described in claim 1, characterized in that, The step of binding each FMU variable and the FMU variables that interact with it to obtain the second binding information includes: Receive FMU variable binding instructions, and for each FMU variable in the FMU variable binding instructions, bind the FMU variable and the FMU variables that interact with it to generate a pair of bound variables, and determine the FMU variable and the FMU variables that are not bound to it as a pair of unbound variables. The FMU variable binding instructions contain the correspondence between each FMU variable and each FMU variable that interacts with it. Set the DDS topic partition values of each FMU variable in each pair of bound variables to the same value, and set the DDS topic partition values of each FMU variable in each pair of unbound variables to different values, wherein the DDS topic partition value represents the partition and topic to which the FMU variable belongs in the DDS data interaction network.
4. The co-simulation method for multi-source heterogeneous models as described in claim 1, characterized in that, The step of synchronizing the clocks of each multi-source heterogeneous model based on the received scheduling information by each scheduler includes: Clock synchronization of each multi-source heterogeneous model is achieved by releasing named semaphores in each fmi2DoStep interface based on the received scheduling information by each scheduler.
5. The co-simulation method for multi-source heterogeneous models as described in claim 1, characterized in that, The steps of running simulations and outputting simulation results by sending and receiving model data corresponding to each model variable from the DDS data interaction network according to the first binding information and the second binding information of each multi-source heterogeneous model, and running simulations in user interface (UI) mode, include: For each model variable in a multi-source heterogeneous model, when the interaction mode of the model variable is to send data, the model data corresponding to the model variable is sent to the DDS data interaction network through the first FMU variable bound to the model variable, so that the second FMU variable bound to the first FMU variable can receive the model data corresponding to the model variable from the DDS data interaction network. When the interaction mode of the model variable is to receive data, the model data sent by the fourth FMU variable bound to the third FMU variable is received from the DDS data interaction network based on the third FMU variable bound to the model variable, and the simulation results are output in the form of user interface (UI).
6. A co-simulation device for multi-source heterogeneous models, characterized in that, The device includes: The packaging module is used to encapsulate the Data Distribution Service (DDS) data interaction network and scheduler into a dynamic library for each multi-source heterogeneous model in the simulation tool that performs joint simulation through a multi-disciplinary joint simulation platform. It configures the functional simulation unit (FMU) variables corresponding to the model variables used for interaction of the multi-source heterogeneous model in an extensible markup language (XML) description file, and packages the dynamic library and the configured XML description file to generate the FMU file corresponding to the multi-source heterogeneous model. Each FMU variable is used to send or receive data. The import module is used to import the corresponding FMU files into each multi-source heterogeneous model and bind the model variables used for interaction with the corresponding FMU variables to obtain the first binding information; The scheduling module is used to parse the XML description files in the FMU files corresponding to each multi-source heterogeneous model through the multi-disciplinary joint simulation platform to obtain each FMU variable, and bind each FMU variable and the FMU variable that interacts with it to obtain the second binding information. After determining that each multi-source heterogeneous model has entered the simulation blocking state, the scheduling information is sent to each scheduler. The simulation module is used to synchronize the clocks of each multi-source heterogeneous model based on the received scheduling information through each scheduler. At the same time, each multi-source heterogeneous model sends and receives model data corresponding to each model variable from the DDS data interaction network according to the first binding information and the second binding information, runs the simulation in the user interface (UI) mode, and outputs each simulation result.
7. The co-simulation device for multi-source heterogeneous models as described in claim 6, characterized in that, The packaging module is specifically used for: In the XML description file, set the variable name, initial value, variable type, description information, and reference information of the functional simulation unit (FMU) variables corresponding to the model variables used for interaction in this multi-source heterogeneous model.
8. The co-simulation device for multi-source heterogeneous models as described in claim 6, characterized in that, The scheduling module includes: A binding unit is used to receive an FMU variable binding instruction, and for each FMU variable in the FMU variable binding instruction, bind the FMU variable and the FMU variables that interact with it to generate a pair of bound variables, and determine the FMU variable and the FMU variables that are not bound to it as a pair of unbound variables. The FMU variable binding instruction contains the correspondence between each FMU variable and each FMU variable that interacts with it. The setting unit is used to set the DDS topic partition value of each FMU variable in each pair of bound variables to the same value, and to set the DDS topic partition value of each FMU variable in each pair of unbound variables to different values, wherein the DDS topic partition value represents the partition and topic to which the FMU variable belongs in the DDS data interaction network.
9. The co-simulation device for multi-source heterogeneous models as described in claim 6, characterized in that, The simulation module is specifically used for: Clock synchronization of each multi-source heterogeneous model is achieved by releasing named semaphores in each fmi2DoStep interface based on the received scheduling information by each scheduler.
10. The co-simulation device for multi-source heterogeneous models as described in claim 6, characterized in that, The simulation module is specifically used for: For each model variable in a multi-source heterogeneous model, when the interaction mode of the model variable is sending data, the model data corresponding to the model variable is sent to the DDS data interaction network through the first FMU variable bound to the model variable, so that the second FMU variable bound to the first FMU variable can receive the model data corresponding to the model variable from the DDS data interaction network; when the interaction mode of the model variable is receiving data, the model data sent by the fourth FMU variable bound to the third FMU variable is received from the DDS data interaction network based on the third FMU variable bound to the model variable, and the simulation is run and output in the form of a user interface (UI).