Technical Principle and Analysis of PTP Precision Clock Synchronization Server

PTP precision clock synchronization server technology principle and analysis
PTP precision clock synchronization server technology principle and analysis

1. Introduction

  Ethernet technology has been widely used in telecom-level networks due to its openness, low price and convenient use. The data transmission speed of Ethernet has also increased from the early 10M to 100M, GE, 10GE, 40GE, 100GE officially The product was also launched in 2009.

  The Ethernet technology is "plug and play", that is, the service provided by it can be used at any time by connecting the Ethernet terminal to the IP network. However, only a "synchronized" IP network is a true carrier-class network, and it can provide guarantee for the multi-play service of various real-time services and data services transmitted by the IP network. At present, carrier-class networks have very strict requirements for time synchronization. For a nationwide IP network, the backbone network delay is generally required to be controlled within 50ms. The current Internet network time protocol NTP (Network Time Protocol), simple network time Protocols such as SNTP (Simple Network Time Protocol) cannot achieve the required synchronization accuracy or convergence speed. As a transition technology, the Ethernet-based TDM over Ethernet has a certain concept of Ethernet clock synchronization, which can partially solve the problem of seamless connection of existing terminal equipment for Ethernet. The IEEE 1588 standard is particularly suitable for Ethernet, which can realize microsecond-level high-precision clock synchronization in a geographically dispersed IP network. This article focuses on the IEEE 1588 technology and its test implementation.

2. Introduction to IEEE1588PTP

  The IEEE1588PTP protocol draws on the NTP technology and has the characteristics of easy configuration, fast convergence, and low consumption of network bandwidth and resources. The full name of the IEEE 1588 standard is "IEEE 1588 Precision Clock Synchronization Protocol for network measurement and control systems (IEEE 1588 Precision Clock Synchronization Protocol)", referred to as PTP (Precision Timing Protocol). Its main principle is to periodically connect to the network through a synchronization signal. The clocks of all nodes are calibrated and synchronized to enable accurate synchronization of Ethernet-based distributed systems. The IEEE 1588PTP clock synchronization technology can also be applied to any multicast network.

  IEEE 1588 divides the clocks in the entire network into two types, namely Ordinary Clock (OC) and Boundary Clock (BC). The clock with only one PTP communication port is an ordinary clock, and those with more than one PTP communication port The clock is a boundary clock, and each PTP port provides independent PTP communication. Among them, boundary clocks are usually used on network devices with poor certainty (such as switches and routers). From the communication relationship, the clock can be divided into a master clock and a slave clock. In theory, any clock can realize the functions of a master clock and a slave clock, but there can only be one master clock in a PTP communication subnet. The optimal clock in the entire system is the highest clock GMC (Grandmaster Clock), which has the best stability, accuracy, and certainty. According to the accuracy and level of the clock on each node and the traceability of UTC (Universal Coordinated Time), the best master clock algorithm (Best Master Clock) automatically selects the master clock in each subnet; there is only one subnet In the system, the master clock is the highest-level clock GMC. Each system has only one GMC, and each subnet has only one master clock, and the slave clock is synchronized with the master clock. Figure 1 shows a typical diagram of the relationship between the master clock and the slave clock.   The basic principle of the
Technical Principle and Analysis of PTP Precision Clock Synchronization Server
master-slave clock relationship diagram
   synchronization includes the recording of time sending and receiving time information, and adding a "time stamp" to each piece of information. With the time record, the receiving end can calculate its own clock error and delay in the network. In order to manage this information, the PTP protocol defines four multicast message types and management messages, including synchronization messages (Sync), follow messages (Follow_up), delay request messages (Delay_Req), and delay response messages (Delay_Resp). The interaction sequence of these messages is shown in Figure 2. The information response received is related to the current state of the clock. The synchronization message is periodically sent from the master clock (usually once every two seconds), and it contains the clock attributes required by the master clock algorithm. In general, the synchronization message contains a timestamp, which accurately describes the estimated time when the data packet is sent.
