Research On Clock Synchronization Mechanism of Distributed Simulation System Based On DDS
Research On Clock Synchronization Mechanism of Distributed Simulation System Based On DDS
Research On Clock Synchronization Mechanism of Distributed Simulation System Based On DDS
Abstract—Flight control system simulation test is a key In the distributed system of flight control system simulation
process in aircraft design stage. Distributed system test, the efficient and timely data interaction between each node
architecture is often used in flight control simulation test. is a key point of the system design. For distributed simulation
Clock synchronization has always been a research hotspot of test system, DDS is an excellent distributed message
distributed simulation system. Data distribution service (DDS) middleware [2]. It set up a system composed of release node and
is widely used in distributed simulation system for its good subscription node structure, providing a very efficient data
real-time performance, high efficiency and low coupling. transmission mechanism and rich and practical QOS
However DDS does not provide a excellent clock management functions. It is applied to resources field which
synchronization mechanism. Aiming at the demand of clock requiring high performance and predictability and effective use
of the key tasks.
synchronization of distributed simulation test system, an
improved PTP clock synchronization algorithm is proposed in However DDS lacks the implementation and management
this paper, and a virtual clock of distributed simulation system of time synchronization mechanism of each node. What’s more,
is constructed on the basis of the propulsion timing model. clock synchronization between nodes is more important
Experimental data show that the model can be applied to between distributed systems,. It needs to make sure that all the
simulation nodes stably, and the improved algorithm can also nodes in distributed simulation system of the time difference in
achieve clock synchronization between nodes of distributed a certain range. This paper studied on the basis of the DDS
system. clock synchronization mechanism of distributed systems.
Keywords—Data distribution services; Clock synchronization;
II. DATA DISTRIBUTION SERVICE
Virtual clock
DDS is a software design specification and standard
developed by OMG (object management organization) [3],
I. INTRODUCTION which can achieve publish/subscribe communication between
transport layer and application layer while meeting the real-
In the flight control system simulation test for near space time requirements. This specification standardizes the interface
UAV[1], in order to make the simulation structure more flexible and behavior of data publishing, transmission and subscribing
and the operation of each subsystem more efficient, the test in distributed real-time system. It can enhance the system
mostly adopts the distributed architecture. Each node has its dynamics, and improving communication efficiency and
own operating environment. There are four nodes in the present system flexibility.
system: flight control computer, AC flight package, ground
station and airborne system. The simulation structure for flight RTI DDS(Formerly known as NDDS[4]) is developed and
control simulation test is as Fig.1. implemented by Real-time Innovation Company, which was
the first commercial product to support the DDS specification.
)OLJKWFRQWURO $&
FRPSXWHU SDFNHWV DDS is designed for data publishing/subscription requirements
of real-time systems[5]. DDS supports multiple data distribution
patterns and data distribution strategies, and supports QoS
configuration in the form of XML. It is possible to change the
communication mode and performance of the system without
changing the source code of the nodes, thus reducing the
''69LUWXDO%86
coupling between nodes [6] .
0DLQFRQWURO
V\VWHP DDS data publish-subscribe model establishes the concept
of "global data space", as in Fig.2. When data is exchanged
*URXQG $LUERUQH between nodes, Publisher creates the DataWriter with the
VWDWLRQ V\VWHPV specified Topic and then writes the data to the global data
space through the DataWriter. The Subscriber creates the
Fig.1. Structure of flight control simulation system DataReader of the corresponding Topic, which retrieves data
of the local clock will also make the system run abnormal. To 7P
avoid this situation, this paper constructs a virtual timing clock
referencing computer physical clock timing model. The clock
frequency of it even can be adjusted. 76
The virtual clock is implemented with the method of the
software by a separate higher-priority thread. The clock is 7P
2225
orized licensed use limited to: AMRITA VISHWA VIDYAPEETHAM AMRITA SCHOOL OF ENGINEERING. Downloaded on January 22,2024 at 09:38:27 UTC from IEEE Xplore. Restrictions ap
6) The master node sends delay_resp messages with 4) After receiving the reply form the slave node, the master
accurate timestamp information(Tm2)to the slave node; node calculates the network delay and send the calculated
delay to the slave node as the virtual time calibration command;
Offset of master and slave clocks can be calculated by Tm1,
Tm2, Ts1 and Ts2: 5) After receiving the calibration command from the master
node , the slave node calibrate it’s clock by making a
ሺ் ି் ሻିሺ் ି் ሻ
ݐ݁ݏ݂݂ൌ ೞభ భ మ ౩మ backward adjustment(Δ T);
ଶ
After getting the offset from the node, the slave node can The virtual clock of slave clock get more accurate time
synchronize the time by modifying the local virtual clock. correction by the synchronization process .
B. Improved PTP protocol based on virtual clock ି ି
ݐ݁ݏ݂݂ൌ మ భ ೞభ
ଶ
(1) Initial alignment time
The calibration result is the slave clock adjusting
The PTP protocol has its own clock for master and slave ଵ forward of the virtual clock of this node. In this way, the
nodes, and the clock is always running. This paper has time of receiving message from the master node in the above
presented a propulsive timing model in which each node process can be understand as ଵ , which achieves the
maintains a virtual clock that can be invoked by command. clock synchronization in the virtual time domain.
Therefore, there is no clock offset in the improved clock
PTP protocol is a clock synchronization based on the
synchronization process. The master node wakes up the slave
assumption that the sending processing time is ignored. After
node's clock through the first packet. After receiving the
the improvement, the last calibration command (CalibrateCmd)
message from the clock, it is logically separated from the
only needs to tell the slave node to adjust how much time. It
physical environment where each node is located. The
does not need to be calculated into the synchronization model.
implementation process is shown in the Fig.4.
So, only two packages are used for computing the sending time
0DVWHU 6ODYH of data. In some way, it reduces the error causing by ignoring
processing time.
In the above synchronization process, as in Fig.5, only one
'HOD\
&DOLEUDWH 1RGH
1RGH
2226
orized licensed use limited to: AMRITA VISHWA VIDYAPEETHAM AMRITA SCHOOL OF ENGINEERING. Downloaded on January 22,2024 at 09:38:27 UTC from IEEE Xplore. Restrictions ap
At the end of period of clock synchronization initialization, process of simulating the master and slave clock initialization
the clock master node calculates the time correction of each of the system.
node according to the response packet of each slave node to
clock synchronization request. And the master node sends the Initial alignment time is complete. The virtual clock
running of each node is affected by the physical characteristics
clock modification amount of each node ο ൌ ݅ ݉ͳ of the node itself. So in order to improve the stability of clock
to each slave node in the later period of clock synchronization synchronization, it have to do periodic correction after
Initialization phase. initialization process.
When the Master Node makes a clock synchronization (2) Periodic time calibration
request, it creates a synchronous requester. Materializing
requests by using the data types of requests and replies, and The timing process in the previous section has been
initialize the requester with requester_params. Setting the completed. The soft clock of each slave node has been started
node ID of the master node of the synchronization system is 0, by the master node and preliminarily adjusted. In order to
and the startup control command to the macro StartCmd. And maintain the stability of clock synchronization, it is necessary
set the timestamp of the packet. The requester's send_request() to calibrate each clock periodically. Therefore, in each
function is called to send the synchronization request. Then it simulation cycle of the distributed simulation system, the
enters the ready receiving state of the reply packet. master clock also needs to publish its own clock information,
The packet structure of the master node publishing for and each slave node uses the received master node clock
requesting clock synchronization is as follows: information to calibrate the clock of the slave node, for
maintaining the stability of clock synchronization effect.
struct TimeSyncRequester{ In previous studies, the periodic frequency correction of the
unsigned long NodeID; clock mostly calculate by the way of one node i to collect all
unsigned long StartCmd; other nodes j= 1,2... i-1, i+1... , the clock difference of n, and
TimeStamp MasterSendTime; the local clock frequency calibration can be obtained after
}; average or weighted average processing[10]. However this
Each Slave Node creates a replier at startup and materialize method has a disadvantage, that is the local virtual clock
requests by using the data types of requests and replies . Then frequency is the physical environment and the local is
initializing the replier with replier_params. concerned, if the local clock frequency correction introduced
other nodes of the clock signal, it can hardly optain very good
When the slave node receive the master node clock correction effect. And each node of the physical environment
synchronization request, it parse the packet and judge whether to virtual clock clock frequency influence still exists, and it
the packet is master clock node (NodeID = 0), and ensure gets worse and worse as the virtual clock runs. According to
whether it is the start command for clock (StartCmd). If the the analysis, in the design process of clock frequency
clock synchronization request packet and request command is calibration module in the paper, it is done separately by each
from master clock node, each slave node invoke the Initialize ()
node . The node calibrates its virtual clock count and frequency
command of SoftClock to start a local virtual clock. At the
same time, creating the reply packet, and set the local node ID based on its clock run offset.
in the reply packet, take out the master node publishing time The calibration process is as in Fig.6. The master node
from the request packet and set it to the reply packet. Before publishes the virtual clock of this node to each slave node
sending the reply packet, add the time stamp of the slave node's through the write() interface of DDS. In order to save network
virtual timestamp to the packet. bandwidth, DDS transmission mode is configured to broadcast
int the paper.
Reply packet structure from slave clock:
&\FOH &\FOH &\FOH &\FOH Q
struct TimeSyncRequester{ 0DVWHU 7 0 70 70 70 70Q
,QLWLDOL]DWLRQ
TimeStamp
MasterSendTime;
TimeStamp SlaveSendTime;
}; 6ODYH 76 76 76 76 76 76Q
After the master node receives the reply from each node, Fig.6. All processes of clock synchronizes
the synchronization algorithm designed above is used to
In the Fig.6, the master node send the virtual clock
calculate the network delay of the synchronization process for
information of slave node (TMn) at the beginning of each
each packet. And the modified results of each slave node
synchronization cycle. And the slave node also records the
calculated are sent to each node through the write() function of
DDS's publish and subscribe mode. After each slave node local time 76Q after receiving a clock message from the master
receives the correction time. packet, it modifies the local node each cycle . Assuming that each time the machine virtual
virtual clock. So as to complete the slave clock startup and the clock messages sent from the master node to node of one-way
network latency is equal. This hypothesis has less influence on
2227
orized licensed use limited to: AMRITA VISHWA VIDYAPEETHAM AMRITA SCHOOL OF ENGINEERING. Downloaded on January 22,2024 at 09:38:27 UTC from IEEE Xplore. Restrictions ap
the error than the previous bidirectional network delay . It is and the maximum error is 3%. So the slave clock frequency is
closer to the actual situation. relatively stable.
The time information in figure 5 has the following 1.04
x 10
4
relationship: 1.03
1.02
Where,ߠ݅ is the clock offset of the slave node to the virtual 0.99
clock of the master node that takes place in the cycle ݅ .Then 0.98
frequency, the master and slave nodes can reach the same 1
corrected. -1
0 100 200 300 400 500 600 700 800
Simulation time(s)
݇ܨǡ݅ 4.5
Node-2
Node-3
Node-4
After the above analysis, after the slave node receiving the 4
3.5
clock offset of it’s local virtual clock is calculated. The slave 2.5
2228
orized licensed use limited to: AMRITA VISHWA VIDYAPEETHAM AMRITA SCHOOL OF ENGINEERING. Downloaded on January 22,2024 at 09:38:27 UTC from IEEE Xplore. Restrictions ap
of the propulsion timing model. The clock synchronization REFERENCES
algorithm is used to carry out initialization process and [1] Y.L Wu,Y.L Cai,H.X Baoyin,L.C Xiong,et al,”Design of redundant
periodic calibration of the clock of the master and slave nodes. fault-tolerant navigation system for near space UAV”.Acta Aeronautica
The calibration process also included frequency correction and et Astronautica Sinica.2016,37(S1):pp91-98.
clock offset calibration, so that each simulation node achieves [2] PardoCastellote,Gerardo.OMGDataDistributionService(DDS):Architect
good clock synchronization accuracy. In this way, even if the ural Overview. Real-Time Innovations, Inc. :REAL-TIME
INNOVATIONS INC SUNNYVALE CA, 2011, 1.
gap between each node and the local physical clock is larger
and larger, the clock synchronization of the entire simulation [3] OMG, Data distribution service for real-time systems
specification.Version 1.2. http://www.omg.org/spec/DDS/ Jan.2007.
time domain can be guaranteed to be within a certain accuracy.
[4] Pardo-Castellote G, Schneider S, Hamilton M. “NDDS: The real-time
publish-subscribe middleware”.Real-Time Innovations, Inc, 1999.
[5] Gerardo PC. “OMG Data-Distribution Service (DDS): Architectural
VI. CONCLUSIONS Update”. 2004 IEEE Military Communications Conference, 2004,
pp961-967.
In the distributed simulation test system, each functional [6] J Han,Y.S Wang,” Design and Implementation of Sensor Data
module runs on different terminals respectively. In order to Distribution System Based on DDS”.Ship Electronic Engineering,
solve the practical need of clock synchronization, the virtual 2018,Vol.38 No.10,pp130-133.
clock which promotes the timing model is adopted to avoid [7] N Sun,W Xiong,Y.Z Ding,”Study and Application of Clock
frequent modification of the local clock of the terminal. Then, Synchronization” , Computer Engineering and Applications | Comput
Eng Appl.2003.27,pp177-185.
on the basis of distributed simulation test system
[8] Y.X.Ling,L.J Fan,T.Wang,G.H Zhang,”ock Synchronization Algorithm
communication middleware DDS, the PTP clock Based on Parametric Difference for Distributed Node Clusters,” ACTA
synchronization algorithm is improved and implemented. ARMAMENTARII, V0l.34 No.1,pp.51-58,2013
Through the analysis of test data results, the virtual clock [9] IEEE Std 1588-2008.IEEE standard for a precision clock
model and synchronization algorithm in this paper have a high synchronization protocol for networked measurement and control
accuracy, which meets the requirements of the existing system systems. New York:Institute of Electrical and Electronic
Engineers ,2008.
for time synchronization accuracy. [10] Y.N Ren,B Zheng,H.L Guo,” Research and development of IEEE 1588
in distributed wireless network”, Information Technology.
2018.11,pp103-110.
2229
orized licensed use limited to: AMRITA VISHWA VIDYAPEETHAM AMRITA SCHOOL OF ENGINEERING. Downloaded on January 22,2024 at 09:38:27 UTC from IEEE Xplore. Restrictions ap