Method and device for synchronizing a simulation with a real-time system
11610034 · 2023-03-21
Assignee
Inventors
- Lars Mikelsons (Stadtbergen, DE)
- Michael Baumann (Sindelfingen, DE)
- Oliver Kotte (Stuttgart, DE)
- Peter Baumann (Leinfelden-Echterdingen, DE)
Cpc classification
G06F30/33
PHYSICS
G06F9/52
PHYSICS
B60R16/0231
PERFORMING OPERATIONS; TRANSPORTING
International classification
G06F1/12
PHYSICS
Abstract
A method for synchronizing a simulation of a simulation model on a computer with a real-time system, the simulation and the real-time system each having a computing clock having a matching macro increment. The method includes the following features: awaiting a message from the real-time system, measuring a receiving instant of the message by the simulation, awaiting at least one further message of the real-time system, measuring the receiving instant of the further message by the simulation; calculating an averaged receiving instant based on the receiving instants of the message and the at least one further message; determining a starting instant of the simulation based on the averaged receiving instant such that the results of a macro increment of the real-time system are available to the simulation at the start of a macro increment.
Claims
1. A method for synchronizing a simulation with a real-time system, the method comprising the following steps: awaiting a message from the real-time system; measuring a receiving instant of the message; awaiting at least one further message of the real-time system; measuring a receiving instant of the further message; forming a time difference between the receiving instant of the message and the receiving instant of the further message; ascertaining a deviation of the time difference with respect to a predefined macro increment of the simulation; and based on the deviation, determining a starting instant of the simulation; wherein the method further comprising the following steps: processing a plurality of awaited message including the message and the at least one further message, by measuring a receiving instant of each awaited message and awaiting a further awaited message, for as long as a number of awaited messages processed does not reach a predefined random sampling scope; forming an average value of respective deviations between receiving instants of the processed awaited messages as soon as the number of processing awaited messages corresponds to the predefined random sampling scope; and determining the starting instant based on the average value.
2. The method as recited in claim 1, further comprising the following steps: forming a sum by accumulating the respective deviations; and determining the average value arithmetically by dividing the sum by the predefined random sampling scope.
3. The method as recited in claim 1, wherein the real-time system includes an engine test stand.
4. The method as recited in claim 3, wherein the message and the further message are transmitted via a controller area network (CAN) to the engine test stand.
5. The method as recited in claim 1, wherein the simulation is performed using a single-user computer.
6. The method as recited in claim 1, wherein the simulation is a co-simulation of a plurality of models.
7. A non-transitory machine-readable storage medium on which is stored a computer program for synchronizing a simulation with a real-time system, the computer program, when executed by a computer, causing the computer to perform the following steps: awaiting a message from the real-time system; measuring a receiving instant of the message; awaiting at least one further message of the real-time system; measuring a receiving instant of the further message; forming a time difference between the receiving instant of the message and the receiving instant of the further message; ascertaining a deviation of the time difference with respect to a predefined macro increment of the simulation; and based on the deviation, determining a starting instant of the simulation; wherein the steps further comprise the following steps: processing a plurality of awaited messages including the message and the at least one further message, by measuring a receiving instant of each awaited message and awaiting a further awaited message, for as long as a number of awaited messages processed does not reach a predefined random sampling scope; forming an average value of respective deviations between receiving instants of the processed awaited messages as soon as the number of processing awaited messages corresponds to the predefined random sampling scope; and determining the starting instant based on the average value.
8. A device configured to synchronize a simulation with a real-time system, the device configured to: await a message from the real-time system; measure a receiving instant of the message; await at least one further message of the real-time system; measure a receiving instant of the further message; form a time difference between the receiving instant of the message and the receiving instant of the further message; ascertain a deviation of the time difference with respect to a predefined macro increment of the simulation; and based on the deviation, determine a starting instant of the simulation; wherein the device is further configured to: process a plurality of awaited messages including the message and the at least one further message, by measuring a receiving instant of each awaited message and awaiting a further awaited message, for as long as a number of awaited messages processed does not reach a predefined random sampling scope; form an average value of respective deviations between receiving instants of the processed awaited messages as soon as the number of processing awaited messages corresponds to the predefined random sampling scope; and based on the average value determine the starting instant of the simulation.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
(1) Exemplary embodiments of the present invention are shown in the figures and are described in greater detail below.
(2)
(3)
(4)
(5)
DETAILED DESCRIPTION OF EXAMPLE EMBODIMENTS
(6) A coupling that is described herein by way of example is made up of two mutually independent components. One component (frequently a single-user computer with a suitable operating system) performs an offline simulation. The other component is a real-time system, e.g., an engine test stand. The offline simulation and the real-time system adapt their calculations to different trigger pulses. The computing clock t.sub.r, t.sub.r+1, t.sub.r+2, . . . at which its calculations are running is specified through the start of the real-time system. The clock of the offline simulation t.sub.k, t.sub.k+1, t.sub.k+2, . . . is similarly defined by the start of the offline simulation. The intervals between the respective trigger pulses are specified by a matching macro increment ΔT. The starting points of the computing clocks, on the other hand, are independent of one another because the offline simulation and the real-time system are physically separated from each other. As a result, the computing clocks of the two components are randomly shifted with respect to each other during each simulation run.
(7)
(8)
(9)
(10) The results of simulation runs during which the delay amounts to two increments 2ΔT are considerably poorer than those that are obtained when the delay is shorter. A central aspect of the proposed approach thus is the synchronization of the two computing clocks t.sub.r, t.sub.r+1, t.sub.r+2, . . . and t.sub.k, t.sub.k+1, t.sub.k+2, . . . in order to optimize their position relative to each other and to standardize the delays. This avoids simulation runs during which the processing clocks t.sub.r, t.sub.r+1, t.sub.r+2, . . . and t.sub.k, t.sub.k+1, t.sub.k+2, . . . are positioned unfavorably relative to each other, as illustrated in
(11) Toward this end, according to the method (30) illustrated in
(12) For this purpose, first the arrival of a message from the real-time system (event 31) is awaited. Instant {tilde over (t)}.sub.1 of this event is measured (process 32). Since a single time measurement may be imprecise, which should be taken into account when using a single-user computer for the execution of the method (30), for instance, the measurement (32) is averaged in the next step with the aid of further measurements (33). A further message (event 34) is awaited for this purpose, which should arrive precisely one macro increment ΔT after the previous message. The value of variables t.sub.cal is increased by the deviation between the measured and the expected times (process 33). This process is repeated (decision 35, branch T) until the number n of the processed messages corresponds to the provided random sampling scope nCal (decision 35, branch F). Then, the average deviation t.sub.cal,av of the further time measurements is ascertained (process 36). In the final step (process 37), t.sub.1 is determined by deducting t.sub.cal,av from {tilde over (t)}.sub.1. With knowledge of macro increment ΔT, clock t.sub.1+kΔT at which messages are arriving from the real-time system is thus determined.
(13) This method (30) may be implemented in software or hardware, for example, or in a mixed form of software and hardware such as in a single user computer (40) as illustrated by the schematic representation of