Technical Principle and Analysis of PTP Precision Clock Synchronization Server
PTP message and exchange sequence
  Since the synchronization message contains the estimated sending time instead of the actual sending time, the real sending time of the Sync message is measured and sent in the subsequent Follow_Up message. The receiver of the Sync message records the actual receiving time. Using the real sending time of the Follow_Up message and the real receiving time of the receiver, the time difference between the slave clock and the master clock can be calculated, and the time of the slave clock can be corrected accordingly. But the time difference calculated at this time includes the delay caused by network transmission, so the Delay_Req message is used to define the network transmission delay.

  The Delay_Req message is sent by the slave clock after the Sync message is received. Like the Sync message, the sender records the accurate sending time, and the receiver records the accurate receiving time. The accurate receiving time is included in the Delay_Resp message, so as to calculate the network delay and clock error. The accuracy of synchronization is closely related to the time stamp and time information. The pure software solution can achieve millisecond accuracy, and the software and hardware combination solution can achieve microsecond accuracy. The PTP protocol is based on the most accurate matching time when a synchronous data packet is transmitted and received. Each slave clock is synchronized with the master clock by exchanging synchronization messages with the master clock. This synchronization process is divided into drift measurement phase and offset measurement and delay measurement phase.

The first stage is to correct the time deviation between the master clock and the slave clock, which is called drift measurement. As shown in Figure 3, in the process of correcting the drift, the master clock periodically sends out a unique synchronization message to the corresponding slave clock at a defined interval time (the default is 2s). This synchronization message includes the estimated time of the message leaving the master clock. The master clock measures the passed accurate time T0 K, and the slave clock measures the received accurate time T1 K. After that, the master clock sends a second message—Follow_up Message, which is associated with the synchronization message and contains a more accurate estimate of the synchronization message on the PTP communication path. In this way, the measurement of delivery and reception can be separated from the propagation of standard time stamps. The slave clock calculates the offset according to the information in the synchronization message and the following message, and then corrects the time of the slave clock according to this offset. If there is no delay in the transmission path, the two clocks will be synchronized.

  The slave clock sends a "delay request" data message to the master clock. In this process, it is determined that the message is delivered with the accurate time T2. The master clock timestamps the received data packet, and then sends the received time stamp B back to the slave clock in the "delayed response" data packet. According to the transfer time stamp B and the reception time stamp D provided by the master clock, the slave clock calculates the delay time with the master clock. Different from the offset measurement, the delay measurement is carried out irregularly, and the measurement interval (the default value is a random value between 4~60s) is larger than the offset measurement interval. In this way, the load on the network, especially the equipment terminal, will not be too large. Using this synchronization process can reduce the time fluctuations in the PTP protocol stack and the waiting time between the master and slave clocks. From the right side of Figure 4, you can see the calculation method of the delay time D and the offset time value O.

  The current version of IEEE 1588 is v2.2, which is mainly used in relatively localized and networked systems. The internal components are relatively stable. Its advantage is that the standard is very representative and open. Because of its openness, it is especially suitable for the Ethernet network environment. Compared with other synchronization protocols commonly used in Ethernet TCP/IP networks such as SNTP or NTP, the main difference is that PTP is designed for a more stable and secure network environment, so it is simpler and occupies less network and computing resources. . The NTP protocol is a time synchronization protocol for various independent systems widely dispersed on the Internet. GPS (satellite-based global positioning system) is also aimed at dispersed and independent systems. The network structure defined by PTP can achieve high accuracy by itself. Contrary to SNTP and NTP, the time stamp is easier to implement on hardware and is not limited to the application layer. This allows PTP to achieve accuracy within microseconds. In addition, the modular design of PTP also makes it easy to adapt to low-end equipment.

  The precise network synchronization protocol defined by the IEEE1588 standard achieves a high degree of synchronization in the network, so that special synchronous communication is no longer required when assigning control work, thereby achieving the effect of separating the communication time mode from the application execution time mode.

  Due to the high-precision synchronization work, the inherent data transmission time fluctuation of the Ethernet technology is reduced to an acceptable level without affecting the control accuracy.

Guess you like

Origin blog.51cto.com/14615027/2539666