CN114297833A - Time synchronization method for distributed simulation - Google Patents
Time synchronization method for distributed simulation Download PDFInfo
- Publication number
- CN114297833A CN114297833A CN202111533939.0A CN202111533939A CN114297833A CN 114297833 A CN114297833 A CN 114297833A CN 202111533939 A CN202111533939 A CN 202111533939A CN 114297833 A CN114297833 A CN 114297833A
- Authority
- CN
- China
- Prior art keywords
- simulation
- time synchronization
- time
- distributed
- pulse
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Synchronisation In Digital Transmission Systems (AREA)
Abstract
The invention provides a time synchronization method facing distributed simulation, which divides simulation nodes of a distributed simulation system into time synchronization control nodes and response nodes from the design angle of time synchronization, wherein the control nodes are responsible for completing the generation and distribution of time synchronization pulses, and the response nodes are responsible for receiving the time synchronization pulses of the control nodes; all distributed simulation nodes uniformly advance simulation time based on the time synchronization pulse, and time synchronization is carried out on the clock of the virtual clock source, namely the simulation time, so that the data timestamps of all simulation entities are kept consistent in the simulation time. The invention solves the technical problem of the simulation time sequence and logic consistency of the distributed computer, meets the time synchronization requirement of multi-node distributed long-time simulation under a non-real-time operating system, and simultaneously realizes the super-real-time accelerated simulation under a distributed architecture.
Description
Technical Field
The invention relates to the technical field of distributed computer simulation, in particular to a time synchronization method for distributed simulation.
Background
In distributed simulation, each simulation node resides in different computer systems, and each simulation node forms a closed virtual world through network communication. The correct timing and logical relationships are key to ensuring the correctness and credibility of the distributed simulation. Distributed simulation has a very high requirement on time synchronization, and at present, high-precision timing based on a real-time operating system can solve short-time and data synchronization, but clock drift can reduce the synchronization precision along with time, so that the method cannot be applied to a non-real-time operating system and long-time simulation operation. The method for unifying clock sources based on the Ethernet solves the problem of clock drift, realizes the clock source synchronization of each distributed simulation node, but the network transmission in the mode has the defects of message delay and frame loss, and the simulation acceleration function is difficult to realize due to the limitation of a hardware clock source.
Disclosure of Invention
The purpose of the invention is as follows: a time synchronization method oriented to distributed simulation is provided. The invention solves the technical problem of the simulation time sequence and logic consistency of the distributed computer, meets the time synchronization requirement of multi-node distributed long-time simulation under a non-real-time operating system, and simultaneously realizes the super-real-time accelerated simulation under a distributed architecture.
The technical scheme of the invention is as follows: a time synchronization method facing to distributed simulation divides simulation nodes of a distributed simulation system into time synchronization control nodes and response nodes from the design angle of time synchronization, the control nodes are responsible for completing the generation and distribution of time synchronization pulses, and the response nodes are responsible for receiving the time synchronization pulses of the control nodes; all distributed simulation nodes uniformly advance simulation time based on the time synchronization pulse, and time synchronization is carried out on the clock of the virtual clock source, namely the simulation time, so that the data timestamps of all simulation entities are kept consistent in the simulation time.
In the foregoing time synchronization method for distributed simulation, the time synchronization pulse generated by the control node is a counter, and the mathematical expressions of the time synchronization pulse count value and the simulation step length are as follows:
dt(k)=(Tm(k)-Tm(k-1))·ΩT·S,k≥1 (1)
wherein dt (k) represents the simulation step size of the current frame k, Tm (k) represents the current frame synchronization pulse count value, Tm (k-1) represents the previous frame time synchronization pulse count value, and ΩTIndicating the pulse time interval and S the simulated double speed.
In the foregoing time synchronization method for distributed simulation, both the pulse time interval between two adjacent time synchronization pulses and the simulation speed can be configured and dynamically adjusted.
In the foregoing time synchronization method for distributed simulation, according to a calculation result of a simulation step, a simulation time is obtained by continuous integral calculation, and a mathematical expression of the simulation time after synchronization of the simulation system is as follows:
where t (k) represents the current cumulative simulation time.
In the foregoing time synchronization method for distributed simulation, if the value obtained by subtracting the previous frame time synchronization pulse value from the current frame time synchronization pulse value is greater than 1, a frame loss occurs in the time synchronization pulse received by the time synchronization response node, and the calculated simulation step size value is greater than the expected simulation step size.
In the foregoing time synchronization method for distributed simulation, when a frame loss occurs, pulse interpolation compensation is adopted: and uniformly sampling the simulation step length which is larger than the expected simulation step length, and using the sampled simulation step length as the input of the simulation model.
The time synchronization method for distributed simulation comprises the following steps:
s1, node role classification: in the distributed simulation system, one distributed simulation node is selected as a time synchronization control node, and other distributed simulation nodes are time synchronization response nodes;
s2, time synchronization pulse generation: the time synchronization control node computer generates time synchronization pulses, and the initial time synchronization pulse count value is zero and represents the starting point of the distributed simulation; in a control node computer periodic task thread, updating a time synchronization pulse count value, and sending a time synchronization pulse to a simulation system through an Ethernet period;
s3, time synchronization pulse receiving processing: each distributed node receives the time synchronization pulse of the time synchronization control node through the Ethernet as the current time synchronization pulse;
s4, simulation step length calculation: setting pulse time interval and simulation speed multiplication, and calculating to obtain the simulation step length of the current frame simulation node time advance;
s5, pulse interpolation compensation: if the simulation step length obtained by calculation is larger than the maximum simulation step length of the simulation entity model, adopting pulse interpolation compensation to carry out uniform sampling calculation output on the simulation step length;
s6, simulation time calculation: and calculating to obtain the simulation time of the simulation according to the simulation step length output by calculation.
In step S3 of the aforementioned time synchronization method for distributed simulation, if the time synchronization pulse received in the first frame is a time synchronization pulse, the time synchronization pulse count value of the previous frame is set to zero.
The invention has the beneficial effects that: compared with the prior art, the invention has the following beneficial effects:
1) adapted for non-real time operating systems
The invention does not need to rely on the high-precision clock synchronization of an operating system, relies on the control node to generate the time synchronization pulse, and periodically sends the time synchronization pulse to the response node to finish the time synchronization propulsion of each simulation entity.
2) Supporting super real-time accelerated simulation
Because the clock source of the method adopts the soft clock based on the time synchronization pulse, the super real-time simulation acceleration function under the distributed simulation framework can be realized through the setting of the simulation speed multiplication and the pulse period.
3) Adapted to unreliable transport network protocols
The invention adopts pulse interpolation compensation, improves the robustness of time synchronization of the distributed simulation system, and can synchronize the time to the current time synchronization pulse time through the pulse interpolation compensation even if the time synchronization pulse received by the response node loses frames, thereby being suitable for the distributed simulation system of the unreliable transmission network communication protocol.
In conclusion, the invention solves the technical problems of simulation time sequence and logic consistency of the distributed computer, meets the time synchronization requirement of multi-node distributed long-time simulation under a non-real-time operating system, and simultaneously realizes super real-time accelerated simulation under a distributed architecture.
Drawings
FIG. 1 is a schematic block diagram of a simulated time-marching based on time-synchronized pulses.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Embodiment 1. a time synchronization method for distributed simulation, referring to fig. 1, from the design point of time synchronization, a simulation node of a distributed simulation system is divided into a control node and a response node of time synchronization, the control node is responsible for completing generation and distribution of time synchronization pulses, and the response node is responsible for receiving the time synchronization pulses of the control node. The time synchronization pulse generated by the control node is a counter, and the pulse time interval and the simulation speed multiplication between two adjacent time synchronization pulses can be configured and dynamically adjusted. The mathematical expressions of the time synchronization pulse count value and the simulation step length are as follows:
dt(k)=(Tm(k)-Tm(k-1))·ΩT·S,k≥1 (1)
wherein dt (k) represents the simulation step size of the current frame k, Tm (k) represents the current frame synchronization pulse count value, Tm (k-1) represents the previous frame time synchronization pulse count value, and ΩTIndicating the pulse time interval and S the simulated double speed.
According to the calculation result of the simulation step length, the simulation time can be obtained by continuous integral calculation, and the mathematical expression of the simulation time after the simulation system is synchronized is as follows:
where t (k) represents the current cumulative simulation time.
If the time synchronization pulse value of the current frame minus the time synchronization pulse value of the previous frame is greater than one, it is indicated that the time synchronization pulse received by the time synchronization response node has frame loss, the calculated value of the simulation step length is greater than the expected simulation step length, and in order to avoid the simulation model calculation distortion caused by the overlarge simulation step length, pulse interpolation compensation is adopted: and uniformly sampling the simulation step length which is larger than the expected simulation step length, and using the sampled simulation step length as the input of the simulation model.
All distributed simulation nodes uniformly advance simulation time based on the time synchronization pulse, and time synchronization is carried out on the clock of the virtual clock source, namely the simulation time, so that the data timestamps of all simulation entities are kept consistent in the simulation time.
Embodiment 2. a time synchronization method for distributed simulation, referring to fig. 1, is performed according to the following steps:
1. node role classification
In the distributed simulation system, one distributed simulation node is selected as a time synchronization control node, and other distributed simulation nodes are time synchronization response nodes.
2. Time synchronization pulse generation
The time synchronization control node computer generates time synchronization pulses, and the initial time synchronization pulse count value is zero and represents the starting point of the distributed simulation. And in the control node computer periodic task thread, updating the time synchronization pulse count value and sending the time synchronization pulse to the simulation system through the Ethernet period.
3. Time synchronization pulse reception processing
And each distributed node receives the time synchronization pulse of the time synchronization control node as the current time synchronization pulse through the Ethernet. If the time synchronization pulse received by the first frame is the time synchronization pulse received by the first frame, setting the time synchronization pulse counting value of the previous frame to be zero.
4. Simulation step size calculation
And setting pulse time interval and simulation speed multiplication, and calculating according to a mathematical expression (1) to obtain the simulation step length of the current frame simulation node time advance.
5. Pulse interpolation compensation
And if the simulation step length calculated in the last step is larger than the maximum simulation step length of the simulation entity model, performing uniform sampling calculation output on the simulation step length by adopting pulse interpolation compensation. Namely, the simulation step length which is larger than the expected simulation step length is uniformly sampled, and the sampled simulation step length is used as the input of a simulation model.
The foregoing is merely a detailed description of the embodiments of the present invention, and some of the conventional techniques are not detailed. The scope of the present invention is not limited thereto, and any changes or substitutions that can be easily made by those skilled in the art within the technical scope of the present invention will be covered by the scope of the present invention. The protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (8)
1. A time synchronization method facing distributed simulation is characterized in that from the design angle of time synchronization, simulation nodes of a distributed simulation system are divided into time synchronization control nodes and response nodes, the control nodes are responsible for completing generation and distribution of time synchronization pulses, and the response nodes are responsible for receiving the time synchronization pulses of the control nodes; all distributed simulation nodes uniformly advance simulation time based on the time synchronization pulse, and time synchronization is carried out on the clock of the virtual clock source, namely the simulation time, so that the data timestamps of all simulation entities are kept consistent in the simulation time.
2. The distributed simulation-oriented time synchronization method of claim 1, wherein the time synchronization pulse generated by the control node is a counter, and the mathematical expressions of the time synchronization pulse count value and the simulation step size are as follows:
dt(k)=(Tm(k)-Tm(k-1))·ΩT·S,k≥1 (1)
wherein dt (k) represents the simulation step size of the current frame k, Tm (k) represents the current frame synchronization pulse count value, Tm (k-1) represents the previous frame time synchronization pulse count value, and ΩTIndicating the pulse time interval and S the simulated double speed.
3. The distributed simulation-oriented time synchronization method of claim 2, wherein the pulse time interval between two adjacent time synchronization pulses and the simulation speed doubling can be configured and dynamically adjusted.
4. The distributed simulation-oriented time synchronization method of claim 2, wherein the simulation time is obtained by continuous integral calculation according to the calculation result of the simulation step length, and the mathematical expression of the simulation time after the simulation system is synchronized is as follows:
where t (k) represents the current cumulative simulation time.
5. The distributed simulation-oriented time synchronization method of claim 1, wherein if the current frame time synchronization pulse value minus the previous frame time synchronization pulse value is greater than 1, the time synchronization pulse received by the time synchronization response node has a frame loss, and the simulation step calculation value is greater than the expected simulation step.
6. The distributed simulation-oriented time synchronization method of claim 5, wherein when a frame loss occurs, impulse interpolation compensation is adopted: and uniformly sampling the simulation step length which is larger than the expected simulation step length, and using the sampled simulation step length as the input of the simulation model.
7. The distributed simulation-oriented time synchronization method according to claim 1, characterized by comprising the following steps:
s1, node role classification: in the distributed simulation system, one distributed simulation node is selected as a time synchronization control node, and other distributed simulation nodes are time synchronization response nodes;
s2, time synchronization pulse generation: the time synchronization control node computer generates time synchronization pulses, and the initial time synchronization pulse count value is zero and represents the starting point of the distributed simulation; in a control node computer periodic task thread, updating a time synchronization pulse count value, and sending a time synchronization pulse to a simulation system through an Ethernet period;
s3, time synchronization pulse receiving processing: each distributed node receives the time synchronization pulse of the time synchronization control node through the Ethernet as the current time synchronization pulse;
s4, simulation step length calculation: setting pulse time interval and simulation speed multiplication, and calculating to obtain the simulation step length of the current frame simulation node time advance;
s5, pulse interpolation compensation: if the simulation step length obtained by calculation is larger than the maximum simulation step length of the simulation entity model, adopting pulse interpolation compensation to carry out uniform sampling calculation output on the simulation step length;
s6, simulation time calculation: and calculating to obtain the simulation time of the simulation according to the simulation step length output by calculation.
8. The method for time synchronization of distributed simulation according to claim 7, wherein in step S3, if the time synchronization pulse received in the first frame is a time synchronization pulse, the time synchronization pulse count value of the previous frame is set to zero.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111533939.0A CN114297833A (en) | 2021-12-15 | 2021-12-15 | Time synchronization method for distributed simulation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111533939.0A CN114297833A (en) | 2021-12-15 | 2021-12-15 | Time synchronization method for distributed simulation |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114297833A true CN114297833A (en) | 2022-04-08 |
Family
ID=80968474
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111533939.0A Pending CN114297833A (en) | 2021-12-15 | 2021-12-15 | Time synchronization method for distributed simulation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114297833A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115459897A (en) * | 2022-09-02 | 2022-12-09 | 南方电网科学研究院有限责任公司 | Step length synchronous calibration method and device in electric power real-time simulation and related equipment |
CN115642980A (en) * | 2022-12-13 | 2023-01-24 | 中国铁道科学研究院集团有限公司通信信号研究所 | Distributed simulation synchronization method and system |
CN115459897B (en) * | 2022-09-02 | 2024-06-04 | 南方电网科学研究院有限责任公司 | Step length synchronous calibration method and device in power real-time simulation and related equipment |
-
2021
- 2021-12-15 CN CN202111533939.0A patent/CN114297833A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115459897A (en) * | 2022-09-02 | 2022-12-09 | 南方电网科学研究院有限责任公司 | Step length synchronous calibration method and device in electric power real-time simulation and related equipment |
CN115459897B (en) * | 2022-09-02 | 2024-06-04 | 南方电网科学研究院有限责任公司 | Step length synchronous calibration method and device in power real-time simulation and related equipment |
CN115642980A (en) * | 2022-12-13 | 2023-01-24 | 中国铁道科学研究院集团有限公司通信信号研究所 | Distributed simulation synchronization method and system |
CN115642980B (en) * | 2022-12-13 | 2023-03-21 | 中国铁道科学研究院集团有限公司通信信号研究所 | Distributed simulation synchronization method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9203725B2 (en) | Update of a cumulative residence time of a packet in a packet-switched communication network | |
US8370675B2 (en) | Precise clock synchronization | |
US7865760B2 (en) | Use of T4 timestamps to calculate clock offset and skew | |
US8218576B2 (en) | Method, a computer program product, and a carrier for indicating one-way latency in a data network | |
US20110035511A1 (en) | Remote Hardware Timestamp-Based Clock Synchronization | |
CN111669244A (en) | Maintaining correct time in transferring counter values between clock domains | |
CN110520815A (en) | The method and system for adding precise time to stab | |
EP2448168A1 (en) | Method and system for bearing time synchronization protocol in optical transport network | |
CN110224778A (en) | A kind of clock synchronizing method of distributed system | |
Park et al. | Synchronization improvement of distributed clocks in EtherCAT networks | |
CN114297833A (en) | Time synchronization method for distributed simulation | |
CN109302255A (en) | Time synchronization control method, device, system and computer readable storage medium | |
CN110350996B (en) | Clock drift rate tracking method and system based on interactive multi-model filter | |
CN103647614A (en) | Method for reliably improving time synchronization precision based on IEEE1588 protocol | |
WO2021142828A1 (en) | Time synchronization method and apparatus, and network node device | |
WO2020164100A1 (en) | Clock synchronization method and device | |
CN114095109A (en) | Clock synchronization method, device, equipment and storage medium | |
US9882705B2 (en) | Communication apparatus, communication method, and computer readable medium using propagation delay for time synchronization | |
US20220360423A1 (en) | Accurate Timestamp Correction | |
CN112600804B (en) | Method for realizing compression algorithm in time-triggered Ethernet | |
Puhm et al. | Synchronizing an ieee 1588 slave clock over both paths of a redundant ethernet system | |
CN109150354B (en) | Method for calculating compression correction value in time-triggered Ethernet | |
Zhang et al. | A disturbance rejection control approach for clock synchronization in IEEE 1588 networks | |
Qi et al. | A clock synchronization method for ad hoc networks | |
CN110492966B (en) | Time synchronization method of distributed relay protection device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |