Method and computer system for co-simulation
By using DoStep semantic instructions and event processing calls of inter-process communication interface and functional model units in a heterogeneous simulation environment, the problem of coupling complexity of heterogeneous simulation environment is solved, an efficient and accurate collaborative simulation environment is achieved, and development is simplified. process and reduce costs.
Patent Information
- Application Number
- CN202410723365.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-06-07
- Filing Date
- 2024-06-05
- Publication Date
- 2024-12-10
AI Technical Summary
The prior art requires a large number of manual programming of dedicated interfaces when coupling heterogeneous simulation environments, resulting in large workload, slow computing speed, error-prone, and complicated collaboration, making it difficult to achieve efficient collaborative simulation.
The functional model unit of the enhanced simulation model uses the inter-process communication interface to pass the co-simulation step size from the co-simulation host to the corresponding simulation model, and indirectly control the simulation step size through DoStep semantic instructions and event processing calls to realize the co-simulation environment Standardized interfaces and synchronization.
The coupling process of simulation tools is simplified, computing efficiency and accuracy is improved, development and maintenance costs are reduced, and more efficient and accurate collaborative simulation is achieved.
Smart Images

Figure CN119105838A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a computer-implemented method for simulating a process by co-simulation by coupling more than one simulation model, the simulation model processing subsystems being components of the simulation, the method comprising:
[0002] -Some simulation models use the output of other simulation models as input,
[0003] -Control the co-simulation step size of the simulation model through the co-simulation host,
[0004] - An enhanced simulation model, which is a simulation model comprising a functional model unit for model exchange based on the functional model interface standard.
[0005] Furthermore, the invention relates to a computer system which is intended for carrying out the method. Background Art
[0006] As industrial products continue to grow in complexity, their design involves analyzing increasingly complex problems and large-scale multi-domain simulations.
[0007] In the context of the present invention, a simulation tool is a software program used to model and simulate the behavior of a system or process. A simulation tool typically provides a graphical user interface that allows the user to define the parameters of the simulation, create a model of the system, and specify the input and output of the simulation.
[0008] The physics of each domain usually requires different simulation parameters, time steps, and solver settings. While multi-domain simulation tools can bring solutions, industrial challenges are often solved by using a co-simulation environment to handle heterogeneous models and data developed in various simulation tools and target their appropriate solvers. Co-simulation, also known as co-simulation, is a technique used in computer simulation in which multiple simulation models run simultaneously and interact with each other. This allows for more comprehensive and accurate simulation of complex systems involving multiple interacting components. In co-simulation, each model is usually executed on a separate software platform, which can be a different programming language or simulation tool. These models are connected by interfaces that enable the exchange of data and control signals between models. In this way, each model can use the output of other models as input, and the simulation can be performed in a coordinated manner. Co-simulation is used in various fields including engineering, physics, and computer science to simulate and analyze complex systems, such as power grids, automotive systems, and chemical processes. Because it takes into account the interactions between different components, it allows for more accurate and realistic simulation of the behavior of the system under different conditions. A co-simulation environment is created by coupling two or more simulation processes, each of which simulates the model with its own solver.
[0009] The simulation models used in co-simulation can originate from homogeneous simulators or heterogeneous simulators (multi-vendor environments or multi-simulation type environments, such as 3D / 1D simulations). Although co-simulation has been used for decades, proprietary implementations coupling several instances of the same simulation environment have helped formalize the approach, but coupling heterogeneous environments, especially those from multiple simulation tool vendors, has always been a challenge. Co-simulation using heterogeneous simulation tools can imply the implementation of dedicated interface blocks for each simulation environment, or the availability of dedicated working modes and interfaces, either standard or proprietary, among the simulation environments.
[0010] This extra work is tedious, consumes a lot of working time, slows down computations, can reduce accuracy, and is prone to errors. Furthermore, these custom interfaces complicate collaboration, or at least require diligent documentation.
[0011] In this context, the so-called FMI (Functional Mock-up Interface) standard is a set of rules and conventions for defining and using FMU (Functional Mock-up Unit) in the context of model exchange and co-simulation. An FMU is an executable model placed in an archive file whose interface conforms to the FMI standard. FMI collaborated to develop and promote the FMI standard, which is an open standard for model exchange and co-simulation of dynamic models, allowing models to be shared between different simulation tools. The FMI standard enables the sharing and execution of models between / in different simulation tools. It defines a standard file format for exchanging models (functional mockup unit or FMU), a standard interface for connecting simulation tools (FMI API), and a set of standard simulation parameters and data exchange formats. The FMI standard is widely adopted in industry and academia and is supported by many simulation tool and software vendors. FMI provides a standardized interface for exchanging models between different simulation tools, allowing models to be reused and integrated into larger systems. FMI defines two types of FMU: FMU for model exchange (FMU-ME) and FMU for collaborative simulation (FMU-CS).
[0012] FMU-ME is used to exchange models between different simulation environments that support model exchange interface standards, allowing models to be reused and integrated into larger systems. On the other hand, FMU-CS is used for co-simulation, where multiple simulation tools can be used together to simulate complex systems. An FMU for co-simulation (FMU-CS) is an exported simulation process, including its models and solvers, or a wrapper code for tool coupling. In this context, a wrapper code for tool coupling is a piece of software that enables different simulation tools (one simulation tool can be used to model fluid dynamics, while another can be used to model heat transfer) to work together in a multi-physics simulation by providing an interface for communication and data exchange.
[0013] Simulation tools can import an FMU (using the provided features) or export an FMU (providing features).
[0014] Prior art based on the FMI standard included in coupled simulation tools is based on the Co-Simulation Interface Variant (FMU-CS) and is described in a tool coupling scenario or in a derivative described as a distributed co-simulation infrastructure.
[0015] Typically, co-simulation techniques involve the use of a so-called co-simulation master algorithm (MA), or master tool that controls how time advances in connected slave models. This time handling differs in the interface variants of the FMI standard. The MA can be a dedicated stand-alone algorithm, or a "regular" simulation algorithm of the master tool that imports the simulation model via the co-simulation interface.
[0016] The MA or its remote application service that controls the time advancement imports the FMU for co-simulation. The coupled second tool works in slave mode, which means that it is requested through the interface to use its local solver to integrate the equations of its model over a given time interval using given input data valid at the step start time and feed back output data valid for the step end time ("Dostep" semantics). The second tool provides the FMU-CS to be imported by the master tool.
[0017] CosiMate is a known tool in the co-simulation community. CosiMate from ChiasTek Inc. is a solution based on a library of custom I / O port blocks to be added to each model. These ports handle the communication with the router algorithm running in a separate co-simulation control process.
[0018] While CosiMate claims to have the ability to import FMU-ME models, it does not provide for such models to be imported by the simulation tools to be coupled. Their coupling techniques require difficult to develop and expensive to maintain dedicated coupling components for each coupled simulation environment.
[0019] From CAMUSBENJAMIN et al.: "Co-simulation of FMUs and Distribu tedApplications with SimGrid", Proceedings of the 2018 ACM SIGSIM Conference on Principles of Advanced Discrete Simulation, May 14, 2018, pp. 145-156, XP093102210, New York, NY, USA, 001:10.1145 / 3200921.3200932, ISBN: 978-1-4503-5092-1, URL: https: / / dl.acm.org / doi / pdf / 10.1145 / 3200921.3200932, it is known that a synchronous sampling system controls the step size by combining the dates of event occurrence checks to find the maximum step size that reaches the earliest date; i.e., the earliest sampling time. In this publication, the interval of the sampling dates is predetermined by the user rather than being automatic. The step size is ultimately a result of the sampling date notified via so-called "internal events".
[0020] An object of the present invention is to provide a standard basic method for coupling common simulation tools to form a co-simulation environment with less effort than traditional tools. Summary of the invention
[0021] The objects of the invention are achieved by the independent claims. The dependent claims describe advantageous developments and modifications of the invention.
[0022] More specifically, the invention proposes a method of the type mentioned at the outset, comprising the following additional steps:
[0023] - transferring the co-simulation step length of the enhanced simulation model from the co-simulation host to the corresponding enhanced simulation model via the inter-process communication interface via the functional model unit for model exchange of the enhanced simulation model,
[0024] - The co-simulation host controls the co-simulation step size via the inter-process communication interface, using the DoStep semantic instruction to address the functional model unit for model exchange,
[0025] -The functional model unit for model exchange triggers an event processing call of the enhanced simulation model by notifying the enhanced simulation model of an event initiated by the DoStep semantic instruction received from the inter-process communication interface, so that the co-simulation host controls or synchronizes the enhanced simulation model execution by using the model exchange event.
[0026] Some key aspects of the method are that the master algorithm drives the co-simulation time step by executing DoStep semantic requests to the functional model unit for model exchange, thereby controlling the co-simulation step. In addition, the functional model unit for model exchange implements this semantics by synchronizing the model exchange function execution called by the simulation environment, using model exchange events and the implementation of Set / Get functions. The master algorithm thus indirectly controls the simulation environment because there is no direct DoStep semantic function call on the model exchange interface.
[0027] A preferred embodiment provides that the collaborative simulation host controls the collaborative simulation step size via an inter-process communication interface, and uses the DoStep semantic instruction to address the functional model unit used for model exchange, so that the functional model unit used for model exchange triggers the event processing call of the enhanced simulation model by notifying the enhanced simulation model of the event, and the call is initiated by the DoStep semantic instruction received from the inter-process communication interface.
[0028] In the context of the present invention, DoStep semantics is a method for advancing the simulation time of a model by one time step, which is part of the global simulation time range. DoStep semantics is a standardized way of defining how a simulation model should update its internal state based on the input it receives and the time that has passed. In a co-simulation, DoStep semantics can be used to ensure that all models in the simulation proceed in a coordinated and synchronized manner. Each model must implement a DoStep method that updates its internal state based on the input it receives and the current simulation time and produces output that can be used by other models. DoStep semantics is part of the functional model interface standard.
[0029] The DoStep method typically takes a single argument, which is the time step duration, and returns a status code indicating whether the simulation has completed or needs to continue. The method can also be used to handle errors or exceptions that may occur during the simulation.
[0030] In co-simulation, each FMU (Functional Mockup Unit) is responsible for advancing its own simulation by a certain time step. The main algorithm calls the "doStep" function, which coordinates the exchange of data between the different FMUs. The "doStep" function here takes two arguments: the current simulation time and the time step. The FMU then advances its simulation by the specified time step and retains the new simulation time and output variables.
[0031] Here is an example of how you can use the "doStep" function to advance a simulation in a co-simulation:
[0032]
[0033] In this example, the simulation advances with a time step of 0.1 until it reaches the end time of 10.0. The "doStep" function is called on each FMU with the current time, time step, and the "fmi2True" flag, which means that the previous step will not be re-done and the FMU can treat the previous step result as the final step. The output variables are then exchanged between the FMUs in the main algorithm.
[0034] An interface is a set of rules, protocols, and methods that define how different software components or systems can interact with each other. It is a way for two or more systems to communicate and exchange information without having to know the details of each other's inner workings.
[0035] An API (Application Programming Interface) is a set of protocols, routines, and tools for building software applications. It provides a way for different software applications to communicate and interact with each other. An API defines a set of rules for how different software components should interact, making it easier for developers to build complex applications by providing pre-built functionality that can be easily integrated into their code. APIs can be used to access data, services, and functions from different sources, including web applications, databases, and other software systems.
[0036] In the context of FMI (Functional Mockup Interface), an "event" refers to a trigger or signal that initiates a change in a simulation. Notification of an event can be used to model external stimuli that affect the simulated system, such as changes in boundary conditions or input signals. Events can also be used to model internal changes that occur within the simulated system, such as state transitions or changes in parameter values. In FMI, events are defined as discrete points in time, and their occurrence causes the simulation to transition from one state to another. Events can be triggered by the simulation itself or by an external source. They play an important role in enabling complex simulations of dynamic systems that change over time in response to various inputs and conditions.
[0037] There are two known types of events: internal events and external events.
[0038] 1. Internal events: Internal events are events that occur at a specific point in time in the FMU (Functional Model Unit). Internal events are used to model changes in system states, such as changes in variable values or state transitions. In the FMI (Functional Model Interface), there are time events and step events that are notified to the input simulation environment by the FMU in the form of function call return values. There are also state events that are notified using event indicators. These event indicators can be defined in the model description file of the FMU (Functional Model Unit) and can be accessed by the simulation through the FMI interface. Event indicators are related to changes in continuous expressions that depend on input values and states that change over time, and are defined in a way that allows the input simulation environment to accurately locate the moment they occur.
[0039] 2. External events: External events are events that model external stimuli that affect the simulated system, such as changes in parameters or input signals. This type of event is received by the input simulation environment using a proprietary signaling mechanism and triggers the event handler in the simulation environment, resulting in a dedicated function call on the FMI.
[0040] Both types of events play an important role in achieving complex simulations of dynamic systems. By using events, FMI allows modeling of systems that are subject to external stimuli and internal changes over time, making simulations more accurate and realistic. They both trigger event handlers designed to synchronize states, inputs, outputs, and parameter values between the FMU and the input-based simulation environment.
[0041] According to the present invention, the control of the time step is accomplished by using event notification via the functional model unit for model exchange (FMU-ME), thereby achieving indirect control of the step of the enhanced simulation model. This control of the step of the enhanced simulation model is very effective.
[0042] A preferred embodiment of the present invention provides that the event processing call of the enhanced simulation model includes at least one of the following:
[0043] -Set Function Call (SFC),
[0044] -Get Function Call (GFC).
[0045] The event processing according to the present invention includes exchanging data of various types (real numbers, integers, strings or Boolean values, etc.). By notifying the enhanced simulation model of the event, the Set and Get functions of the enhanced simulation model are called to exchange the input data and output data of the enhanced simulation model within the simulation time of the notified event.
[0046] Furthermore, according to the present invention, a computer system is provided which is intended to execute the method.
[0047] More specifically, the present invention relates to a computer system comprising:
[0048] - at least one processor,
[0049] - at least one memory coupled to at least one processor, the memory storing a set of instructions to be executed by the processor, wherein the set of instructions, when executed by the processor, causes the system to perform the steps according to the invention. The computer system may be a single computer or a computer system consisting of a plurality of computers connected to each other, such as via the World Wide Web or another network configuration. Preferably, the simulation may be distributed in the computer system, such that the computational work is distributed between several computers, processors. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Embodiments of the present invention will now be described, by way of example only, with reference to the accompanying drawings, in which:
[0051] Figure 1 A block diagram showing a conventional interface mechanism.
[0052] Figure 2 Another block diagram showing a traditional interface mechanism.
[0053] Figure 3 A block diagram showing an interface mechanism of a multi-domain modeling and simulation environment according to the present invention.
[0054] The illustrations in the drawings are in schematic form. It should be noted that in different figures, similar or identical elements are provided with the same reference signs. DETAILED DESCRIPTION
[0055] Figure 1 The traditional interface mechanism is shown. The collaborative simulation control process CCP controls several simulation tool processes STP, where Figure 1 Only one exemplary simulation tool process STP is depicted in FIG. The inter-process communication IPC interface connects the main algorithm MAL of the co-simulation control process CCP with the port library PTL. The port library PTL is part of the exemplary simulation tool process STP, which converts input IN messages and output OUT messages respectively to enable communication between the co-simulation control process CCP and the proprietary simulation environment PSE of the corresponding simulation tool process STP. This type of architecture requires the implementation of an I / O port library for each type of simulation environment.
[0056] The simulation tool process STP communicates with the main algorithm MAL of the collaborative simulation control process CCP via the port library PTL. The proprietary simulation environment PSE includes a model MDL and a solver SLV related to the physics to be modeled. The application programming interface API of the proprietary simulation environment PSE communicates with the main algorithm MAL via the port library PTL and the inter-process communication (IPC) interface, in particular for coordination with other simulation tools SMT, such as receiving information about the time advancement or step synchronization of the corresponding submodule simulation.
[0057] Figure 2Another conventional interface mechanism is shown. Here, the main algorithm MAL is part of the main process tool MPT. The main process tool MPT includes a functional model unit FMU (FMU-CS) for co-simulation. The functional model unit FMU-CS for co-simulation can be an exported model or a packaged WRP code for tool coupling, which are respectively provided by the simulation tool SMT, which communicates with the main process tool MPT via the API of the functional model unit for co-simulation (FMU-CS-API). The connected simulation tool SMT works in slave mode, which means that it is requested through the interface to use its local solver SLV to integrate the equations of its model MDL within a given time interval using the given input data valid at the step start time, and feed back the output data valid for the step end time ("DoStep" semantics).
[0058] Figure 3 A block diagram showing an interface mechanism of a multi-domain modeling and simulation environment according to the present invention.
[0059] The collaborative simulation control process CCP controls several simulation tool processes STP. Figure 3 Only one exemplary simulation tool process STP is depicted in FIG. An interface, which may be an inter-process communication IPC interface, connects the co-simulation host CSM of the co-simulation control process CCP to the simulation tool process STP. The interface may be a general interface for data exchange between computing processes. The simulation tool process STP includes a simulation model SMD.
[0060] The co-simulation host CSM controls the co-simulation step size STS of at least one simulation model SMD. The depicted simulation model SMD is an enhanced simulation model ESM, which is a simulation model SMD that includes a functional model unit FMU-ME for model exchange in addition to a proprietary simulation environment PSE of a corresponding simulation tool process STP. The functional model unit FMU-ME for model exchange is based on the functional model interface standard (FMI).
[0061] The collaborative simulation host CSM transmits the collaborative simulation step length STS of the enhanced simulation model ESM via the functional model unit FMU-ME for model exchange of the enhanced simulation model SMD through the inter-process communication interface IPC. The collaborative simulation host CSM controls the collaborative simulation step length STS via the inter-process communication interface IPC and uses the DoStep semantic instruction DSI to address the functional model unit FMU-ME for model exchange.
[0062] The functional model unit FMU-ME for model exchange triggers the event processing call HCL of the enhanced simulation model ESM by notifying the enhanced simulation model ESM of the event EVT initiated by the DoStep semantic instruction DSI received from the inter-process communication interface IPC, so that the co-simulation host CSM controls or synchronizes the execution of the enhanced simulation model ESM by using the model exchange event EVT. The event processing call HCL of the enhanced simulation model ESM includes the Set function call SFC and the Get function call GFC.
[0063] The co-simulation master CSM, which controls the co-simulation step size STS via the inter-process communication interface IPC, uses DoStep semantic instructions DSI to address the functional model unit FMU-ME for model exchange. These instructions can be instructions to set the input SIP, set the step size STS or obtain the output GOP.
[0064] according to Figure 3 , the roles of controller / controlled are basically reversed compared to the FMI standard. This means that the simulation tool importing / exporting the FMU is reversed. In the standard FMU-CS implementation, the PSE has a solver SLV, and the simulation tool simulating the model SMD exports the FMU-CS for the host to import. Therefore, the FMU-CS API is between the co-simulation host and the FMI-CS block.
[0065] according to Figure 3 , the host exports FMU-ME for import by the simulation tool STP that simulates the SMD model, making it an ESM. FMU-ME communicates with the host. Figure 3 As shown, the FMU-ME API is located between the imported FMU-ME and the PSE. From the perspective of the simulation tool STP, this is not a co-simulation, it is a simple simulation because it imports the FMU-ME (instead of the FMU-CS) that does not include a solver (the FMU-CS will include a solver, making the STP a co-simulation host). The present invention enables co-simulation in the presence of several enhanced simulation models ESM, because the host CSM indirectly controls the STP with the enhanced simulation model ESM, and they are triggered in an indirect way via the step size of the event.
[0066] While the present invention has been described in detail with reference to preferred embodiments, it will be understood that the invention is not limited to the disclosed examples and that numerous additional modifications and variations may be made thereto by those skilled in the art without departing from the scope of the invention.
Claims
1. A computer-implemented method for simulating a process by co-simulation by coupling more than one simulation model (SMD), the simulation model treating subsystems as components of the simulation, the method comprising: - Some simulation models (SMD) use the output of other simulation models (SMD) as input, - controlling the co-simulation step size (STS) of the simulation model via a co-simulation master (CSM), - an Enhanced Simulation Model (ESM), which is a Simulation Model (SMD) comprising a Functional Mock-up Unit (FMU-ME) for model exchange based on the Functional Mock-up Interface standard (FMI), Characterized in that the method comprises: - transferring the collaborative simulation step size (STS) of the enhanced simulation model (ESM) from the collaborative simulation master (CSM) to the corresponding enhanced simulation model (ESM) via the functional model unit for model exchange (FMU-ME) of the enhanced simulation model (SMD) via an inter-process communication interface (IPC), -The functional model unit (FMU-ME) for model exchange triggers an event handling call (HCL) of the enhanced simulation model (ESM) by notifying the enhanced simulation model (ESM) of an event (EVT) initiated by an instruction (DSI) received from the inter-process communication interface (IPC), so that the collaborative simulation host (CSM) controls or synchronizes the execution of the enhanced simulation model (ESM) by using the model exchange event (EVT).
2. The method according to claim 1, wherein: The collaborative simulation host (CSM) controls the collaborative simulation step size (STS) via the inter-process communication interface (IPC), and uses the DoStep semantic instruction (DSI) to address the functional model unit (FMU-ME) for model exchange, so that the functional model unit (FMU-ME) for model exchange triggers the event handling call (HCL) of the enhanced simulation model (ESM) by notifying the enhanced simulation model (ESM) of an event (EVT). The event is initiated by the DoStep semantic instruction (DSI) received from the inter-process communication interface (IPC).
3. The method according to claim 1 or 2, wherein: The event processing call of the enhanced simulation model includes at least one of the following: -Set Function Call (SFC), -Get Function Call (GFC).
4. A computer system (CPS), comprising: - at least one processor (CPU), - at least one memory coupled to said at least one processor, said memory storing a set of instructions to be executed by said processor (CPU), Wherein, the set of instructions, when executed by the processor (CPU), causes the system to perform the steps according to any one of the preceding claims 1, 2, and 3.
