Abstract
This paper introduces an enhanced time synchronization method different from IEEE 1588 (PTP). The proposed algorithm employs a unique synchronous message packet structure with a fixed length of 10 bytes and the highest system priority. This design enables preemptive transmission, effectively reducing transmission and queuing delays. Additionally, it applies a Kalman filtering model to mitigate noise interference, including clock drift, network delay jitter, and network asymmetry. The algorithm also features a clock drift compensation mechanism to continuously adjust the clock, ensuring high precision and stability in time synchronization. The algorithm proposed in this paper has the characteristics of being easy to implement, requiring minimal hardware resources, and being applicable to a variety of networks. Simulation results show that, with an 80 MHz crystal oscillator, the time offset between master and slave clocks does not exceed ± 1 clock cycle in symmetric communication links. In asymmetric links, the maximum time offset is within ± 3 clock cycles. Compared to the original PTP algorithm and the Kalman filter-based time synchronization algorithm, this method reduces the time offset from several microseconds to less than 40 ns.
Similar content being viewed by others
Introduction
The network technology is widely used in various industrial automation, and control domains with the rapid advancement of industrial automation1, robotics technology2, and the Internet of Things (IoT)3. Thus, there is an increasing necessary for network performance. Improving time synchronization performance is becoming an urgent priority, because time synchronization technology serves as the fundamental basis for ensuring reliable network operation4.
Currently, the dominated time synchronization technologies include GPS-based clock synchronization5, the Network Time Protocol (NTP)6, and IEEE 1588 (Precision Time Protocol, PTP)7. The study in Ref.5 indicates that GPS clock synchronization devices offer high precision but are unsuitable for indoor environments where GPS cannot be used. NTP, operating on a client/server model, achieves clock synchronization with millisecond precision8. PTP, widely used in distributed networks, operates on a master/slave mode and achieves synchronization between master and slave node clocks with sub-microsecond precision, surpassing that of NTP9. Therefore, this research focuses on the PTP time synchronization method.
Recent research shows that the precision of PTP clock synchronization can be significantly improved. In Refs.10,11,12,13, authors exchanged multiple data packets to acquire precise timestamps, mitigating the effects of link asymmetry. Giorgi et al. developed a software-based packet sampler that effectively filters out packets with delays exceeding a certain threshold, compensating for the impact of packet delay on time precision12. Karthik, Shrestha, Ju, Zheng et al. various models were proposed to address the drift and aging of crystal oscillators, as well as the estimated time offset and drift14,15,16,17,18,19,20. Karthik et al. introduced a clock drift autoregressive model using a Kalman filter to estimate the offset and drift of master–slave clocks, thereby reducing the impact of timestamps on time synchronization14. Shrestha et al. employed clock drift coefficients and estimated clock drift factors to enhance time synchronization performance over an estimation period15. Zuo, Y. et al. modeled clock and frequency offsets and employed a second-order Kalman filter algorithm to enhance the precision of master–slave clock synchronization17. Furthermore, Yuan, Exel, Yin, Pedretti, Eidson, et al. implemented the PTP algorithm on various FPGA hardware platforms13,21,22,23,24,25. Specifically, Yin, Pedretti, Aamir Sohail Nagra et al. successfully implemented the PTP algorithm through FPGA, achieving nanosecond-level time synchronization precision according to their research results22,23,24.
However, these works in Ref.10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25 have the disadvantage of requiring extra hardware overhead and message packet exchange. In this paper, an enhanced time synchronization algorithm is proposed by improving the structure and algorithm of synchronization message packets based on the underlying protocol level. The key differences between this algorithm and the PTP algorithm are as follows: First, the synchronization message has a fixed length of 10 bytes and is assigned the highest priority. This ensures that the synchronization message reaches the slave clock as quickly as possible, thereby reducing network queuing delays and minimizing noise interference from asymmetric links. Subsequently, a Kalman filter model is employed to eliminate noise interference, including clock drift, network delay jitter, and network asymmetry. Finally, the clock is adjusted using a clock drift compensation algorithm to achieve higher time synchronization precision and stability. This study utilizes the OMNET ++ simulator26 to construct a simulation model for assessing the time synchronization precision of various algorithms.
IEEE 1588 overview
IEEE 1588(PTP)27,28 is a network communication protocol which is mainly utilized for achieving precise clock synchronization to ensure temporal consistency among various devices in computer networks25. The synchronization process is shown in Fig. 1. When the master/slave hierarchy is established, a clock synchronization between the master and slave clocks is achieved by transmitting four different types of synchronization messages: Sync, Follow_Up, Delay_Req and Delay_Resp28. From Fig. 1, when the slave clock receives the Delay_Resp message, it will have four timestamps. Thus,
where θoffset is the time offset between the master and slave clocks, dms is the propagation delay of the master clocks-to-slave clocks link, and dsm is the propagation delay of the slave clocks-to-master clocks link. In the PTP protocol, it is assumed that the communication links are symmetric29. Therefore,
As a result, the time offset θoffset and the average transmission delay ddelay between the master and slave clock can be computed10:
Finally, the slave clock can adjust the local clock based on θoffset so that it can synchronize the master clock30.
However, a major problem is that PTP assumes that the communication links are symmetric. This is not applicable in practical environments, because the synchronized message will inevitably experience various delays when it reaches the destination. Moreover, the precision of time synchronization can be also influenced by the precision of timestamps, the instability of crystal oscillators and the asymmetry in links31. Therefore, in recent years, many researches focus on the improvement of the precision of clock synchronization between master and slave devices.
An enhanced time synchronization algorithm
IEEE 1588 is a standardized protocol which is used in measurement and control systems to achieve precise synchronization between master and slave clocks. This protocol relies on the accurate master clocks to correct periodically the time of slave clocks along with the network. This paper proposes a high-performance, high reliability and auto-reconstructed network for the aerospace and industrial applications—SharkNet. Unlike traditional networks, SharkNet utilizes an independent underlying protocol. To resolve the issue of time synchronization between master and slave clocks, a novel time synchronization packet structure and an enhanced synchronization method are also proposed in this paper.
The SharkNet system has the following features:
-
1.
The system has auto-reconstructed function: the system is completely transparent to users, and no configuration of network devices is required. The switch will automatically detect the port status regularly, ensuring timely identification of network failures. The system will be quickly reconstructed within 30 μs to achieve self-repair and ensure the effectiveness of the transmission path;
-
2.
The system has autonomous path-finding function: the system can always find the optimal path among many redundant paths to implement information transmission. Furthermore, the system autonomously maintains its consistency and completeness, thereby completely eliminating coordination costs among users and reducing the threshold for user utilization;
-
3.
The system has multiple redundant links to ensure system reliability: depending on specific applications, some or all ports can be connected as redundant links without the need for user configuration. When a switch or cable fails, the system can quickly detect the port state change and reselect the best path for data transmission;
-
4.
The system is insensitive to the transmission medium, which can adapt to the local transformation of old systems. At present, the network is compatible with RS422, RS485, LVDS, Ethernet interfaces, and other mainstream networks available in the market;
-
5.
The system has a high-precision time synchronization algorithm that can improve the synchronization precision and stability of node clocks in the network32.
Clock model
Assuming C(t) represents the time of a slave clock node at the reference time t (where t denotes the time of the master clock node), the time offset θ(t) of the slave clock can be expressed as:
The rate of change of time offset is defined as clock drift s(t), expressed as:
γ(t) is the rate of change of clock drift (also called the clock aging rate), and its relationship with s(t) is given by:
From the above formula, the fundamental model of the clock can be derived:
In Eq. (9), Tcycle represents the time synchronization message sending interval, \(\omega_{\theta (k)}\),\(\omega_{s(k)}\),\(\omega_{\gamma (k)}\) are Gaussian white noise representing time offset, clock drift and the change rate of clock drift, respectively. Their variances are denoted by: \(\delta_{\theta }^{2} \cdot T_{cycle}\),\(\delta_{s}^{2} \cdot T_{cycle}\),\(\delta_{\gamma }^{2} \cdot T_{cycle}\).
In the IEEE 1588 synchronization process, the clock is adjusted based on the estimated values of the time offset and clock drift. In the kth synchronization iteration, the time offset, clock drift, and the change rate of clock drift are adjusted using the input parameters \(u_{\theta } (k)\),\(u_{s} (k)\) and \(u_{\gamma } (k)\). Assuming real-time and valid correction input during the synchronization period Tcycle, the IEEE 1588 three-state clock model can be formulated as follows:
where \(u_{\theta } (k)\),\(u_{s} (k)\) and \(u_{\gamma } (k)\) denote the corrected values of time offset, clock drift, and rate of change of clock drift, respectively, and they are considered as the estimated values at time k.
Proposed protocol architecture
The SharkNet system topology includes point-to-point direct connection, ring topology, tree topology, mesh hybrid topology. Among them, the mesh hybrid topological structure has the highest fault reliability among all topological structures.
The SharkNet system components consist of two parts: switches and end system33:
-
1.
The switch is responsible for system maintenance and data packet forwarding. Its core is the data exchange center, which stores routing tables and is responsible for polling data in all interface data cache units to establish pipelines and forward data. Each switch can have 32 ports, each port contains two physical interfaces, one for receiving and one for sending, and has full-duplex communication capabilities;
-
2.
The end system provide users with a connectivity interface to the SharkNet system and are responsible for automatically maintaining the availability of and access to network resources. The control interface and status interface are used to ensure smooth communication between the local controller and the end system interface module, and three data transmission methods: Parallel Interface, UART and SPI, are provided to meet actual application requirements. The end system module is connected to the switch via its uplink ports U0 and U1 and joins the network.
During data transmission, the communication link's transmission delay fluctuates due to the continuous variation in the length of the transmitted data frame. This fluctuation causes the PTP algorithm to introduce substantial noise when calculating the time offset and average transmission delay. Ethernet's PTP messages use frame lengths in the range of 64 to 1518 bytes34, so the transmission time of each message packet is uncertain, which introduces a significant amount of noise interference into subsequent time offset and average transmission delay calculations. To address this issue, this paper proposes a new protocol structure designed to mitigate the time offsets caused by frame length variations.
In SharkNet system, the length of each packet frame is 10 bytes, referred to as the base packet. There are two types of data packets in system: message packets and data packets.
Message packets are used to transmit command, status and response information in the network, which can be realized by using a single base packet. Message packets are divided into three types: internal, external and user-defined. Internal message packets are used for information exchange between devices to maintain network consistency and implement various built-in functions, such as port detection, automatic reconstruction, and time synchronization. These packets are restricted from user access. External message packets provide common network functions to users, such as reading the local address, sending bulk commands, and reading the routing table, etc. User-defined message packets are customized by users according to specific application projects.
The SharkNet system supports high priority of message packets at the physical layer. By employing preemptive transmission, message packets are embedded into data packets and transmitted first. This approach markedly reduces queuing time, ensuring high real-time performance for message packets throughout the transmission process. The SharkNet system utilizes an 80-bit parallel processing kernel that matches the width of the message packet. This allows data packets to be forwarded quickly in a single clock cycle, resulting in short processing times and maximizing the real-time performance of message transmission.
Compared to the Ethernet, the frame structure proposed in this paper increases the proportion of valid data in a message packet, particularly for time synchronization-related data packets. Additionally, the network features autonomous path-finding, port detection, and port health check functions to ensure that message packets are transmitted promptly via the shortest path. The frame format of the message packet is shown in Table 1.
The structure of the data frame in a message packet includes the following fields:
-
1.
The 1-byte Mode Domain which is used to indicate the characteristic of the packet in terms of its type, function as well as priority;
-
2.
The 2-byte Source Address Domain represents the address of a source device;
-
3.
The 2-byte Destination Address Domain represents the address of a target device. Each device that connects to the network has a unique address;
-
4.
The 1-byte Parameter Domain 1 and the 2-byte Parameter Domain 2 are used to set the attribute of the packet;
-
5.
The 1-byte Control Domain is used to select the transmission path of data;
-
6.
The 1-byte Chek Domain is used to ensure the integrity of a message packet in which a CRC check is employed.
The frame format of the data packet is shown in Table 2, and its priority is lower than that of the message packet. The mode domain of the data start packet is 0X09. The mode domain of the data continuation packet is 0X1E. The mode domain of the data end packet is 0X1A. During bulk data transfer, multiple base packets are combined to form one composite packet. Only the data start packet and the data end packet need to transmit domain overheads such as the source address and the destination address. The data continuation packet only needs to transmit the data that needs to be transmitted, and does not need to transmit these additional overheads.
Proposed time synchronization algorithm
For the network protocol message packet, based on the structure of its data frame, a synchronization method is proposed which is similar to the PTP clock synchronization message mechanism. The time offset and average transmission delay are obtained when the master–slave clocks exchange the timestamps. Its synchronization process involves the following three steps: 1. average transmission delay calculation; 2. filtering implementation; 3. time offset calculation. It uses three types of handshake communication messages: 1. A1 message; 2. 51 message; 3. A2 message. These synchronization messages are 10 bytes. Their message types are determined by the Mode Domain of the data frame. In other words, the Mode Domain of the A1 message is 0XA1, the Mode Domain of the 51 message is 0X51, and the Mode Domain of the A2 message is 0XA2.
The proposed message exchange timing diagram for the enhanced time synchronization method is shown in Fig. 2:
Step 1: Firstly, after the system uses the Best Master Clock Algorithm (BMCA, The Best Master Clock Algorithm operates independently on each clock within the system, identifying and selecting the clock with the best performance, whether it is a local or another system clock, to serve as the master clock.) to select master clock and slave clock, this master clock sends periodically A1 messages to slave clocks. The A1 message contains the time count Cm1 when it leaves the port. Next, a slave clock receives an A1 message, and this message records the time count Cs1 when it enters its port. Subsequently, the slave clock sends a 51 message to the master clock and records another time count Cs2 when it leaves its port. Once receiving the 51 message, the master clock records another time count Cm2 when it enters its own port. Finally, after receiving the A2 message, the slave clock has four timestamps: Cm1, Cs1, Cs2 and Cm2. Assuming that the path delay is symmetric, i.e. \(d_{ms} = d_{sm}\). Based on Eq. (5) in Sect. 2.1, the time offset θoffset can be calculated.
Step 2: Due to the presence of noise in the θoffset calculated in step 1, the second-order Kalman filter algorithm is employed in this study to accurately estimate the time offset, clock drift, and clock drift change rate, thereby accurately correcting the delay between the master and slave clocks35. The Kalman filtering algorithm36,37,38 are explained as follows:
prediction equation:
Update equation:
where the state transition matrix A is:
The control input matrix B is:
The posterior state estimate \(\hat{x}\left( {k|k} \right)\) is:
The clock state equation input vector u(k) is:
The observation vector z(k) at time k is:
where \(\theta_{M} \left( k \right)\) is the time offset calculated by the PTP algorithm at time k, and \(s_{M} \left( k \right)\) is the clock drift at time k, i.e.
The observation matrix H is:
The covariance matrix of process noise Q is:
The matrix P(k|k−1) can be initialized to Q that is:
The observation noise covariance matrix R is:
The above content uses the Kalman filter algorithm to estimate the time offset, clock drift, and the rate of change in clock drift. The state vector \(\hat{x}\left( {k|k} \right)\) in Eq. (14) represents the optimal solution calculated by the Kalman filter (the specific value of the state vector \(\hat{x}\left( {k|k} \right)\) is given in Eq. (16)). We denote the first component θ(k) of the state vector \(\hat{x}\left( {k|k} \right)\) obtained by the Kalman filter as θkoffset.
The meaning of the Kalman filter algorithm parameters is shown in Table 335. First, use Eq. (5) and Eq. (18) to obtain the current time offset and clock drift. Subsequently, the time offset and clock drift are used as observation values of the Kalman filter algorithm so that the optimal time offset value θkoffset (Eq. (19)) can be obtained from the clock using the filter algorithm. Finally, the time offset (θkoffset) is added to the local clock of the slave clock in order to achieve time synchronization between the master clock and slave clock. Compared with PTP algorithm, the proposed algorithm requires to store the timestamp Cs1 of the slave clock (it will be used in the subsequent clock drift compensation algorithm).
Step 3: When the interval of the synchronized message set by the system ends, the second round of clock synchronization is initiated. During this round, Step 1 and Step 2 are repeated to obtain four timestamps, i.e., Cm3, Cs3, Cs4 and Cm4. At a result, the slave clock has five timestamps, i.e., Cm3, Cs3, Cm4, Cs4, and Cs1, Meanwhile, a new time count offset θkoffset is obtained. When the slave clock is operating at a slightly faster or slower frequency in the interval of the synchronized message, the time offset is accumulated. In order to resolve this issue, a clock drift compensation algorithm is used to correct this clock drift, as follows:
After obtaining the second time offset θkoffset, the cnt value of Eq. (20) is used to compensate for slave clock (see Fig. 2), in which θkoffset is the time offset between Cs1 and Cs3 (assuming that there is no clock drift for the master clock). This means that the slave clock in each cnt cycle is increased or decreased by one clock cycle.
Step 4: When the sending interval of the synchronized message is completed again, the master clock sends an A1 message to initiate the third round of time synchronization, then repeating Step 3. The difference is that the θkoffset is a new value in the latest round.
The proposed method significantly reduces the impact of the asymmetric links, packet delay variation (PDV) and frequency drift of clock synchronization, thus effectively improving the time synchronization precision.
Simulation results
The OMNET ++ simulator software is used to simulate the time synchronization algorithm of the proposed algorithm in which the LibPLN library is employed as the noise generator39, so that the requirement of discrete event simulation is achieved40,41. The noise model is generated using the method proposed in Ref.42,43 to generate the oscillator noise. The model download can be found in Ref.44. The proposed simulation model is shown in Fig. 3. The master clock operates at the nominal frequency, thus the time offset is not generated. The slave clock adopts a standard clock noise model of the LibPLN library35. The Time Offset Observer module is a monitoring module that regularly checks the time offset between the master clock and the slave clock. The simulation results are shown in the following sections.
Performance comparison in symmetric links
For a fair comparison, the same simulation configurations are used except for the length of the data frame. The detailed simulation parameters are presented in Table 4. The synchronization message sending interval, referred to as Tcycle, is set to 15.625 ms. This interval was chosen for specific reasons outlined in Sec. "Impact of sending interval". The following results are based on simulations using this sending interval.
In Fig. 4, the red line indicates the situation within one sending interval (15.625 ms). Since the monitoring interval is 1 ms, 15 or 16 number of time offset values between the master and slave clocks (from point A to point B) can be obtained using the Time Offset Observer module within one sending interval. It demonstrating that relying on the PTP algorithm alone leads to an accumulation of time errors. The slave clock at point B adjusts its local time based on the calculated time offset by the PTP algorithm to maintain synchronization with the master clock, thus confirming the effectiveness of the PTP algorithm.
In Fig. 5, the X-axis represents the master–slave clock time offset values obtained from the simulation experiment, while the Y-axis represents the proportion of time offset in whole simulations. The red bar graph indicates the proportion of offsets greater than 1000 ns (1 μs), with the maximum value of 1375 ns to 1385 ns accounting for 0.4% of the total. This deviation may result from the accumulation of clock drift during the transmission interval. As the requirements for time synchronization accuracy and stability in measurement and control systems continue to increase, networks with microsecond-level time synchronization accuracy will be unable to meet this demand. Therefore, this paper employs an enhanced algorithm to improve time synchronization precision.
Figure 6 shows the time offset values of the proposed algorithm. From this figure, it can be seen that, the time offset values of the proposed algorithm are always within ± 12.5 ns and 0 ns when the master–slave clock is 80 MHz, i.e., the maximum time offset is less than ± 1 clock cycle due to the reduced propagation noise and the compensated frequency. As a result, for the symmetrical links, the proposed algorithm can improve the precision of the time synchronization to the nanosecond level.
Figure 7 shows the comparison results of the time offset of various algorithm in symmetric links in panel (a) and asymmetric links in panel (b). It can be observed that the change of a frame length has a large impact on the time synchronization precision. The variable frame length of PTP results (Fig. 4.) in a synchronization precision of microseconds. However, when the packet length is set to a fixed length of 10 bytes, the time synchronization precision improves to nanoseconds (Case 1). The Kalman filter can slightly reduce the time offset due to the propagation noise, compared with the frame length adjustment method (Case 2). The used clock drift compensation algorithm significantly reduces the accumulation time offset (Case 3), but the proposed algorithm generates a minimum time offset (Case 4).
Impact of crystal oscillator frequency
Here, the impact of crystal oscillator frequency is investigated. The simulation parameters are shown in Table 5, and the maximum time offset of PTP (Red line) and the proposed algorithm (Blue line) is shown in Fig. 8. It can be seen that the time synchronization precision is improved when the crystal oscillator frequency increases. However, the time offset of the PTP algorithm always is larger than that of the proposed algorithm, even at a low frequency.
The maximum time offset of the proposed algorithm for various crystal oscillator frequencies is summarized in Table 5. It can be seen that when the crystal oscillator frequency is 20 MHz, 40 MHz, 80 MHz, 100 MHz and 200 MHz respectively, the proposed algorithm has a good time synchronization precision. However, when the crystal oscillator frequency is 500 MHz and 800 MHz respectively, the time synchronization precision is increased to ± 2 clock cycles form ± 1 clock cycle due to shorter clock cycle. This amplifies the impact of errors caused by the crystal oscillator on each individual clock cycle, making it unattainable to achieve clock synchronization precision within ± 1 clock cycle.
Impact of sending interval
Keeping all other simulation environment parameters unchanged as indicated in Table 4, we change the sending interval in a symmetric link. We conducted simulations with eight different sending intervals, including 2 s, 1 s, 0.5 s, 0.25 s, 0125 s, 62.5 ms, 31.25 ms and 15.625 ms.
Figure 9 shows the maximum values of the obtained time offset when the sending interval is 2 s, 1 s, 0.5 s, 0.25 s, 0.125 s, 62.5 ms, 31.25 ms and 15.625 ms respectively. It can be seen from this figure that the PTP algorithm has the maximum time offset for all the sending intervals compared with the proposed algorithm, in which the proposed algorithm only has the time synchronization precision at the nanosecond level. At the same time, this figure also demonstrates that the time synchronization precision of the proposed algorithm is improved when the sending interval is reduced.
Impact of asymmetric links
The delay between the master and slave clocks consists of sending delay, propagation delay, and receiving delay. When the sending delay is inconsistent with the receiving delay, the asymmetric delay is generated. Table 6 gives the delay of the proposed algorithm in an asymmetric link. This figure shows that the minimum sending and receiving delays of the proposed algorithm are 80 ns. Several jitters are added to these delays, and the Time Offset Observer module is used to monitor the time offset every 0.1 ms.
As shown in Table 6, we conducted 15 simulation experiments to examine the delay between the sending and receiving nodes, with a maximum offset of up to 100 ns. The results indicate that as the delay between the receiving and sending nodes increases, the time offset of the master–slave clock gradually increases as well. But our method effectively maintains time synchronization precision within three clock cycles.
Figure 10 shows the statistics of the time offset of the proposed algorithm. The pie chart illustrates the proportion of time offset obtained from simulations under various sending delays and receiving delays. To ensure the robustness of the experimental results, we conducted multiple sets of experiments. The red box in Fig. 10. indicates that when the delay of the sending and receiving nodes increase, the proportion of ≤ ± 1 clock cycle gradually decreases while the proportion of > 1 clock cycle gradually increases, so that the delay uncertainty is increased and the time offset is extended. The green box in Fig. 10 represents the result of two simulation experiment, in which the sending delay is exactly opposite to the receiving delay. The results show that in terms of amplifying the master–slave clock time offset, the sending node delay plays a key role in the time synchronization precision compared with the receiving node delay. Therefore, the time synchronization of the proposed algorithm can be achieved in the range of ± 37.5 ns.
The comparison results of the time synchronization precision of various algorithm are given in Table 7. The time synchronization precision of the PTP algorithm is about 1 μs, the time synchronization precision described in Ref.19,20,21 basically reaches the microsecond level, and the time synchronization precision of the algorithms proposed in Ref.24 (i.e., the Kalman filter (KF), Sage-Husa adaptive Kalman filter (AKF), strong tracking Sage-Husa adaptive Kalman filter (STAKF) and the modified Strong Tracking Adaptive Kalman Filter (MSTAKF) algorithms) is microsecond level. For the proposed algorithm, its time synchronization precision is much smaller than that of other algorithms, thus efficiently improving its performance.
Figure 11 gives the comparison results of the required time of the stable state of various algorithms. It can be seen that the PTP and PI control algorithms require about 155 ms (indicated by the red circle) to achieve the stable state while the proposed algorithm requires 883 ms (indicated by the green circle) due to the inclusion of the Kalman filtering algorithm. Therefore, future work will focus on reducing the time it takes for the proposed algorithm to reach a stable state.
This paper first conducts simulation experiments on the original PTP algorithm and the algorithm proposed in this paper based on symmetric links and asymmetric links. The results show that when the crystal frequency is 80 MHz, the proposed method successfully reduces the time offset from several microseconds to less than 40 ns. Then, we conducted a detailed analysis of the algorithm proposed in this paper from the aspects of crystal oscillator frequency, sending interval, sending delay, receiving delay and the time required to reach a stable state. The study found that when the crystal frequency is 80 MHz and the sending interval is 15.625 ms, the time synchronization accuracy achieved by the network has far exceeded the time synchronization precision requirements of current market demand. If higher precision is required, you can consider increasing the crystal oscillator frequency and stability to further improve the network's time synchronization precision.
Conclusion
This paper proposes a novel underlying protocol and an enhanced time synchronization algorithm to meet the time-sensitive requirements of the measurement and control system, in which the data frame structure is redesigned, the Kalman filtering model is used to eliminate noise interference, and the clock drift compensation algorithm is used to prevent the accumulated errors. The time synchronization algorithm proposed in this paper offers simplicity in implementation. The integration of the Kalman filter algorithm with the clock drift compensation algorithm renders it universally applicable across all network topology, promising significant efficacy. The simulation results have proved that the proposed algorithm has a better time synchronization precision, compared with the PTP and the improved PTP (based on the Kalman filtering) algorithms. Therefore, this algorithm provides a good choice for improving the time synchronization accuracy in measurement and control systems.
Data availability
Data will be made available on request. If you would like the research data for this paper, please don’t hesitate to contact me at the address below. The code and data sets are available at: https://ptp-sim.github.io. E-mail: Qiang Li b20210620@st.nuc.edu.cn.
Code availability
The code and data sets are available at: https://ptp-sim.github.io.
References
Ferrarini, S. et al. A method for the assessment and compensation of positioning errors in industrial robots. Robot. Comput.-Integr. Manuf. 85, 102622. https://doi.org/10.1016/j.rcim.2023.102622 (2024).
Khan, M. A. et al. Swarm of UAVs for network management in 6G: A technical review. IEEE Trans. Netw. Serv. Manag. 20(1), 741–761. https://doi.org/10.1109/TNSM.2022.3213370 (2023).
Hazra, A. et al. Cooperative transmission scheduling and computation offloading with collaboration of fog and cloud for industrial IoT applications. IEEE Internet Things J. 10(5), 3944–3953. https://doi.org/10.1109/jiot.2022.3150070 (2022).
Idrees, Z. et al. IEEE 1588 for clock synchronization in industrial IoT and related applications: A review on contributing technologies, protocols and enhancement methodologies. IEEE Access https://doi.org/10.1109/ACCESS.2020.3013669 (2020).
Guo, H. & Crossley, P. A. Design of a time synchronization system based on GPS and IEEE 1588 for transmission substations. IEEE Trans. Power Deliv. 32, 2091–2100. https://doi.org/10.1109/TPWRD.2016.2600759 (2017).
D, M. & Martin, J. J. Network Time Protocol Version 4: Protocol and Algorithms Specification. (RCF, 2021).
Eidson, J. C., Lee, K. IEEE 1588 standard for a precision clock synchronization protocol for networked measurement and control systems. 98–105. https://doi.org/10.1109/sficon.2002.1159815 (2002)
Hou, T. C. et al. An improved network time protocol for industrial internet of things. Sensors 22(13), 5021. https://doi.org/10.3390/s22135021 (2022).
Zhang, J. & Zhang, W. A disturbance rejection control approach for clock synchronization in IEEE 1588 networks. J. Syst. Sci. Complex. 31(6), 1437–1448. https://doi.org/10.1007/s11424-018-7050-y (2018).
Exel, R. Mitigation of asymmetric link delays in IEEE 1588 clock synchronization systems. IEEE Commun. Lett. 18(3), 507–510. https://doi.org/10.1109/LCOMM.2014.012214.132540 (2014).
Lv, S., Lu, Y. & Ji, Y. An enhanced IEEE 1588 time synchronization for asymmetric communication link in packet transport network. IEEE Commun. Lett. 14(8), 764–766. https://doi.org/10.1109/LCOMM.2010.08.091601 (2010).
Giorgi, G. & Narduzzi, C. Precision packet-based frequency transfer based on oversampling. IEEE Trans. Instr. Meas. 66, 1856–1863. https://doi.org/10.1109/TIM.2017.2672478 (2017).
Yuan, K., Guo, X. & Tian, J. Research and implementation of clock synchronization technology based on PTP. J. Phys. 1757, 012139–012139. https://doi.org/10.1088/1742-6596/1757/1/012139 (2021).
Karthik, A. K. & Blum, R. S. Robust clock skew and offset estimation for IEEE 1588 in the presence of unexpected deterministic path delay asymmetries. IEEE Trans. Commun. 68, 5102–5119. https://doi.org/10.1109/TCOMM.2020.2991212 (2020).
Shrestha, D., Pang, Z. & Dzung, D. Precise clock synchronization in high performance wireless communication for time sensitive networking. IEEE Access 6, 8944–8953. https://doi.org/10.1109/ACCESS.2018.2805378 (2018).
Ju, R. et al. Research on IEEE 1588 clock synchronization error correction algorithm based on Kalman filter. J. Phys. Conf. Ser. 1449, 012109. https://doi.org/10.1088/1742-6596/1449/1/012109 (2020).
Zuo, Y., Wang, X. & Zhang, B. An optimization method of clock synchronization for large-scale regional power network based on IEEE 1588. J. Phys. 2108, 012063–012063. https://doi.org/10.1088/1742-6596/2108/1/012063 (2021).
Zheng, K. & Zhang, L. One study on IEEE1588 clock synchronization algorithm based on Kalman filter. J. Phys. Conf. Ser. 1738, 012059. https://doi.org/10.1088/1742-6596/1738/1/012059 (2021).
Liu, X. & Li, C. Research based on IEEE1588 frequency compensation algorithm. IOP Conf. Ser. Mater. Sci. Eng. 677, 032042. https://doi.org/10.1088/1757-899X/677/3/032042 (2019).
Zhang, W. & Hou, Y. A modified strong tracking adaptive kalman filter for precision clock synchronization system. IEEJ Trans. Electr. Electron. Eng. 18, 1702–1711. https://doi.org/10.1002/tee.23900 (2023).
Exel, R., Bigler, T. & Sauter, T. Asymmetry mitigation in IEEE 802.3 ethernet for high-accuracy clock synchronization. IEEE Trans. Instr. Meas. 63, 729–736. https://doi.org/10.1109/TIM.2013.2280489 (2014).
Yin, H., Fu, P., Qiao, J. & Li, Y. The Implementation of IEEE 1588 Clock Synchronization Protocol Based on FPGA. In: 2018 IEEE International Instrumentation and Measurement Technology Conference (I2MTC) https://doi.org/10.1109/i2mtc.2018.8409617 (2018).
Pedretti, D. et al. Nanoseconds timing system based on IEEE 1588 FPGA implementation. IEEE Trans. Nuclear Sci. 66, 1151–1158. https://doi.org/10.1109/TNS.2019.2906045 (2019).
Nagra, A. S., Allahi, I., Pasha, M. A. & Masud, S. Design and FPGA based implementation of IEEE 1588 precision time protocol for synchronisation in distributed IoT applications. Austr. J. Electr. Electron. Eng. 19, 31–39. https://doi.org/10.1080/1448837X.2021.2013407 (2021).
Eidson, J. C., Fischer, M. & White, J. IEEE 1588 Standard for a Precision Clock Synchronization Protocol for Networked Measurement and Control Systems. In: 2nd ISA/IEEE Sensors for Industry Conference 98–105. https://doi.org/10.1109/sficon.2002.1159815 (2002).
Moussa, B. et al. An extension to the precision time protocol (PTP) to enable the detection of cyber attacks. IEEE Trans. Ind. Inform. 16, 18–27. https://doi.org/10.1109/TII.2019.2943913 (2020).
Khan, M. A. & Hayes, B. P. IEEE 1588 time synchronization in power distribution system applications: Timestamping and accuracy requirements. IEEE Syst. J. 17, 2007–2017. https://doi.org/10.1109/JSYST.2023.3269920 (2023).
Lan, Y.-K., Chen, Y.-S., Hou, T.-C., Wu, B.-L. & Chu, Y.-S. Development board implementation and chip design of IEEE 1588 clock synchronization system applied to computer networking. Electronics 12, 2166–2166. https://doi.org/10.3390/electronics12102166 (2023).
Xu, X., Xiong, Z., Sheng, X., Wu, J. & Zhu, X. A new time synchronization method for reducing quantization error accumulation over real-time networks: Theory and experiments. IEEE Trans. Ind. Inform. 9, 1659–1669. https://doi.org/10.1109/TII.2013.2238547 (2013).
Han, W., Shen, X., Hou, E. & Xu, J. Precision time synchronization control method for smart grid based on wolf colony algorithm. Int. J. Electr. Power Energy Syst. 78, 816–822. https://doi.org/10.1016/j.ijepes.2015.12.016 (2016).
Ha, Y.-M., Pak, E., Park, J., Kim, T. & Yoon, J. W. Clock offset estimation for systems with asymmetric packet delays. IEEE ACM Trans. Netw. 31, 1838–1853. https://doi.org/10.1109/TNET.2022.3229407 (2023).
Li, F., Liu, W., Gao, W., Liu, Y. & Hu, Y. Design and reliability analysis of a novel redundancy topology architecture. Sensors 22, 2582. https://doi.org/10.3390/s22072582 (2022).
Li, F., Liu, W., Qi, Y., Li, Q. & Liu, G. An enhanced method for nanosecond time synchronization in IEEE 1588 precision time protocol. Processes 11, 1328–1328. https://doi.org/10.3390/pr11051328 (2023).
IEEE Standard for a Precision Clock Synchronization Protocol for Networked Measurement and Control Systems—Redline. (IEEE, 2017).
Giorgi, G. & Narduzzi, C. Performance analysis of Kalman-filter-based clock synchronization in IEEE 1588 networks. IEEE Trans. Instr. Meas. 60, 2902–2909. https://doi.org/10.1109/TIM.2011.2113120 (2011).
Kalman, R. E. & Bucy, R. S. New results in linear filtering and prediction theory. J. Basic Eng. 83, 95–108. https://doi.org/10.1115/1.3658902 (1961).
Luo, Z., Shi, D., Shen, X., Ji, J. & Gan, W.-S. GFANC-Kalman: Generative fixed-filter active noise control with CNN-Kalman filtering. IEEE Signal Process. Lett. 31, 276–280. https://doi.org/10.1109/LSP.2023.3334695 (2024).
Basha, F. J. & Somasundaram, K. Rotor asymmetry detection in wound rotor induction motor using kalman filter variants and investigations on their robustness: An experimental implementation. Machines 11, 910–910. https://doi.org/10.3390/machines11090910 (2023).
Wallner, W., Wasicek, A. and Grosu, R. A simulation framework for IEEE 1588. In 2016 IEEE International Symposium on Precision Clock Synchronization for Measurement, Control, and Communication (ISPCS) (pp. 1–6). https://doi.org/10.1109/ispcs.2016.7579516 (2016).
Kasdin, N.J. and Walter, T. Discrete simulation of power law noise (for oscillator stability evaluation). In: Proc. 1992 IEEE Frequency Control Symposium (pp. 274–283). https://doi.org/10.1109/FREQ.1992.270003 (2003).
Ferre-Pikal, E. S. & Vig, J. R. Draft revision of IEEE STD 1139–1988 standard definitions of physical quantities for fundamental frequency and time metrology—Random instabilities. Comput. Stand. Interfaces https://doi.org/10.1016/s0920-5489(99)92272-9 (1999).
N Jeremy Kasdin & Todd Walter. Discrete simulation of power law noise (for oscillator stability evaluation). In: Proc. 1992 IEEE Frequency Control Symposium. 274–283. https://doi.org/10.1109/FREQ.1992.270003 (1992).
ES Ferre-Pikal, JR Vig, JC Camparo, LS Cutler, L Maleki, WJ Riley, SR Stein, C Thomas, FL Walls, and JD White, Draft revision of IEEE STD 1139–1988 standard definitions of physical quantities for fundamental, frequency and time metrology-random instabilities. In: Proc. International Frequency Control Symposium. 338–357. https://doi.org/10.1109/FREQ.1997.638567 (1987).
The LibPLN library download link: https://github.com/ptp-sim/libPLN.
Acknowledgements
This work was supported by the Innovative Research Group Project of the National Science Foundation of China, China (51821003), the National Science Foundation of Shanxi Province, China (201701D121065), Scientific and Technological Innovation Programs of Higher Education Institutions in Shanxi Province (2022L530) and Fundamental Research Program of Shanxi Province (20210302124329), the Youth Fundation Project of Shanxi Provincial Basic Research Program of China, China (202303021222097).
Author information
Authors and Affiliations
Contributions
Q.L. wrote the main manuscript text. J.G. and WY.L. methodology and Writing—review & editing. WJ.G., YZ. Z., and YJ.H. data curation and prepared the figures. All authors reviewed the manuscript.
Corresponding author
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Publisher's note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
About this article
Cite this article
Li, Q., Guo, J., Liu, W. et al. An enhanced time synchronization method for a network based on Kalman filtering. Sci Rep 14, 21271 (2024). https://doi.org/10.1038/s41598-024-71929-8
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41598-024-71929-8
Keywords
Comments
By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.