Computer-implemented method for co-simulation
The method addresses loose coupling issues in co-simulation by timestamping messages and using FIFO buffers to ensure temporal consistency and reduce overhead, enhancing performance and scalability in complex systems.
Patent Information
- Application Number
- PCT/EP2025/059290
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-04-04
- Filing Date
- 2025-04-04
- Publication Date
- 2025-10-09
AI Technical Summary
Conventional co-simulation methods face challenges with loose coupling, leading to non-deterministic timing inconsistencies, message loss, and inefficiencies due to differing simulator clocks and dynamic communication structures, especially in complex and interconnected systems.
A method for co-simulation using a communication channel with a FIFO buffer, where messages are timestamped and processed based on their creation time, allowing asynchronous operation and flexible data exchange, with timestamp-based mechanisms to maintain temporal consistency and reduce communication overhead.
Ensures robust, scalable, and temporally consistent message handling in distributed co-simulation environments, reducing idle time and communication load while maintaining data integrity and synchronization across simulators with different clock rates.
Smart Images

Figure EP2025059290_09102025_PF_FP_ABST
Abstract
Description
[0001] Computer-implemented method for co-simulation
[0002] The invention relates to a computer-implemented method for co-simulation using a first simulator and a second simulator, wherein a communication channel is set up between the two simulators, via which communication channel messages can be transmitted from the first simulator to the second simulator by the first simulator transmitting a respective message to the communication channel.
[0003] dSPACE offers Scalexio, a system for conducting real-time simulations and implementing hardware-in-the-loop (HIL) test environments, specifically designed for the development and validation of ECUs and systems in the automotive industry. Simulation is an indispensable tool in modern product development, especially in areas with high safety and reliability requirements. Real-time simulations and hardware-in-the-loop tests offer the ability to test the behavior of ECUs and systems under realistic conditions without the need for physical prototypes or real-world operating conditions. This reduces development times and costs while increasing product quality and safety.
[0004] However, traditional simulation and test environments reach their limits when it comes to complex systems and highly dynamic applications. The demands for flexibility, scalability, and performance are continuously increasing. Therefore, there is an urgent need for more advanced solutions capable of efficiently simulating and testing these increasingly complex and interconnected systems. These challenges are addressed by providing an advanced real-time simulation and HIL test system known as Scalexio. Scalexio is a modular, scalable system developed by dSPACE to meet the demanding requirements of modern development and test environments. It provides a flexible platform for simulating and testing ECUs and systems across a wide range of applications and industries.Core features include support for complex modeling, real-time simulations, comprehensive I / O configurations, and user-friendly interfaces for system configuration and monitoring. Thanks to its modular architecture, Scalexio can be easily adapted to specific requirements and scaled for various simulation scenarios, making it a versatile tool in the development and test landscape.
[0005] In addition, dSPACE provides the VEOS platform, a comprehensive virtual validation platform specifically designed to support software-in-the-loop (SIL) simulations. These features enable developers and engineers to develop and test ECU software and complex system models in a fully virtual environment. In the context of SIL simulations, VEOS offers several key features and benefits.
[0006] VEOS enables the creation of virtual ECUs to simulate ECU software independently of physical hardware. This is particularly useful in the early stages of development when the actual hardware may not yet be available. The platform supports the integration of models created in various modeling languages and tools, such as MATLAB / Simulink, to enable comprehensive system simulation. This enables the seamless simulation of the interaction between ECU software and the system model being controlled. VEOS provides interfaces to test automation tools, enabling the efficient execution and management of large volumes of test cases. This helps improve software quality and reduce development time.Comprehensive diagnostic and visualization tools for VEOS facilitate the identification and analysis of problems in the simulated ECU software and system model.
[0007] VEOS also enables the definition and execution of scenarios that replicate real-world operating conditions. This helps developers understand how the software will behave under different conditions. By supporting simulations spanning multiple disciplines (e.g., mechanical, electrical, hydraulic), VEOS provides a holistic view of system behavior and promotes interdisciplinary collaboration. VEOS's modular architecture makes it easy to adapt the platform to specific project requirements and allows it to scale with the complexity of the systems being developed. VEOS supports industry standards and interfaces, facilitating integration into existing development processes and enabling the reuse of models and test cases.Through these features, VEOS enables effective and efficient execution of SIL simulations, making it a universal tool in modern system and software development, especially in the automotive industry.
[0008] In co-simulation, HIL and SIL systems are integrated so that they can run simultaneously and synchronously. This means that parts of the system are simulated in real time on physical hardware (HIL) and other parts are simulated in parallel in a virtual environment (SIL). This integration enables comprehensive system testing, where both the interaction between the software and the real hardware and the interplay of different system components can be evaluated.
[0009] The usual approach to co-simulations and the common understanding of co-simulations in the prior art is for one component or subsystem to take over the timing of the entire simulation system, so it is usually referred to as the simulation master. The present invention does not address this type of co-simulation (also called strong coupling); rather, it focuses on a simulation system consisting of two subsystems that are standalone simulators (e.g., VEOS and SCALEXIO, as discussed above). Instead of incorporating an external simulation master or promoting one of the simulators as a timing controller, it allows both simulators to maintain their timing behavior and simply exchange data whenever it is available. This co-simulation approach is also referred to as loose coupling.
[0010] This approach has the advantage of increasing simulation performance by reducing idle time for both simulator components and mitigating the risk of task overruns in the real-time simulator (HIL). However, it has the disadvantage that the overall system is non-deterministic, and timing inconsistencies can arise in communication. These inconsistencies can include drift between simulator clocks, message loss, message reception delay, or bus timing jitter, to name a few examples.
[0011] Because of these disadvantages, this loose coupling approach is not often considered for co-simulation in modern products and technologies; strong coupling approaches are often preferred instead. However, strong coupling may be unsuitable for many simulation systems, especially for real-world examples that are computationally intensive.
[0012] Loose coupling results in only a small delay in message communication in the SIL system during a SIL simulation step that takes longer than the real-time HIL system, and does not result in a loss of the HIL simulator's real-time capability. Loose coupling can also incorporate some form of buffering to provide greater data consistency. When exchanging bus simulation data, it is also common practice to only exchange bus messages when they are available.
[0013] However, with a loose-coupling approach, problems can arise when coupling the HIL simulator with the SIL simulator. As previously described, it is possible for the SIL simulator to temporarily run out of sync with the HIL simulation because some simulation steps in the SIL system take longer than the clock duration determined by the co-simulation clock, and subsequent steps are executed in rapid succession to compensate for this delay. This situation can lead to some unintended consequences in bus timing behavior. In particular, larger delays on the SIL simulator can result in significant queues and, if these queues become too large, data loss.
[0014] In distributed simulation systems, such as those realized by combining the VEOS (for SIL simulations) and SCALEXIO (for HIL simulations) platforms, the challenge is that different simulators can operate with differing simulation parameters. In particular, differences can occur in the so-called base step time of the participating simulators. This means that the individual simulators simulate with different temporal resolutions and step sizes, which can lead to inconsistencies and problems with synchronization and data exchange.
[0015] In addition, the individual simulators often only require subsets of the simulation data generated or processed in the overall system. The concept of a centralized, time-locked buffer system in which all system data is globally stored and distributed at fixed points in time (e.g., in the form of cyclic collection buffers or global data queues) proves to be inefficient and poorly scalable in such cases. This is especially true when the communication structure changes dynamically at runtime—for example, through the addition or removal of communication channels or through the targeted request of additional data by individual simulators, as is typically the case with publish / subscribe-based architectures.
[0016] If a rigidly cyclic communication scheme is used here, in which each channel exchanges a message in each simulation step, regardless of the actual data volume and the specific communication needs, this leads to considerable overhead. This initiates an unnecessary number of communication processes, which can lead to a significant load on system resources and increased latency, especially with a large number of simulators and channels. This can negatively impact the overall efficiency of the co-simulation and, in real-time environments, can even lead to task overruns or data loss.
[0017] The requirements outlined make it clear that conventional communication approaches with fixed clock rates and central buffer systems are not suitable for addressing the complexity and dynamics of modern co-simulation scenarios. Instead, a communication structure is needed that enables both loose coupling between the simulators and supports flexible handling of simulation data.From DE 10 2017 214 125 A1 a method for synchronizing a simulation with a real-time system is known, which method comprises the following steps: a message from the real-time system is waited for, a reception time of the message is measured, at least one further message from the real-time system is waited for, the reception time of the further message is measured, a time difference between the reception times is formed, a deviation of the time difference from a predetermined macro step size of the simulation is determined and a start time of the simulation is determined based on the deviation.
[0018] WO 2019 / 219796 A1 describes a method for event-based simulation of a system, wherein the simulation is executed on a computer system comprising a first computing unit and at least one second computing unit, wherein the first computing unit has a simulation time, wherein the second computing unit has an operating system layer and an application layer, wherein the second computing unit has a system time in the operating system layer, wherein at least the second computing unit executes a simulator application, wherein at least one simulation object is executed on the simulator application, and wherein the first computing unit manages an event queue, wherein at least one event per simulation step is listed in the event queue, and the event is assigned a process to be executed by the simulation object and a simulation time provided for the execution of the process.The second computing unit has a virtual clock, the method comprising the following steps for each simulation step: transmitting, by the first computing unit, a start signal to the virtual clock to execute a next simulation step in the second computing unit, and based on a time difference between a past simulation step and the simulation time, incrementing the system time of the second computing unit, and executing the pending process at the simulation time associated with the process. The object of the invention is to provide a solution that allows data exchange to be kept to a minimum while maintaining data integrity in the simulators.
[0019] This problem is solved by the subject matter of patent claim 1. Preferred developments can be found in the subclaims.
[0020] According to the invention, a computer-implemented method for co-simulation using a first simulator and a second simulator is thus provided, wherein a communication channel is set up between the two simulators, via which communication channel messages can be transmitted from the first simulator to the second simulator, in that the first simulator transfers a respective message to the communication channel, the communication channel comprises a FIFO buffer, the first simulator works with a first simulator time and the second simulator with a second simulator time, and the messages each comprise a date and a time stamp t which indicates the first simulator time at the time the message is created in the first simulator and / or the first simulator time at the time the message is transferred to the communication channel.
[0021] The method according to the invention comprises the following process steps:
[0022] 51) periodically checking whether messages have been received from the first simulator in the communication channel, wherein the periodic checking is carried out with a period of s at query times t s , t s + öt s , t s + 2 öt s , t s + 3 öt s , ... in the second simulator time,
[0023] 52) Receiving the messages of the first simulator available in the communication channel at the respective query time and processing the messages received at the respective query time in the following steps S3 to S6 in the order of the respective time stamp t of the respective messages until all received messages have been processed, and then switching to step S7a or S7b,
[0024] 53) if a received message is the first message received via the communication channel, setting a playback time T pof the second simulator and an estimated current first simulator time T p o of the other simulator to the timestamp t of the first message received via the communication channel, i.e. T p := t and T p o := t, and storing the message in the FIFO buffer,
[0025] 54) if a received message is not the first message received via the communication channel and for the received message t > T p , storing the message in the FIFO buffer,
[0026] 55) if a received message is not the first message received via the communication channel, for the received message t > T does not apply p , and with regard to the estimated current first simulator time T p o and the timestamp T, T p o - 1 < T a , where ais a predetermined first limit value, storing the message in the FIFO buffer and setting the playback time T p to the timestamp t of the received message, i.e. T p := t,
[0027] 56) if a received message is not the first message received via the communication channel, for the received message t > T does not apply p , and for the estimated current first simulator time T p o not valid T p o - t < x a , Discard the message,
[0028] S7a) if T does not apply p o - T p > Tb, where Tb is a predetermined second limit, increasing the playback time T p and the estimated current first simulator time T p o by one period 8t s , i.e. T p := T p + 8t s and T p o := T p o + 8t s ,
[0029] S7b) if T p o - Tp > Tb, increase playback time T p by a multiple n of the period 8t s and increasing the estimated current first simulator time T p o by one period 8t s , i.e. T p := T p + n 8t s and T p o := T p o + 8t s , where n > 1,
[0030] 58) Capture the first message to be output in the FIFO buffer,
[0031] 59) if for this message with regard to the timestamp t and the estimated current first simulator time T p o t > T p o, Setting the estimated current first simulator time T p o to the timestamp t of the message, i.e. T p o := t,
[0032] S 10a) if for this message with regard to the time stamp t and the playback time T p t < T p, Outputting the message to the second simulator, deleting the message in the FIFO buffer and repeating step S8, S 10b) if for this message with regard to the time stamp t and the playback time T p not true t < T p , no further capture of message in the FIFO buffer.
[0033] The method according to the invention can thus be divided into three sections:
[0034] 1. In step S1, a periodic check is performed. If it is determined in step S1 that messages are available in the communication channel, they are received in step S2. Steps S1 and S2 occur essentially in parallel and independently of the steps described below. Steps S1 and S2 essentially provide the messages that are processed in the subsequent steps.
[0035] 2. The messages received at the respective query time are then processed in the following steps S3 to S6 until all recently received messages have been processed. Then, a transition occurs to step S7a or S7b.
[0036] 3. In the steps starting with S7a or S7b to S10b, the messages stored in the FIPO buffer are then processed in order to selectively output them to the second simulator.
[0037] The consideration of two simulators is exemplary. The invention can, in principle, be extended to any number of simulators in a co-simulation that exchange data with each other via respective communication channels. Multiple communication channels operating according to the inventive method can exist between the first simulator and the time simulator.
[0038] It is also possible to have receiving or sending simulators that use the same communication channel. In this case, the exchanged messages should also contain a simulator ID. Furthermore, individual values for T should be defined for each participating simulator. p , T p o and a separate FIFO buffer. The other process steps described above and below should then be carried out in the same way as described above, but individually for each simulator ID.
[0039] If the timestamp t indicates the first simulator time at the time the message is created in the first simulator and / or the first simulator time at the time the message is transferred to the communication channel, the timestamp does not have to directly indicate the respective first simulator time. Rather, the timestamp can also be a function of this first simulator time. The timestamp t indicates both the first simulator time at the time the message is created in the first simulator and the first simulator time at the time the message is transferred to the communication channel, if the message is also transferred to the communication channel directly upon its creation.
[0040] The invention thus relates to a method for improved buffering and timing of messages in a distributed co-simulation environment, particularly in a combination of hardware-in-the-loop (HIL) and software-in-the-loop (SIL) simulations, which does not require cyclic, globally synchronized communication between the participating simulators. Rather, the method is based on a so-called loose-coupling approach, in which the simulators typically operate with different base clock times, work asynchronously, and exchange data only when it is actually present. This places special demands on the buffering and timing behavior of the communication interfaces.
[0041] Previously, for example, time-clocked buffer systems were used, in which the fill level of a message queue was used to determine the correct output point. However, such concepts are no longer practical in the context of modern service-based architectures—especially in dynamic publish / subscribe systems. There, communication channels can change at runtime, and not all simulation partners require the same amount of data at the same time. Eliminating cyclic message transmission reduces communication overhead but requires new mechanisms to maintain temporal consistency between simulators.
[0042] The inventive method replaces the previously used derivation of the output time from the fill level of the message buffers with a timestamp-based mechanism. In this process, the simulation timestamp of the sending simulator is assigned to each received message. This timestamp is used in the receiving system to reconstruct two parameters: a playback time T p at which the received message should be output, as well as an estimated current simulation time T p o of the sending simulator. These two time variables are continuously updated and correlated to determine, via a flexible set of rules—depending on freely selectable tolerance values—whether messages should be saved, further processed, or discarded.
[0043] This logic allows the method to functionally replicate the original message buffering from synchronous co-simulations without having to rely on cyclic messages or global synchronization mechanisms. At the same time, the architecture allows individual communication channels to operate independently of each other, which offers decisive advantages, especially in service-oriented, distributed simulation environments with heterogeneous requirements and load profiles. The invention thus creates the basis for high-performance, scalable, and robust message buffering and replay in co-simulation systems.
[0044] Although the method according to the invention can operate with service-based communication structures, it is not limited to this application. Rather, the proposed method is generally applicable and can also be used in other communication scenarios in which different simulators interact with each other – regardless of the underlying communication architecture. Even in the case of a service-based implementation, the invention does not specify a specific communication layer or protocol. Rather, the method is designed to be protocol-independent and allows the use of any transmission technology, such as Ethernet at the physical level or protocols such as DDS (Data Distribution Service) at the application level.
[0045] In the context of the invention, the term "service-based communication" refers to a communication architecture in which the exchange of data between simulators takes place via a service-oriented model. Instead of continuous and cyclical data transmission between permanently connected communication partners, the communication is based on a flexible and dynamically adaptable structure of services that can provide and retrieve data. This enables decoupled interaction between the simulators, meaning they do not have to be directly connected to one another. Instead, they can publish, subscribe, or poll information as needed, thereby creating greater flexibility in data exchange. Connections between the simulators can be established at any time during the simulation, and communication channels can be set up or closed at runtime.can be resolved.
[0046] The focus of the invention is not the specific design of the communication infrastructure, but rather the reception method, which ensures the correct temporal classification of the received messages in the local time system of the receiving simulator. The goal is to enable consistent, chronologically accurate message playback, particularly in distributed co-simulation scenarios with a mix of real-time and non-real-time simulators.
[0047] Against this background, the term "communication channel" is defined functionally and abstractly within the scope of the invention: A communication channel is a chronologically ordered group of messages exchanged between two or more simulators. Each message within such a channel carries a timestamp that represents the current simulation time of the sending simulator. The precise content-related or structural grouping of the communication channels is not the subject of the invention. A communication channel can, for example, represent a single signal, a protocol data unit (PDU), a complete bus channel, or the entire bus or I / O communication between two simulators. This flexibility enables broad applicability of the inventive method in a wide variety of system configurations and simulation architectures.
[0048] The method according to the invention provides a separate transmit / receive interface for each open communication channel between the participating simulators. Each of these interfaces comprises a main communication function that is triggered at fixed time intervals, with these cycles being measured in the local simulation time of the respective simulator. The communication function is thus called periodically with a constant simulation time period and operates at the current local simulation time.
[0049] Within each send / receive interface, several internal data structures are available that are relevant for message handling and scheduling. These include a FIFO (First-In-First-Out) buffer, which stores the messages to be transmitted via the respective channel. This structure ensures that messages are processed and sent in the order in which they arrive.
[0050] In addition, each interface manages the playback time T p , which indicates the simulation time at which received messages are scheduled to be output to the second simulator. This playback time is dynamically adjusted to maintain the temporal integrity of the simulated communication processes. In addition, an estimated current simulation time T po of the first simulator. This value is used to classify received messages in the context of the communication partner and is particularly important for assessing the validity and relevance of a message within the buffer mechanism. This structure enables precise and decoupled control of message transfer, with each interface being able to operate independently. This supports the scalability and modularity of the method, particularly in distributed co-simulation environments with asynchronously operating components. The use of the method according to the invention with the associated buffer mechanism is advantageous not only in a hardware-in-the-loop (HIL) simulator for recording data from a software-in-the-loop (SIL) simulator, but also on the part of a SIL simulator.It is true that, due to drift and jitter between the simulation time of the SIL simulator and the real-time clock of the HIL system, a buffer is required to inject messages with correctly coordinated timing. However, the converse also applies: From the SIL simulator's perspective, the real-time of the HIL system is also subject to drift relative to its own simulation time, since all components in the SIL system are executed exclusively based on the local simulation time. It follows that buffering is generally always advantageous when two simulators communicate with each other and rely on independent, locally managed time systems that are not fully synchronized. This applies regardless of which of the two time systems is considered "real" or "real-time."The proposed method therefore represents a universal solution for temporally consistent communication between simulators with differing clocks and allows a robust decoupling of the systems while maintaining the temporal correctness of the transmitted messages.
[0051] The above-mentioned aspects are taken into account by the further developments of the invention described below.
[0052] According to a further development of the invention, the playback time T is increased p by a multiple n of the period öt s only if - measured in the second simulator time - the time difference between the time of the upcoming increase of the playback time T p by a multiple n of the period öt s and the time of the last increase in playback time T p by a multiple n of the period öt sis greater than a predetermined time difference. According to a further development of the invention, n < 3, preferably n = 2.
[0053] According to a further development of the invention, the messages received in step S2 at the respective query time are processed in the following steps in the order in which they are present in the communication channel, provided that their respective time stamps t are the same.
[0054] According to a further development of the invention, Tb is a dynamic value that changes over the course of the method. This value can depend on a parameter of the co-simulation, e.g., a statistical value that is determined by (T p o - T p ), such as a mean of it or the standard deviation.
[0055] According to a further development of the invention, service-based communication uses middleware that manages the communication channel, synchronizes messages, and provides the relevant data for the individual simulators. This avoids the need for all participants to exchange all data in each simulation step, thus reducing the communication load. The middleware can be, for example, a Data Distribution Service (DDS). The invention thus enables the use of service-based middleware, but also functions without such a middleware, offering similar properties with regard to the amount of data that can be transferred.
[0056] According to a further development of the invention, one of the simulators operates in real time and the other simulator operates in a simulator time different from real time.
[0057] The invention also relates to a computer system comprising a processor configured to carry out the steps of a method described above during its operation.
[0058] The invention also relates to a computer program comprising instructions which, when executed by a computer system, cause the computer system to carry out the steps of a method described above.
[0059] The invention also relates to a computer-readable storage medium on which this computer program is located. The drawing shows
[0060] Fig. 1 is a schematic flow diagram of a method according to a preferred embodiment and
[0061] Fig. 2 shows a more complex flow diagram of this procedure with its conditions and branches.
[0062] The method shown in Fig. 1 is designed as a computer-implemented method for performing a co-simulation using a first simulator (e.g., SIL system) and a second simulator (e.g., HIL system), between which a communication channel is established. Messages can be transmitted from the first simulator to the second simulator via this communication channel. The communication channel comprises a FIFO buffer for temporarily storing received messages. The first simulator operates with a first simulator time (e.g., a simulation time), while the second simulator operates with a second simulator time (e.g., real-time or also simulation time). In addition to the data content, each transmitted message also contains a timestamp t, which represents the first simulator time at the time the message is created in the first simulator and / or at the time of transfer to the communication channel.
[0063] The procedure follows a cyclic execution loop that is periodically executed with a fixed time period. ts is run through, with timing occurring according to the second simulator time. The central control of the reception and processing of the messages takes place in this loop, with the method comprising the following steps:
[0064] Step S1: Periodically check for new messages
[0065] At fixed query times t s , t s + öt s , t s + 2 öt s , t s + 3 öt s , ... etc., it checks whether new messages have arrived in the communication channel from the first simulator. This cyclic polling ensures that the process can continuously respond to new incoming data without cyclically generating outgoing messages, which significantly reduces the communication load, especially in loose-coupling architectures.
[0066] Step S2: Reception and temporal sorting
[0067] All messages available in the communication channel at a given query time are received. The received messages are then processed for further processing, sorted according to their respective timestamps. If multiple messages have the same timestamp, their order is taken into account according to their entry into the channel. This enables deterministic processing while maintaining temporal order.
[0068] Step S3: Initialization at first message
[0069] If the received message is the first message received via this communication channel, two central time variables are initialized: the playback time T p and the estimated current time T p0of the first simulator. Both values are set to the timestamp t of the received message. The message is stored in the FIFO buffer. This initialization ensures that the playback system has a temporally consistent reference level from the start.
[0070] Step S4: Messages with timestamp t > T p
[0071] If the timestamp t of the received message is greater than the current playback time T p , the message is stored in the FIFO buffer. These messages are intended for playback in a future clock cycle.
[0072] Step S5: Messages with t < Tp and small time offset
[0073] If the timestamp t is less than or equal to T p , but within a given tolerance window (T P o - 1 < T a ), the message is also saved. In addition, the playback time T pset to the message's timestamp t. This step allows slightly delayed messages to be considered, thereby increasing robustness against slight communication delays. Step S6: Discarding outdated messages
[0074] If the timestamp t of the message is less than or equal to T p , and if the difference to the estimated current time Tp0 is too large (T p0 - 1 > Ta), the message is considered stale and discarded. This prevents outdated or inconsistent data from being fed into the simulation system.
[0075] Step S7a: Regular progression of playback time
[0076] If the time difference between T p0 and T p is not greater than a second threshold Tb, the playback time Tp and the estimated time T p0 each by one period öt sThis step is the norm and ensures a continuous progression of playback time with nearly synchronous communication.
[0077] Step S7b: Accelerated progress in case of large backlog
[0078] If the time difference T p0 - T p but is greater than Tb, the playback time T p by a multiple n of öt s forward (T p := T p + need s ) to catch up. At the same time, T P o just to öt s increased. However, to avoid excessive acceleration, this "beat skip" mechanism is only triggered when - measured in the second simulator time - a predetermined minimum time has passed since the last such jump. This stabilizes the process and prevents excessive advance of T p, which could otherwise lead to message loss. A value of n = 2 has proven particularly suitable in practice.
[0079] Step S8: Selecting the next message to output
[0080] The first message in the FIFO buffer that is waiting to be output is identified.
[0081] Step S9: Synchronization of the estimated time T p0
[0082] If the timestamp t of the selected message is greater than Tp0, T p0 set to t. This correction ensures a dynamic adjustment of the partner simulator's estimated time to the messages actually received.
[0083] Step S10a: Message ready for output If the timestamp t of the message is less than the current playback time T p, the message is output to the second simulator, removed from the FIFO buffer, and the flow returns to step S8 to process the next message.
[0084] Step S10b: End
[0085] If the condition t < T p is not met, no further message is recorded in the FIFO buffer.
[0086] The presented method ensures that received messages are processed in a manner that guarantees both the temporal integrity of the co-simulation and robustness against communication latency and jitter. The use of T p and T Po as central time variables allows messages to be correctly classified even without external synchronization. The combination of dynamically regulated playback time, selective buffering, and an adaptive beat-skip mechanism creates a flexible framework for handling asynchronous communication in distributed simulation systems. This minimizes the communication load while enabling consistent data playback with high temporal precision.
[0087] This is shown again in detail in Fig. 2, from which all conditions and branches of the method according to the embodiment of the invention described here can be seen.
Claims
Patent claims 1. A computer-implemented method for co-simulation using a first simulator and a second simulator, wherein a communication channel is established between the two simulators, via which messages can be transmitted from the first simulator to the second simulator, in which the first simulator transfers a respective message to the communication channel, the communication channel comprises a FIFO buffer, the first simulator operates with a first simulator time and the second simulator operates with a second simulator time, and the messages each comprise a date and a time stamp t that indicates the first simulator time at the time the message is created in the first simulator and / or the first simulator time at the time the message is transferred to the communication channel, comprising the following method steps: 51) periodically checking whether messages have been received from the first simulator in the communication channel, wherein the periodic checking is carried out with a period of s at query times t s , t s + öt s , t s + 2 öt s , t s + 3 öt s , ... in the second simulator time, 52) Receiving the messages of the first simulator available in the communication channel at the respective query time and processing the messages received at the respective query time in the following steps S3 to S6 in the order of the respective time stamp t of the respective messages until all received messages have been processed, and then switching to step S7a or S7b, 53) if a received message is the first message received via the communication channel, setting a playback time T pof the second simulator and an estimated current first simulator time T p o of the other simulator to the timestamp t of the first message received via the communication channel, i.e. T p := t and T p o := t, and storing the message in the FIFO buffer, 54) if a received message is not the first message received via the communication channel and for the received message t > T p , storing the message in the FIFO buffer, 55) if a received message is not the first message received via the communication channel, for the received message t > T does not apply p , and with regard to the estimated current first simulator time T p o and the timestamp T, T p o - 1 < T a , where a is a predetermined first limit value, storing the message in the FIFO buffer and setting the playback time T pto the timestamp t of the received message, i.e. T p := t, 56) if a received message is not the first message received via the communication channel, for the received message t > T does not apply p , and for the estimated current first simulator time T p o not valid T p o - t < x a , Discard the message, S7a) if T does not apply p o - T p > Tb, where Tb is a predetermined second limit, increasing the playback time T p and the estimated current first simulator time T p o by one period 8t s , i.e. T p := T p + 8t s and T p o := T p o + 8t s , S7b) if T p o - T p > Tb, increase playback time T p by a multiple n of the period 8t s and increasing the estimated current first simulator time Tp o by one period 8t s , i.e. T p := T p + n 8t s and T p o := T p o + 8t s , where n > 1, 58) Capture the first message to be output in the FIFO buffer, 59) if for this message with regard to the timestamp t and the estimated current first simulator time T p o t > T p o, Setting the estimated current first simulator time T p o to the timestamp t of the message, i.e. T p o := t, S 10a) if for this message with regard to the time stamp t and the playback time T p t < T p , Outputting the message to the second simulator, deleting the message in the FIFO buffer and repeating step S8, S 10b) if for this message with regard to the timestamp t and the playback time T p not true t < T p, no further capture of message in the FIFO buffer.
2. Computer-implemented method according to claim 1, wherein in step S7b an increase of the playback time T p by a multiple n of the period öt s only occurs if - measured in the second simulator time - the time difference between the time t s of the upcoming increase in playback time T p by a multiple n of the period öt s and time t s last of the last increase of the playback time T p by a multiple n of the period öt s greater than a predetermined time difference.
3. Computer-implemented method according to claim 1 or 2, wherein n < 3.
4. A computer-implemented method according to any one of the preceding claims, wherein Tb is a dynamic value that is changed over the course of the method.
5. Computer-implemented method according to one of the preceding claims, wherein the messages received in step S2 at the respective query time are processed in the following steps in the order in which they are present in the communication channel, provided that their respective time stamps t are the same.
6. Computer-implemented method according to one of the preceding claims, wherein the co-simulation is carried out via service-based communication.
7. A computer-implemented method according to claim 6, wherein the service-based communication uses a middleware that manages the communication channel, synchronizes the messages, and provides the relevant data for the individual simulators.
8. A computer-implemented method according to any one of the preceding claims, wherein one of the simulators operates in real time and the other simulator operates in a simulator time different from real time.
9. A computer system comprising a processor configured to perform, in its operation, the steps of the method according to any one of claims 1 to 8.
10. A computer program comprising instructions which, when executed by a computer system, cause the computer system to carry out the steps of the method according to any one of claims 1 to 8.
11. A computer-readable storage medium on which the computer program according to claim 10 is stored.
Citation Information
Patent Citations
Method and device for synchronizing a simulation with a real-time system
DE102017214125A1
Method for event-based simulation of a system
WO2019219796A1
Method for providing a real-time-capable simulation for control unit development, and simulation device for control unit development
US20190073437A1