A time synchronization method for distributed simulation
By using time synchronization pulses in distributed simulation systems, the problem of time synchronization in long-term simulation under non-real-time operating systems is solved, and hyper-real-time accelerated simulation and improved robustness are achieved, which is suitable for non-reliable networks.
Patent Information
- Application Number
- CN202111533939.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2041-12-15
AI Technical Summary
In distributed simulation, it is difficult to achieve long-term time synchronization under non-real-time operating systems, and the existing methods have message delay and frame drop problems in network transmission, making it difficult to implement simulation acceleration function.
Using the method of time synchronization pulses, the distributed simulation system is divided into control nodes and response nodes. The control node generates and distributes time synchronization pulses. The response node receives and processes pulses. Time synchronization is achieved through pulse interpolation compensation, and supports dynamic adjustment of pulse time intervals. and simulation speed to ensure consistency of simulation step length.
It realizes multi-node distributed long-term simulation time synchronization under non-real-time operating systems, supports hyper-real-time accelerated simulation, and improves the robustness of the system, and is suitable for non-reliable transmission networks.
Smart Images

Figure CN114297833B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of distributed computer simulation, and in particular to a time synchronization method oriented to distributed simulation. Background Art
[0002] In distributed simulation, each simulation node resides in a different computer system, and each simulation node forms a closed virtual world through network communication. Correct timing and logical relationships are the key to ensuring the correctness and credibility of distributed simulation. Distributed simulation places very high demands on time synchronization. Currently, high-precision timing based on real-time operating systems can solve short-term time and data synchronization, but clock drift will cause synchronization accuracy to decrease over time. Therefore, this method cannot be applied to non-real-time operating systems and long-term simulation operations. The method based on Ethernet unified clock source solves the clock drift problem and realizes the clock source synchronization of each distributed simulation node. However, this method has the disadvantages of message delay and frame loss in network transmission, and it is difficult to realize simulation acceleration due to the limitation of hardware clock source. Summary of the invention
[0003] The purpose of the present invention is to propose a time synchronization method for distributed simulation. The present invention solves the technical problems of distributed computer simulation timing and logic consistency, meets the time synchronization requirements of multi-node distributed long-term simulation under non-real-time operating systems, and realizes super real-time accelerated simulation under distributed architecture.
[0004] The technical solution of the present invention is a time synchronization method for distributed simulation. From the design perspective of time synchronization, the simulation nodes of the distributed simulation system are divided into control nodes and response nodes for 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 the simulation time based on the time synchronization pulses, and synchronize the clock of the virtual clock source, i.e., the simulation time, so that the data timestamps of each simulation entity keep consistent in pace with the simulation time.
[0005] In the aforementioned time synchronization method for distributed simulation, the time synchronization pulse generated by the control node is a counter, and the mathematical expression of the time synchronization pulse count value and the simulation step length is:
[0006] dt(k)=(Tm(k)-Tm(k-1))·Ω T ·S, k ≥ 1 (1)
[0007] Where dt(k) represents the simulation step size of the current frame k, Tm(k) represents the synchronization pulse count value of the current frame, Tm(k-1) represents the synchronization pulse count value of the previous frame, and Ω T represents the pulse time interval, and S represents the simulation speed.
[0008] In the aforementioned time synchronization method for distributed simulation, the pulse time interval between two adjacent time synchronization pulses and the simulation speed can be configured and dynamically adjusted.
[0009] In the above-mentioned time synchronization method for distributed simulation, the simulation time is obtained by continuous integral calculation based on the calculation result of the simulation step length. The mathematical expression of the simulation time after the simulation system is synchronized is:
[0010]
[0011] Where t(k) represents the current cumulative simulation time.
[0012] In the aforementioned time synchronization method for distributed simulation, 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 is lost, and the simulation step calculation value will be greater than the expected simulation step.
[0013] In the aforementioned time synchronization method for distributed simulation, when frame loss occurs, pulse interpolation compensation is adopted: the simulation step length that is larger than the expected simulation step length is uniformly sampled, and the sampled simulation step length is used as the simulation model input.
[0014] The aforementioned time synchronization method for distributed simulation is performed in the following steps:
[0015] S1. Node role classification: In a distributed simulation system, one distributed simulation node is selected as the time synchronization control node, and the other distributed simulation nodes are all time synchronization response nodes;
[0016] S2. Time synchronization pulse generation: The time synchronization control node computer generates a time synchronization pulse, and the initial time synchronization pulse count value is zero, which represents the starting point of the distributed simulation; in the control node computer cycle task thread, the time synchronization pulse count value is updated, and the time synchronization pulse is sent to the simulation system through the Ethernet cycle;
[0017] S3 time synchronization pulse reception processing: each distributed node receives the time synchronization pulse of the time synchronization control node via Ethernet as the current time synchronization pulse;
[0018] S4. Simulation step calculation: set the pulse time interval and simulation speed, and calculate the simulation step of the current frame simulation node time advancement;
[0019] S5. Pulse interpolation compensation: If the calculated simulation step length is greater than the maximum simulation step length of the simulation entity model, pulse interpolation compensation is used to uniformly sample the simulation step length and calculate and output it;
[0020] S6. Simulation time calculation: The simulation time of the simulation is calculated according to the simulation step size outputted by the calculation.
[0021] In step S3 of the aforementioned time synchronization method for distributed simulation, if it is the first frame of received time synchronization pulses, the count value of the time synchronization pulses of the previous frame is set to zero.
[0022] Beneficial effects of the invention: Compared with the prior art, the present invention has achieved the following beneficial effects:
[0023] 1) Applicable to non-real-time operating systems
[0024] The present invention does not need to rely on the high-precision clock synchronization of the operating system, but relies on the control node to generate time synchronization pulses, and periodically sends the time synchronization pulses to the response node to complete the time synchronization advancement of each simulation entity.
[0025] 2) Support ultra-real-time accelerated simulation
[0026] Since the clock source of this method adopts a soft clock based on time synchronization pulses, the ultra-real-time simulation acceleration function under the distributed simulation framework can be realized by setting the simulation speed and pulse period.
[0027] 3) Applicable unreliable transmission network protocol
[0028] The present invention adopts pulse interpolation compensation to improve the robustness of time synchronization of distributed simulation systems. Even if the time synchronization pulse received by the response node loses frames, the time can be synchronized to the current time synchronization pulse time through pulse interpolation compensation. Therefore, it can be applied to distributed simulation systems of unreliable transmission network communication protocols.
[0029] In summary, the present invention solves the technical problems of distributed computer simulation timing and logical consistency, meets the time synchronization requirements of multi-node distributed long-term simulation under non-real-time operating systems, and realizes super real-time accelerated simulation under distributed architecture. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 This is a block diagram of the simulation time advancement principle based on time synchronization pulses. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0032] Example 1. A time synchronization method for distributed simulation, see Figure 1 From the perspective of time synchronization design, the simulation nodes of the distributed simulation system are divided into time synchronization control nodes and response nodes. The control node is responsible for completing the 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. The pulse time interval and simulation speed between two adjacent time synchronization pulses can be configured and dynamically adjusted. The mathematical expression of the time synchronization pulse count value and the simulation step length is:
[0033] dt(k)=(Tm(k)-Tm(k-1))·Ω T ·S, k ≥ 1 (1)
[0034] Where dt(k) represents the simulation step size of the current frame k, Tm(k) represents the synchronization pulse count value of the current frame, Tm(k-1) represents the synchronization pulse count value of the previous frame, and Ω T represents the pulse time interval, and S represents the simulation speed.
[0035] According to the calculation results of the simulation step length, the simulation time can be obtained by continuous integration. The mathematical expression of the simulation time after the simulation system is synchronized is:
[0036]
[0037] Where t(k) represents the current cumulative simulation time.
[0038] If the current frame time synchronization pulse value minus the previous frame time synchronization pulse value is greater than one, it means that the time synchronization pulse received by the time synchronization response node has frame loss, and the simulation step calculation value will be greater than the expected simulation step. In order to avoid the simulation model calculation distortion caused by excessive simulation step, pulse interpolation compensation is used: the simulation step that is greater than the expected simulation step is uniformly sampled, and the sampled simulation step is used as the simulation model input.
[0039] All distributed simulation nodes uniformly advance the simulation time based on the time synchronization pulse, synchronize the clock of the virtual clock source, that is, the simulation time, so that the data timestamps of each simulation entity are consistent in the simulation time.
[0040] Example 2. A time synchronization method for distributed simulation, see Figure 1 , follow these steps:
[0041] 1. Node role classification
[0042] In the distributed simulation system, one distributed simulation node is selected as the control node for time synchronization, and the other distributed simulation nodes are all response nodes for time synchronization.
[0043] 2. Time synchronization pulse generation
[0044] The time synchronization control node computer generates a time synchronization pulse, and the initial time synchronization pulse count value is zero, which represents the starting point of the distributed simulation. In the control node computer periodic task thread, the time synchronization pulse count value is updated, and the time synchronization pulse is sent to the simulation system through the Ethernet periodicity.
[0045] 3. Time synchronization pulse reception and processing
[0046] Each distributed node receives the time synchronization pulse from the time synchronization control node via Ethernet as the current time synchronization pulse. If it is the first frame of the received time synchronization pulse, the count value of the previous frame of time synchronization pulse is set to zero.
[0047] 4. Simulation step calculation
[0048] The pulse time interval and simulation speed are set, and the simulation step length of the current frame simulation node time advancement is calculated according to the mathematical expression (1).
[0049] 5. Pulse interpolation compensation
[0050] If the simulation step length calculated in the previous step is greater than the maximum simulation step length of the simulation entity model, pulse interpolation compensation is used to uniformly sample the simulation step length and calculate the output. That is, the simulation step length greater than the expected simulation step length is uniformly sampled, and the sampled simulation step length is used as the simulation model input.
[0051] The above is only a specific embodiment of the present invention, and the present invention is described in detail. The unexplained part is a conventional technology. However, the protection scope of the present invention is not limited to this. Any changes or substitutions that can be easily thought of by any technician familiar with the technical field within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. The protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A time synchronization method for distributed simulation, characterized in that: From the perspective of time synchronization design, the simulation nodes of the distributed simulation system are divided into time synchronization control nodes and response nodes. The control node is responsible for completing the generation and distribution of time synchronization pulses, and the response node is responsible for receiving the time synchronization pulses of the control node. All distributed simulation nodes advance the simulation time uniformly based on the time synchronization pulse, synchronize the virtual clock source clock, i.e. the simulation time, so that the data timestamps of each simulation entity keep the same pace in the simulation time; The time synchronization pulse generated by the control node is a counter. The mathematical expression of the time synchronization pulse count value and the simulation step length is: dt(k)=(Tm(k)-Tm(k-1))·Ω T ·S,k≥1 (1) Where dt(k) represents the simulation step size of the current frame k, Tm(k) represents the synchronization pulse count value of the current frame, Tm(k-1) represents the synchronization pulse count value of the previous frame, and Ω T represents the pulse time interval, and S represents the simulation speed; 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 will have frame loss, and the calculated simulation step value will be greater than the expected simulation step size. When frame loss occurs, pulse interpolation compensation is used: the simulation step size that is greater than the expected simulation step size is uniformly sampled, and the sampled simulation step size is used as the simulation model input.
2. The time synchronization method for distributed simulation according to claim 1, characterized in that: The pulse time interval and simulation speed between two adjacent time synchronization pulses can be configured and dynamically adjusted.
3. The time synchronization method for distributed simulation according to claim 1, characterized in that: According to the calculation result of the simulation step length, the simulation time is obtained by continuous integral calculation. The mathematical expression of the simulation time after the simulation system is synchronized is: Where t(k) represents the current cumulative simulation time.
4. The time synchronization method for distributed simulation according to claim 1, characterized in that: Follow these steps: S1. Node role classification: In a distributed simulation system, one distributed simulation node is selected as the time synchronization control node, and the other distributed simulation nodes are all time synchronization response nodes; S2. Time synchronization pulse generation: The time synchronization control node computer generates a time synchronization pulse, and the initial time synchronization pulse count value is zero, which represents the starting point of the distributed simulation; in the control node computer cycle task thread, the time synchronization pulse count value is updated, and the time synchronization pulse is sent to the simulation system through the Ethernet cycle; S3 time synchronization pulse reception processing: each distributed node receives the time synchronization pulse of the time synchronization control node via Ethernet as the current time synchronization pulse; S4. Simulation step calculation: set the pulse time interval and simulation speed, and calculate the simulation step of the current frame simulation node time advancement; S5. Pulse interpolation compensation: If the calculated simulation step length is greater than the maximum simulation step length of the simulation entity model, pulse interpolation compensation is used to uniformly sample the simulation step length and calculate and output it; S6. Simulation time calculation: The simulation time of the simulation is calculated according to the simulation step size outputted by the calculation.
5. The time synchronization method for distributed simulation according to claim 4, characterized in that: In step S3, if the time synchronization pulse received is the first frame, the count value of the time synchronization pulse of the previous frame is set to zero.
