WO2015024250A1 - 一种跨非1588网络传输精密时钟报文的方法及系统 - Google Patents

一种跨非1588网络传输精密时钟报文的方法及系统 Download PDF

Info

Publication number
WO2015024250A1
WO2015024250A1 PCT/CN2013/082176 CN2013082176W WO2015024250A1 WO 2015024250 A1 WO2015024250 A1 WO 2015024250A1 CN 2013082176 W CN2013082176 W CN 2013082176W WO 2015024250 A1 WO2015024250 A1 WO 2015024250A1
Authority
WO
WIPO (PCT)
Prior art keywords
clock
delay
time information
message
master clock
Prior art date
Application number
PCT/CN2013/082176
Other languages
English (en)
French (fr)
Inventor
孔勇
马化一
Original Assignee
北京东土科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京东土科技股份有限公司 filed Critical 北京东土科技股份有限公司
Priority to PCT/CN2013/082176 priority Critical patent/WO2015024250A1/zh
Publication of WO2015024250A1 publication Critical patent/WO2015024250A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0667Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/28Flow control; Congestion control in relation to timing considerations
    • H04L47/283Flow control; Congestion control in relation to timing considerations in response to processing delays, e.g. caused by jitter or round trip time [RTT]

Definitions

  • the present invention relates to the field of industrial Ethernet technologies, and in particular, to a method and system for transmitting a precision clock message across a non-1588 network.
  • Precise Time Clock Protocol PTP
  • the Precise Time Clock Protocol is defined in the IEEE 1588 standard, which uses time stamps to synchronize clocks.
  • the synchronization control signal may fluctuate during network communication, but the accuracy achieved by this method can make the protocol suitable for Ethernet systems.
  • a high-precision clock synchronization mechanism can be operated by using the protocol Ethernet, TCP/IP protocol, and various Ethernet-based fieldbuses without major modifications.
  • the system based on the ⁇ protocol is composed of one or more scorpion domain systems, each of which includes one or more clocks that communicate with each other.
  • a single sub-domain system includes a master clock and multiple slave clocks. When there are multiple master clocks, a master clock can be determined by election.
  • Figure 1 is a schematic diagram of synchronization of the master and slave clocks of the IEEE 1588 protocol.
  • the master clock can time the slave clock to maintain accurate synchronization between the master clock and the slave clock.
  • FIG. 2 is a schematic structural diagram of clock synchronization from a clock that traverses a non-IEEE1588-based switch (a switch other than the 1588 protocol).
  • a non-IEEE1588-based switch a switch other than the 1588 protocol.
  • switches that are not based on the IEEE1588 protocol. It works based on queues and store/forward mechanisms, so one of the longest packets in the queue may bring a 122us delay to subsequent packets, while in heavy load, the packets in the queue are random and may include more than A long packet.
  • the accuracy of clock synchronization based on PTP protocol depends on the two-way fully symmetric delay, but in the case of large load, the data packets in the queue are random, and the probability of clock synchronization messages queuing as the network traffic increases It is also getting bigger and bigger, and complete symmetry is almost impossible.
  • Embodiments of the present invention provide a method and system for transmitting a precision clock message across a non-1588 network, which is used to solve the problem of clock synchronization between a master switch and a slave switch that traverse a non-IEEE1588-based switch.
  • An embodiment of the present invention provides a method for transmitting a precision clock message across a non-1588 network, where the method includes:
  • the master clock sends multiple Sync packets to the slave clock according to the set time interval.
  • N is an integer greater than one
  • each Sync message sent by the master clock receives, from the clock, each Sync message sent by the master clock, recording the receiving time information T21, ⁇ 22 ⁇ 2 ⁇ of each Sync message, and receiving the first Sync message sent by the master clock from the clock. And sending, according to the set time interval, a plurality of Delay-Res, S1, and S2 SNs to the primary clock, where each Delay-Req packet includes the sending time information T31 and ⁇ 32 of the Delay-Req packet. ⁇ 3 ⁇ ;
  • the master clock records the reception time information T41, ⁇ 42 ⁇ 4 ⁇ of each Delay-Req message received for each Delay-Req message received, and sends multiple Delays to the slave clock according to the set time interval.
  • the slave clock determines the first delay from the master clock to the slave clock according to each of the transmission time information T1 l, T12 TIN and the corresponding reception time information ⁇ 21, ⁇ 22 ⁇ 2 ⁇ , and according to each transmission time information ⁇ 31,
  • the slave clock is based on each transmission time Ti l, T12 TIN and corresponding reception time information T21,
  • the compensation value determines the frequency compensation value of the master clock and the slave clock according to the first frequency compensation value and the second frequency compensation value, and performs frequency synchronization.
  • the master clock includes an FPGA chip, and the master clock receives each Delay-Re ⁇ message, records the receiving time information T4 i , and immediately forwards the Delay-Resp message Si, wherein the Delay-Resp message
  • the transmission time information T5 i included in the text is equal to T4 i.
  • the method further includes:
  • the master clock stops. Synchronizing with the clock between the slave clocks, and re-performing the slave clock with step A and subsequent steps, wherein the clock of the master clock itself changes, the master clock receives the GPS or completes with the other Clock synchronization operation of the high-level master clock.
  • the determining the first time delay from the master clock to the slave clock comprises:
  • determining a second delay from the clock to the master clock includes:
  • the minimum value of the second delay to be selected is selected as the second delay from the clock to the master clock.
  • the determining the first frequency compensation value of the master clock to the slave clock comprises:
  • determining the second frequency compensation value from the clock to the main clock includes:
  • An embodiment of the present invention provides a system for transmitting a precision clock message across a non-1588 network, where the system includes: a main clock, configured to send multiple Syncs to a slave clock according to a set time interval in each clock synchronization period.
  • each Delay-Resp packet includes a transmission time information of the Delay-Resp packet, T51,
  • is an integer greater than 1;
  • the slave clock is used for receiving each Sync message sent by the master clock, and records the receiving time information T21, ⁇ 22 ⁇ 2 ⁇ of each Sync message, and the slave clock receives the first Sync message sent by the master clock. And sending, according to the set time interval, a plurality of Delay-Res, S1 and S2 SNs to the master clock, where each Delay-Req message includes the sending time information T31, ⁇ 32 ⁇ 3 ⁇ of the Delay-Req message. Receiving each Delay-Resp message sent by the master clock, and recording the receiving time information T61, T62 T6N of each Delay-Resp message; According to each transmission time information T1 l, T12 TIN and corresponding reception time information ⁇ 21, ⁇ 22
  • ⁇ 2 ⁇ determining a first delay from the master clock to the slave clock, and determining a second delay from the clock to the master clock according to each of the transmission time information ⁇ 31, ⁇ 32 ⁇ 3 ⁇ and each corresponding reception time information ⁇ 41, ⁇ 42 ⁇ 4 ⁇ , Determining the link delay and performing time synchronization according to the first delay and the second delay; determining the master clock to the slave according to each of the transmission times T11, T12 TIN and each corresponding reception time information ⁇ 21, ⁇ 22 ⁇ 2 ⁇ Determining a first frequency compensation value of the clock, and determining a second frequency compensation value of the master clock to the slave clock according to each of the transmission time information ⁇ 51, ⁇ 52 ⁇ 5 ⁇ and each corresponding reception time information ⁇ 61, ⁇ 62 ⁇ 6 ⁇ , according to the first The frequency compensation value and the second frequency compensation value determine the frequency compensation value of the master clock and the slave clock and perform frequency synchronization.
  • the master clock is specifically configured to include an FPGA chip, receives each Delay-Req message, records the receiving time information T4 i , and immediately forwards the Delay-Resp message Si, where the Delay-Resp message
  • the transmission time information T 5 i included in it is equal to T 4 i, and i is an integer between 1 and N.
  • the master clock is further configured to stop a clock synchronization operation with the slave clock when the clock is changed within the current clock synchronization period, and restart the clock with the slave clock.
  • a synchronous operation, wherein the clock of the master clock itself changes comprises: the master clock receiving the GPS or completing a clock synchronization operation with other higher-level master clocks.
  • the slave clock is specifically configured to determine, according to the difference between each of the reception time information T21, ⁇ 22 ⁇ 2 ⁇ and the corresponding transmission time information T1 l, T12 TIN, each candidate clock to the slave clock is determined. a delay; selecting the minimum value of the first delay to be selected as the first delay from the master clock to the slave clock; and the difference between each of the reception time information T41, ⁇ 42 ⁇ 4 ⁇ and the corresponding transmission time information ⁇ 31, ⁇ 32 ⁇ 3 ⁇ Determining each candidate second delay from the clock to the master clock; selecting the minimum value of the second delay to be selected as the second delay from the clock to the master clock.
  • the slave clock is specifically configured to determine, according to the difference between each receiving time information ⁇ 21, ⁇ 22 ⁇ 2 ⁇ and each corresponding transmission time information T1 l, T12 TIN, each candidate clock to the slave clock is determined. a delay time; selecting a Sync message S i corresponding to the minimum value of the first delay to be selected, extracting the transmission time information Tl i and the reception time information T2 i of the Sync message S i , and determining the first frequency compensation value; According to each receiving time information T61, ⁇ 62
  • the embodiment of the invention provides a method and system for transmitting a precision clock message across a non-1588 network, the method comprising: transmitting a plurality of Syn messages containing each first transmission time information from a clock receiving master clock, and determining each The first receiving time information, sending, to the master clock, a plurality of Delay-Req messages containing each second sending time information, and receiving a corresponding plurality of Delay-Res containing each second receiving time information returned by the main clock Sp message, according to the above receiving time and Send time, determine link delay and clock synchronization.
  • FIG. 1 is a schematic diagram of synchronization of a master and slave clock of a switch based on the I EEE 1588 protocol;
  • FIG. 2 is a schematic structural diagram of clock synchronization of a switch that traverses a non-EEE 1588-based switch from a switch;
  • FIG. 3 is a schematic diagram of a process for transmitting a precision clock across a non-1588 network according to an embodiment of the present invention;
  • FIG. 5 is a schematic diagram of a specific process for transmitting a precision clock message across a non-1588 network according to an embodiment of the present invention
  • FIG. 6 is a schematic structural diagram of a system for transmitting a precision clock across a non-1588 network according to an embodiment of the present invention
  • DETAILED DESCRIPTION OF THE INVENTION The present invention provides a method and system for transmitting precise clock messages across non-1588 networks in order to improve clock alignment when a master and slave switch traverse a non-IEEE1588-based switch for clock synchronization.
  • FIG. 3 is a schematic diagram of a process for transmitting a precision clock message across a non-1588 network according to an embodiment of the present invention, where the process includes the following steps:
  • S301 The master clock sends multiple Sync messages S1 and S2 SN to the slave clock according to the set time interval in each clock synchronization period, where each Sync message contains the transmission time information Tl l of the Sync message. , T12
  • TIN, N is an integer greater than 1.
  • the clock synchronization is performed by using a one-step method, wherein each clock synchronization period refers to completing one round of Sync, Delay-Re ⁇ , and Delay- between the master clock and the slave clock. After the interaction of the Resp ⁇ message, the process of synchronizing the time and frequency of the master clock with the slave clock is completed.
  • the master clock in order to effectively reduce the problem of low precision caused by the time-lapse of the switch that is not based on the I EEE 1588 protocol, the master clock sends multiple Sync messages to the slave clock, for example, 512. , or 128, or 1000, etc. And the master clock sends a Sync message to each slave clock, and the transmission time information (Tl l, T12 TIN ) of the Sync message is carried in the Sync message, so that the slave clock is accurately aligned.
  • Tl l, T12 TIN transmission time information
  • the slave clock receives each Sync message sent by the master clock, records the receiving time information T21, ⁇ 22 ⁇ 2 ⁇ of each Sync message, and the slave clock receives the first Sync message sent by the master clock.
  • the time interval is sent to the master clock to send a plurality of corresponding Delay-Res messages, SI, S2 SN, wherein each Delay-Req message includes the transmission time information T31, ⁇ 32 ⁇ 3 ⁇ of the Delay-Req message.
  • the plurality of Sync messages containing each transmission time information traverse the non-IEEE1588-based switch to reach the slave clock, and the slave clock determines each time corresponding to each Sync message according to the time of receiving each Sync message.
  • Receive time information (T21, ⁇ 22, ..., ⁇ 2 ⁇ ).
  • the reception time information corresponding to the Sync message is B.
  • the slave clock When receiving a plurality of Sync messages sent by the master clock from the clock, in response to the master clock, the slave clock sends a corresponding plurality of Delay-Res to the master clock. Moreover, in the embodiment of the present invention, when a Sync message sent by the master clock is received from the clock, a delay time information including the Delay-Re ⁇ message is sent back to the master clock (T31,
  • Delay-Re ⁇ text ⁇ 32 ⁇ 3 ⁇
  • Delay-Re ⁇ text ⁇ 32 ⁇ 3 ⁇
  • the time of sending the Delay-Req message T3K T32 T3N
  • a Delay-Req message in which the number of packets set is the same as the number of sent Sync messages set by the master clock.
  • the master clock records the reception time information T41, ⁇ 42 ⁇ 4 ⁇ received by each Delay-Re ⁇ message for each Delay-Re ⁇ message received, and sends the slave clock to the slave according to the set time interval.
  • each Delay-Resp ⁇ message contains the transmission time information of Delay-Resp ⁇
  • the master clock After the master clock receives each Delay-Req message that is sent from the clock and contains the information about the sending time of the Delay-Re ⁇ message, it determines the time information of each Delay-Req message received, and each time is received. Information is determined for each of
  • the receiving time information of the Delay-Req message (T41, ⁇ 42 ⁇ 4 ⁇ ), and the receiving time information of each Delay-Req message is included in each corresponding Delay-Resp message and sent to the slave clock, where Each Delay-Re sp message also includes a sending time information (T5K T52 T5N ) of the Delay-Resp message sent by the master clock.
  • the slave clock receives each Delay-Resp message sent by the master clock, and records the receiving time information T61, ⁇ 62 ⁇ 6 ⁇ of each Delay-Resp message.
  • the slave clock determines a first delay from the master clock to the slave clock according to each of the transmission time information Til, T12 TIN and corresponding reception time information T21, ⁇ 22 ⁇ 2 ⁇ , and according to each transmission time information.
  • ⁇ 31, ⁇ 32 ⁇ 3 ⁇ and corresponding reception time information ⁇ 41, ⁇ 42 ⁇ 4 ⁇ determine from clock to main
  • the second delay of the clock determines the link delay and performs time synchronization according to the first delay and the second delay.
  • the slave clock can determine, according to each Sync message exchanged with the master clock, the transmission time information T1 l, ⁇ 12, . . . , TIN of each Sync message and each corresponding reception time information ⁇ 21, ⁇ 22 , ..., ⁇ 2 ⁇ , so that each candidate first delay of the link from the master clock to the slave clock can be determined, after which the slave clock can also be included according to the Delay-Req message exchanged with the master clock.
  • the transmission time information ⁇ 31, ⁇ 32 ⁇ 3 ⁇ , and the reception time information T41, ⁇ 42 ⁇ 4 ⁇ corresponding to the Delay-Req message included in the Delay-Resp message determine each candidate second delay of the link from the clock to the master clock.
  • one of the first delays to be selected may be arbitrarily selected as the first delay, or may be selected in the first delay to be selected.
  • a minimum value is selected as the first delay, or the average value of each candidate first delay is also used as the first delay, and the corresponding method for determining the second delay is the same.
  • the link delay is determined and clock synchronization is performed.
  • the average delay of the link can be determined according to the first delay and the second delay, so that clock synchronization can be performed according to the average delay.
  • each candidate first delay When the minimum value of each candidate first delay is selected as the first delay, it can be considered that the clock synchronization does not wait in the queue when passing through the non-IEEE1588-based switch, and the switch does not currently send other reports.
  • the corresponding delay of the text can ensure the accuracy of the clock synchronization.
  • the slave clock is based on each transmission time Tl l, T12 TIN and corresponding reception time information ⁇ 21,
  • the slave clock determines, according to each Sync message exchanged with the master clock, the transmission time information T1 l, T12 TIN of each Sync message and each corresponding reception time information ⁇ 21, ⁇ 22 ⁇ 2 ⁇ , thereby determining Each candidate first delay of the link from the master clock to the slave clock, after which the slave clock determines the transmission time information of each Delay-Resp message according to each Delay-Resp message exchanged with the master clock.
  • each candidate third delay of the link from the master clock to the slave clock can be determined, when each candidate is determined
  • one of the first delays to be selected may be arbitrarily selected as the first delay, or one of the first delays to be selected may be selected as the first delay.
  • the average value of each candidate first delay may be used as the first delay, and the corresponding method for determining the third delay is the same.
  • the minimum value of each candidate first delay is selected as the first delay, it can be considered that the clock synchronization does not wait in the queue when passing through the non-IEEE1588-based switch, and the switch does not currently send other reports.
  • the corresponding delay of the text can ensure the accuracy of the clock synchronization.
  • each clock synchronization message is sent multiple times, even if the switch not based on the IEEE1588 protocol is based on queue and storage/forwarding.
  • Mechanism but when multiple clock synchronization packets are not queued on the egress port of the switch, there will always be packets that are not stored/forwarded, which can effectively reduce the jitter of the delay and improve the accuracy of clock synchronization.
  • the clock synchronization packet when the master clock and the slave clock are clocked, the clock synchronization packet is to pass through the switch that is not based on the IEEE1588 protocol. If the clock synchronization packet is not queued at the sending port of the switch, The delay of the delay of the text forwarding is relatively small, and can be controlled within 200 ns. Therefore, in the embodiment of the present invention, a method of transmitting a large number of clock synchronizations is used to determine the link delay between the master and slave clocks.
  • clock synchronization is performed in a one-step method. Since each message is transmitted in plurality in the embodiment of the present invention, the number of each type of message transmitted by the master clock and the slave clock in each clock synchronization period can be set in advance. For example, for the main clock, it can send 128 to 2000 Sync messages per second. Specifically, the number of Syn messages sent in each clock synchronization period can be set. Similarly, the clock synchronization message sent from the clock. The quantity can also be set in advance. In order to ensure the accuracy of the clock synchronization, the sequence identification information may be carried in each packet, and the sequence identification information is added to each packet when the transmission port of the master and slave clocks is transmitting.
  • FIG. 4 is a schematic diagram of a clock synchronization process between a master clock and a slave clock according to an embodiment of the present invention. The clock synchronization process in the embodiment of the present invention will be described with reference to FIG. 4.
  • the master clock sends a corresponding number of multiple Sync messages (S1, S2 SN) according to the number of clock synchronization messages set by the master clock, and according to the Sync message, each Sync message is sent.
  • the sending time, each sending time information (Tl l, T12 TIN ) is included in the Sync message, and the sequence identification information is added to the Sync message according to the sending order of the Sync message.
  • the master clock can be sent at a fixed time interval or can be sent arbitrarily. As long as each Sync message contains the current time transmission time information and the sequence identification information.
  • the master clock sends 512 Sync messages, and the sequence identification information of each Sync message sent by the master clock to the slave clock can be pre-agreed.
  • the sequence identification information of the Sync message can start from 1. , until 512 identifies each Sync ⁇ message sent by the master clock.
  • the time information (T21, ⁇ 22 ⁇ 2 ⁇ ) of each Syn message can be recorded according to the time of receiving each Sync message. Since the sending time information and the sequence identification information are carried in each Syn message, the slave clock can distinguish the Sync message and determine the receiving time of each Sync message, thereby determining the receiving time information of each Sync message. .
  • the message in the Delay-Req message, includes sending time information (T31, ⁇ 32 ⁇ 3 ⁇ ) for transmitting the message.
  • sending a corresponding plurality of Delay-Req messages including the transmission time information ( ⁇ 31, ⁇ 32 ⁇ 3 ⁇ ) to the master clock includes:
  • the corresponding multiple Delay-Retext messages containing the transmission time information are sent to the master clock.
  • the slave clock can be moved to the master in order to improve the efficiency of clock synchronization.
  • the clock returns a corresponding plurality of Delay-Req messages containing each transmission time information (T31, ⁇ 32 ⁇ 3 ⁇ ), and does not need to receive each Syn message to perform transmission of each Delay-Re ⁇ message.
  • the plurality of Delay-Re messages when the plurality of Delay-Re messages are sent from the clock, they may also be sent at a fixed time interval, or may be arbitrarily transmitted, as long as the multiple Delay-Re ⁇ messages are guaranteed to be sent. can.
  • each of the Delay-Re ⁇ messages includes the transmission time information (T31, ⁇ 32 ⁇ 3 ⁇ ) of the currently transmitted message, and, for further identification
  • the order in which the Delay-Req message is sent may be carried in each Delay-Req message with the sequence identification information of the message.
  • the master clock sends 512 Sync messages, and the sequence identification of each De 1 ay-Re ⁇ message sent from the clock to the master clock can be pre-agreed, De 1 ay-
  • the sequence identification information of the Re ⁇ text can start from 1 until 512 identifies each De 1 ay-Re ⁇ message sent from the clock.
  • the master clock When the master clock receives each Delay-Re ⁇ message from the clock, it records the reception time information (T41, ⁇ 42 ⁇ 4 ⁇ ) of each Delay-Resp ⁇ message, and for each Delay-Re ⁇ received. In the text, the master clock returns the corresponding Delay-Resp ⁇ message to the slave clock, where each of the Delay-Resp ⁇ messages carries the master clock to receive the message.
  • the method for time stamping the hardware by the main clock includes:
  • the master clock includes an FPGA chip, and the master clock receives each Delay-Re ⁇ message, records the reception time information T4 i , and immediately forwards the Delay-Resp message S i , where the transmission included in the Delay-Resp message
  • the time information T5 i is equal to T4 i, and i is an integer between 1 and N.
  • the FPGA chip After the main clock receives each Delay-Re ⁇ message, the FPGA chip records the current time by directly time stamping, and then immediately replies to the Delay-Resp ⁇ message, because it is a timestamp method of hardware, therefore, The time for receiving the Delay-Req message is the same as the time for sending the Delay-Resp message, thus reducing the impact of a large number of Delay-Req messages on the main clock CPU.
  • the method is Also includes:
  • the master clock stops. Synchronizing with the clock between the slave clocks, and re-performing the slave clock with step A and subsequent steps, wherein the clock of the master clock itself changes, the master clock receives the GPS or completes with the other Clock synchronization operation of the high-level master clock.
  • the master clock adjusts the clock of the clock signal received by the GPS signal or other higher-level master clock, and when the clock of the master clock changes, the master clock stops between the current clock and the slave clock.
  • Clock synchronization operation that is, during the current clock synchronization period, when the master clock is sending the S i Sync messages to the slave clock, the master clock stops the next sequence number S i+1 after completing its own clock adjustment.
  • the Sync ⁇ message is sent, and the Sync message with the sequence number S1 is resent to start a new clock synchronization cycle, correspondingly when the master clock receives the Delay-Req message sent from the slave clock or the master clock sends the delay to the slave clock.
  • the method used is the same.
  • FIG. 5 is a schematic diagram of a specific process for transmitting a precision clock message across a non-1588 network according to an embodiment of the present invention, where the process includes the following steps:
  • the master clock sends the corresponding number of Sync messages to the slave clock according to the preset number of clock synchronization messages sent, and according to the sending time of each Sync message, in each Sync ⁇ message Contains the corresponding transmission time information Tlx.
  • step S502 The slave clock determines whether the first Sync message is received in the clock synchronization period. If the determination result is yes, the process proceeds to step S503. Otherwise, the process proceeds to step S502.
  • the slave clock sends a corresponding quantity of multiple Delay-Re ⁇ messages to the master clock according to the preset number of clock synchronization messages sent, and then sends the time of each Delay-Re ⁇ message.
  • Each Delay-Re ⁇ text contains corresponding transmission time information T 3y.
  • the slave clock determines, according to the time of receiving each Sync message, the reception time information T2x of receiving each Sync message.
  • the slave clock determines a first delay from the master clock to the slave clock based on each of the determined reception time information T2 i and the corresponding transmission time information Tlx.
  • the master clock determines the receiving time information T4y according to the time of receiving each De ay-Req message, and includes the receiving time information in each corresponding Delay-Resp message, and the De lay-Resp The message is sent to the slave clock and contains the transmission time information ⁇ 5 ⁇ of the De lay-Re s ⁇ .
  • the slave clock determines the receiving time information T6z of each Delay-Resp message according to the time of each Delay-Resp message received, and obtains the time information T5z included in each Delay-Resp ⁇ message.
  • T4y according to the receiving time information T4y of each Delay-Req message and the corresponding sending time information T3y, determining a second delay from the clock to the main clock, according to the receiving time information T6z of each Delay-Resp message And the corresponding transmission time information ⁇ 5 ⁇ , determining the third delay from the master clock to the slave clock.
  • the slave clock determines the link delay according to the calculated average value of the first delay and the second delay, and performs time synchronization according to the determined link delay.
  • S508 determining, by the clock, the first clock and the third delay according to the master clock to the slave clock, determining the master clock to the slave clock A frequency compensation value and a two frequency compensation value.
  • the slave clock calculates a frequency compensation value of the master clock and the slave clock according to the first frequency compensation value and the two frequency compensation value, and performs frequency synchronization according to the frequency compensation value.
  • the length of the clock synchronization may be set, that is, the size of the adjustment time window is set, and in the adjustment time window, the clock synchronization is performed by a one-step method, for example, the size of the adjustment time window is 2 seconds.
  • the master clock sends 512 Sync messages
  • the slave clock sends 512 De 1 ay-Req messages
  • the master clock responds to 512 De lay-Resp messages.
  • the clock synchronization message sent by the master clock and the slave clock carries sequence identification information, and the sequence identification information is an integer of ⁇ 512.
  • the main clock sends the first Sync message to the slave clock, according to the time when the Sync message is sent, the transmission time information T11 is included in the Sync message, and the Sync message is sent by the transmission port of the master clock.
  • the sequence identification information S1 is added, and then the main clock sends a second Syn message, and the transmission time information T12 for transmitting the second Syn message and the sequence identification information S2 of the message are included in the message. After that, the master clock completes the transmission of 512 Sync messages.
  • the clock After receiving the Sync message sent by the master clock, the clock identifies the sequence identification information carried in the message. When the sequence identification information of the message is S1, it is determined that a new clock synchronization period comes.
  • the slave clock determines the first candidate to be selected from the master clock to the slave clock according to the reception time information T21 of the received Sync message and the transmission time information T11 included in the first Sync message, and the current The first delay to be selected is saved as the first delay, and then the second candidate to be selected is determined according to the reception time information T22 of receiving the second Sync message and the transmission time information T12 included in the Sync message. Time.
  • Determining whether the second candidate first delay is less than the saved first delay, and when the second candidate first delay is less than the first delay, using the second candidate first The first delay is updated by delay, otherwise, the first delay is kept unchanged. Then, using the same method, determine the first delay of each Sync message to be selected, and determine whether to update the first delay.
  • the Delay-Re ⁇ message is generated from the clock, and the corresponding sequence of the Delay-Re ⁇ message in the adjustment time window is carried in the Re ⁇ The order identification information, and #> according to the time of sending the De lay-Re ⁇ message, the transmission time information (T21, ⁇ 22 ⁇ 2 ⁇ ) is included in the Delay-Req text.
  • the transmission time information (T21, ⁇ 22 ⁇ 2 ⁇ ) is included in the Delay-Req text.
  • the first Sync message is received by the slave clock
  • 512 De lay-Re ⁇ messages are sent to the master clock, and each Delay-Re ⁇ is sent according to the transmission.
  • the De lay-Re ⁇ text contains the transmission time information (T31, ⁇ 32 ⁇ 3 ⁇ ), and the sequence identification information 1-512 is added to each Delay-Re ⁇ message from the transmission port of the clock.
  • each De 1 ay-Re ⁇ received by the master clock is not processed by the CPU, and the FPGA of the master clock directly returns to the corresponding delay-Resp of the slave clock.
  • the message, and according to the time of replying each De-lay-Resp message, the receiving time information (T4K T42 T4N) is included in the Delay-Resp message, and according to the order of replying each De-lay-Resp message , carrying the corresponding order in the Delay-Resp message Identification information.
  • the slave device After receiving the Delay-Res p message sent by the master clock, the slave device identifies the sequence identification information carried in the packet. When the sequence identifier information of the packet is identified as S1, it is determined that a new clock synchronization period comes.
  • the slave clock determines the first time from the clock to the master clock according to the received time information T41 included in the identified De lay-Re sp message and the transmission time information T31 of the De 1 ay-Req message that sends the corresponding sequence identification information.
  • the second delay to be selected is used to save the current second delay to be selected as the second delay, and then according to the received reception time information T42 carried by the second De 1 ay-Res p message, and the transmission
  • the sending time information T32 of the two De lay-Req messages determines the second candidate second delay. Determining whether the second candidate second delay is less than the saved second delay, and when the second candidate second delay is less than the second delay, using the second candidate second
  • the second delay is updated by delay, otherwise, the second delay is kept unchanged. After that, the same method is used to identify the receiving time information of each Delay-Req message according to each received Delay-Resp message, and determine the second extension of each De 1 ay-Req message to be selected. And, determine whether to update the second delay.
  • the slave clock determines an average of the first delay and the second delay based on the determined first delay and the second delay, and performs clock synchronization based on the average.
  • the slave device After receiving the Delay-Res p message sent by the master clock, the slave device identifies the sequence identification information carried in the packet. When the sequence identifier information of the packet is S1, it is determined that a new clock synchronization period comes.
  • the slave clock determines the first candidate to be selected from the master clock to the slave clock according to the reception time information T61 of the received Delay-Resp message and the transmission time information T51 included in the first Delay-Resp message. Delaying, saving the current candidate third delay to a third delay, and then receiving the second Delay-Resp message receiving time information T62 and the sending time included in the Delay-Resp message Information T52, determining a second candidate to be selected from the master clock to the slave clock.
  • Determining whether the second candidate third delay is less than the saved third delay, and when the second candidate third delay is less than the third delay, using the second candidate to be selected The third delay is updated by the delay, otherwise, the third delay is kept unchanged. Then, using the same method, determine the third delay of each Delay-Resp message to be selected, and determine whether to update the third delay.
  • FIG. 6 is a schematic structural diagram of a system for transmitting a precision clock across a non-1588 network according to an embodiment of the present invention, where the system includes:
  • the main clock 61 is configured to send a plurality of Syncs, S1, and S2s to the slave clock according to the set time interval in each clock synchronization period, where each Sync message includes a Sync message.
  • each Delay-Resp message includes a sending time information T51 of the De lay-Resp message, T52 T5N, N is an integer greater than one;
  • the slave clock 62 is configured to receive each Sync message sent by the master clock, record the receiving time information T21, ⁇ 22 ⁇ 2 ⁇ of each Sync message, and receive the first Sync message sent by the master clock from the clock.
  • the SI sends a corresponding plurality of Delay-Ress S1 and S2 SNs to the master clock according to the set time interval, where each Delay-Req message includes the transmission time information T31 of the Delay-Req message, ⁇ 32 ⁇ 3 ⁇ ; Receive each De lay-Re s ⁇ ⁇ text sent by the master clock, record the receiving time information T61 of each Delay-Re sp message,
  • T62 T6N determining a first delay from the master clock to the slave clock according to each transmission time information Tl l, T12 TIN and corresponding reception time information T21, ⁇ 22 ⁇ 2 ⁇ , and according to each transmission time information
  • each receiving time information ⁇ 41, ⁇ 42 ⁇ 4 ⁇ determining a second delay from the clock to the main clock, determining the link delay and performing the time according to the first delay and the second delay Synchronization; determining, according to each transmission time Tl l, T12 TIN and corresponding reception time information ⁇ 21, ⁇ 22 ⁇ 2 ⁇ , a first frequency compensation value of the master clock to the slave clock, and according to each transmission time information ⁇ 51, ⁇ 52 ⁇ 5 ⁇ and Corresponding each receiving time information ⁇ 61, ⁇ 62 ⁇ 6 ⁇ , determining a second frequency compensation value from the clock to the main clock, and determining a frequency compensation value of the master clock and the slave clock according to the first frequency compensation value and the second frequency compensation value And frequency synchronization.
  • the master clock 61 is specifically configured to include an FPGA chip, receives each Delay-Re ⁇ message, records the receiving time information T4 i , and immediately forwards the Delay-Resp message S i , where the Delay-Resp message is
  • the included transmission time information T5 i is equal to T4 i, and i is an integer between 1 and N.
  • the master clock 61 is further configured to stop the clock synchronization operation with the slave clock when the clock of the master clock is changed within the current clock synchronization period, and restart the clock synchronization operation with the slave clock.
  • the change of the clock of the master clock itself includes: receiving the GPS by the master clock or completing a clock synchronization operation with other higher-level master clocks.
  • the slave clock 62 is specifically configured to determine, according to the difference between each of the receiving time information T21, ⁇ 22 ⁇ 2 ⁇ and each corresponding transmission time information T1 l, T12 TIN, each candidate first delay to be selected from the master clock to the slave clock ; selecting the minimum value of the first delay to be selected as the first delay from the master clock to the slave clock; according to each reception time information T41,
  • the slave clock 62 is specifically configured to determine, according to the difference between each receiving time information ⁇ 21, ⁇ 22 ⁇ 2 ⁇ and each corresponding transmission time information T1 l, T12 TIN, each candidate first delay to be selected from the master clock to the slave clock Selecting a Sync message S i corresponding to the minimum value of the first delay to be selected, extracting the transmission time information T1 i and the reception time information T2 i of the Sync message S i , and determining the first frequency compensation value; Receiving time information T61, ⁇ 62 ⁇ 6 ⁇ and the corresponding difference of each transmission time information ⁇ 51, ⁇ 52 ⁇ 5 ⁇ , determining a third delay of each candidate clock to be selected from the master clock; selecting a minimum value of the third delay to be selected Delay-Resp message Sj, extracting the Delay-Resp message Sj The transmission time information T5 j and the reception time information T6 j , and determine the second frequency compensation value, i is an integer between 1 and N.
  • the embodiment of the invention provides a clock synchronization method, system and device based on the 1588 protocol, the method comprising: transmitting a plurality of Syn messages containing each first transmission time information from a clock receiving master clock, and determining each first Receiving time information, transmitting, to the master clock, a plurality of Delay-Re ⁇ messages containing each second transmission time information, and receiving a corresponding plurality of Delay-Res containing each second reception time information returned by the main clock Sp message, according to the above receiving time and sending time, determine the link delay and perform clock synchronization.
  • each clock synchronization message is sent multiple times, even if the switch not based on the IEEE1588 protocol is based on queue and storage/forwarding.
  • Mechanism but when multiple clock synchronization packets are not queued on the outbound port of the switch, there will always be a file that is not stored/forwarded, which can effectively reduce the jitter of the delay and improve the clock synchronization. Precision.
  • embodiments of the present application can be provided as a method, system, or computer program product.
  • the application can be in the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware.
  • the application can be embodied in the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.).
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

本发明公开了一种跨非1588网络传输精密时钟报文的方法及系统,解决现有主、从交换机穿越非基于1588协议的交换机进行时钟同步精度不高的问题,该方法从时钟接收主时钟发送多个含有每个第一发送时间信息的 Sync报文,确定每个第一接收时间信息,向主时钟发送多个含有每个第二发送时间信息的 Delay-Req报文,接收主时钟返回的对应的多个含有每个第二接收时间信息的Delay-Resp报文,根据上述接收时间和发送时间,确定链路延时并进行时钟同步。本发明实施例中每个时钟同步报文发送多个,多个时钟同步报文在交换机的出端口总会存在不受存储/转发机制的报文,从而可以有效的降低时延的抖动,提高时钟同步的精度。

Description

一种跨非 1588网络传输精密时钟报文的方法及系统
技术领域 本发明涉及工业以太网技术领域, 尤其涉及一种跨非 1588网络传输精密时钟报文的方 法及系统。 背景技术 随着工业技术的不断发展, 对时钟同步的要求也越来越高, 尤其是在分布式控制系统 中, 对时钟同步已经提出了微妙级的要求。 在 IEEE1588标准中定义了在工业自动化系统中 的精确同步时钟协议 ( Preci s ion Time Protocol , PTP ), 该协议使用时间戳来同步时钟。 釆用该协议在进行时钟同步时,在网络通信的过程中, 同步控制信号可能会有一定的波动, 但该方法达到的精度可以使该协议适用于以太网系统中。 通过釆用该协议以太网、 TCP/IP 协议以及基于以太网的各种现场总线不需要大的改动, 就可以运行高精度的时钟同步机 制。 基于 ΡΤΡ协议的系统即 ΡΤΡ系统由一个或多个 ΡΤΡ子域系统组成, 每个子域系统都包括 一个或多个相互通信的时钟。 一个筒单的 ΡΤΡ子域系统包括一个主时钟和多个从时钟, 当 存在多个主时钟时, 可以通过选举的方式决定出一个主时钟。
图 1为基于 IEEE 1588协议的交换机主、 从时钟进行同步的示意图, 在该图中, 主时钟 可以对从时钟进行授时, 从而可以使主时钟和从时钟保持精确的同步。
图 2为主、 从时钟穿越非基于 IEEE1588协议的交换机(非 1588协议的交换机)进行时 钟同步的结构示意图, 在现有技术中基于 IEEE1588协议的交换机非常的少, 而对于非基于 IEEE1588协议的交换机其基于队列和存储 /转发机制进行工作, 因此队列中一个最长的数 据包可能给后续数据包带来 122us的延迟, 而在大负载情况下, 队列中的数据包是随机的, 可能包括不止一个长数据包。 同时, 基于 PTP协议进行时钟同步的精度取决于双向完全对 称的延迟, 但在大负载的情况下, 在队列中数据包是随机的, 并且随着网络流量的增加, 时钟同步报文排队的几率也越来越大, 完全对称几乎是不可能的。
即使釆用数据包优先的原则, 即基于 IEEE802. D/p也不能解决上述问题, 这是因为, 在接收到时钟同步报文时, 可能当前至少有一个数据包正在发送, 而且也很可能是个最长 数据包, 此时将会带来 122us的传输时间抖动。 而实际上釆用优先级调度机制后, 在同步 报文之前的可能会有 2到 8个数据包, 这意味着在大负载情况下延迟时间的抖动将会在 36 Ous到 1ms之间。 因此,在主从时钟穿越非基于 IEEE1588协议的交换机在进行时钟同步时, 基本无法保证 lus的对时精度。 发明内容 本发明实施例提供一种跨非 1588网络传输精密时钟报文的方法及系统, 用以解决现有 技术主、 从交换机穿越非基于 IEEE1588协议的交换机进行时钟同步时, 因为队列和存储 / 转发机制导致的对时精度不高的问题。
本发明实施例提供一种跨非 1588网络传输精密时钟报文的方法, 所述方法包括:
A、 在每个时钟同步周期内, 主时钟按照设定的时间间隔向从时钟发送多个 Sync报文
Sl、 S2 SN, 其中每个 Syn 艮文中含有 Syn 艮文的发送时间信息 Tl l、 T12
TIN, N为大于 1的整数;
B、 从时钟接收主时钟发送的每个 Sync^艮文, 记录接收每个 Sync^艮文的接收时间信息 T21、 Τ22 Τ2Ν, 从时钟在接收到主时钟发送的第一个 Sync^艮文 SI时, 按照设定的 时间间隔向主时钟发送对应的多个 Delay-Re^艮文 Sl、 S2 SN, 其中每个 Delay-Req 报文中包含该 Delay-Req报文的发送时间信息 T31、 Τ32 Τ3Ν;
C、 主时钟针对接收到的每个 Delay-Req报文, 记录接收到每个 Delay-Req报文的接收 时间信息 T41、 Τ42 Τ4Ν, 并向按照设定的时间间隔向从时钟发送多个 Delay-Resp 报文 Sl、 S2 SN, 其中每个 Delay-Resp^艮文中包含 Delay-Resp^艮文的发送时间信息
T51、 Τ52、 ……、 Τ5Ν;
D、 从时钟接收主时钟发送的每个 Delay-Resp^艮文, 记录接收每个 Delay-Resp^艮文的 接收时间信息 T61、 Τ62 Τ6Ν;
Ε、从时钟根据每个发送时间信息 Tl l、 T12 TIN和对应的每个接收时间信息 Τ21、 Τ22 Τ2Ν , 确定主时钟到从时钟的第一延时, 以及根据每个发送时间信息 Τ31、
Τ32 Τ3Ν和对应的每个接收时间信息 Τ41、 Τ42 Τ4Ν, 确定从时钟到主时钟 的第二延时, 根据所述第一延时和第二延时, 确定链路延时并进行时间同步;
F、 从时钟根据每个发送时间 Ti l、 T12 TIN和对应的每个接收时间信息 T21、
Τ22 Τ2Ν,确定主时钟到从时钟的第一频率补偿值,以及根据每个发送时间信息 Τ51、 Τ52 Τ5Ν和对应的每个接收时间信息 Τ61、 Τ62 Τ6Ν, 确定主时钟到从时钟 的第二频率补偿值, 根据所述第一频率补偿值和第二频率补偿值, 确定主时钟与从时钟的 频率补偿值并进行频率同步。
较佳地, 所述主时钟包含 FPGA芯片, 所述主时钟接收到每个 Delay-Re^艮文, 记录接 收时间信息 T4 i , 并立即转发 Delay-Resp报文 Si , 其中该 Delay-Resp报文中包含的发送时 间信息 T5 i与 T4 i相等。
较佳地, 所述方法还包括:
在当前时钟同步周期内, 当所述主时钟确定自身的时钟发生变化时, 所述主时钟停止 与所述从时钟之间的时钟同步操作, 并重新与所述从时钟进行步骤 A及后续步骤, 其中所 述主时钟自身的时钟发生变化包括, 所述主时钟接收到 GPS或完成与其他更高级别的主时 钟的时钟同步操作。
较佳地, 所述确定主时钟到从时钟的第一延时包括:
根据每个接收时间信息 T21、 T22 Τ2Ν与对应的每个发送时间信息 Tl l、 T12
Τ 1 Ν的差, 确定主时钟到从时钟的每个待选第一延时;
选择待选第一延时的最小值作为主时钟到从时钟的第一延时;
其中, 确定从时钟到主时钟的第二延时包括:
根据每个接收时间信息 Τ41、 Τ42 Τ4Ν与对应的每个发送时间信息 Τ31、 Τ32 Τ3Ν的差, 确定从时钟到主时钟的每个待选第二延时;
选择待选第二延时的最小值作为从时钟到主时钟的第二延时。
较佳地, 所述确定主时钟到从时钟的第一频率补偿值包括:
根据每个接收时间信息 Τ21、 Τ22 Τ2Ν与对应的每个发送时间信息 Tl l、 T12
Τ 1 Ν的差, 确定主时钟到从时钟的每个待选第一延时;
选择待选第一延时的最小值对应的 Sync报文 S i , 提取该 Sync报文 S i的发送时间信息
Tl i和接收时间信息 T2 i , 并确定第一频率补偿值, i为位于 1和 N之间的整数;
其中, 确定从时钟到主时钟的第二频率补偿值包括:
根据每个接收时间信息 T61、 T62 Τ6Ν与对应的每个发送时间信息 Τ51、 Τ52
Τ 5 Ν的差, 确定主时钟到从时钟的每个待选第三延时;
选择待选第三延时的最小值对应的 De lay-Re s p报文 S j , 提取该 De lay-Re s p报文 S j的发 送时间信息 T5 j和接收时间信息 T6 j , 并确定第二频率补偿值;
本发明实施例提供一种跨非 1588网络传输精密时钟报文的系统, 所述系统包括: 主时钟, 用于在每个时钟同步周期内, 按照设定的时间间隔向从时钟发送多个 Sync报 文 Sl、 S2 SN, 其中每个 Sync^艮文中含有 Sync^艮文的发送时间信息 Tl l、 T12 TIN; 针对接收到的每个 Delay-Re^艮文, 记录接收到每个 Delay-Re^艮文的接收时间信息
T41、 Τ42 Τ4Ν, 并向按照设定的时间间隔向从时钟发送多个 Delay-Resp^艮文 SI、
S2 SN , 其中每个 Delay-Resp报文中包含 Delay-Resp报文的发送时间信息 T51、
Τ52 Τ5Ν, Ν为大于 1的整数;
从时钟, 用于接收主时钟发送的每个 Sync报文, 记录接收每个 Sync报文的接收时间信 息 T21、 Τ22 Τ2Ν, 从时钟在接收到主时钟发送的第一个 Sync^艮文 SI时, 按照设定 的时间间隔向主时钟发送对应的多个 Delay-Re^艮文 Sl、 S2 SN,其中每个 Delay-Req 报文中包含该 Delay-Req报文的发送时间信息 T31、 Τ32 Τ3Ν; 接收主时钟发送的每 个 Delay-Resp报文, 记录接收每个 Delay-Resp报文的接收时间信息 T61、 T62 T6N; 根据每个发送时间信息 Tl l、 T12 TIN和对应的每个接收时间信息 Τ21、 Τ22
Τ2Ν, 确定主时钟到从时钟的第一延时, 以及根据每个发送时间信息 Τ31、 Τ32 Τ3Ν 和对应的每个接收时间信息 Τ41、 Τ42 Τ4Ν, 确定从时钟到主时钟的第二延时, 根 据所述第一延时和第二延时, 确定链路延时并进行时间同步; 根据每个发送时间 T11、 T12 TIN和对应的每个接收时间信息 Τ21、 Τ22 Τ2Ν, 确定主时钟到从时钟 的第一频率补偿值, 以及根据每个发送时间信息 Τ51、 Τ52 Τ5Ν和对应的每个接收 时间信息 Τ61、 Τ62 Τ6Ν, 确定主时钟到从时钟的第二频率补偿值, 根据所述第一 频率补偿值和第二频率补偿值, 确定主时钟与从时钟的频率补偿值并进行频率同步。
较佳地, 所述主时钟, 具体用于包含 FPGA芯片, 接收到每个 Delay-Req报文, 记录接 收时间信息 T4 i , 并立即转发 Delay-Resp报文 Si , 其中该 Delay-Resp报文中包含的发送时 间信息 T 5 i与 T 4 i相等, i为位于 1和 N之间的整数。
较佳地, 所述主时钟, 还用于在当前时钟同步周期内, 确定自身的时钟发生变化时, 停止与所述从时钟之间的时钟同步操作, 并重新开始与所述从时钟进行时钟同步操作, 其 中所述主时钟自身的时钟发生变化包括, 所述主时钟接收到 GPS或完成与其他更高级别的 主时钟的时钟同步操作。
较佳地, 所述从时钟, 具体用于根据每个接收时间信息 T21、 Τ22 Τ2Ν与对应 的每个发送时间信息 Tl l、 T12 TIN的差, 确定主时钟到从时钟的每个待选第一延 时; 选择待选第一延时的最小值作为主时钟到从时钟的第一延时; 根据每个接收时间信息 T41、 Τ42 Τ4Ν与对应的每个发送时间信息 Τ31、 Τ32 Τ3Ν的差, 确定从时钟 到主时钟的每个待选第二延时; 选择待选第二延时的最小值作为从时钟到主时钟的第二延 时。
较佳地, 所述从时钟, 具体用于根据每个接收时间信息 Τ21、 Τ22 Τ2Ν与对应 的每个发送时间信息 Tl l、 T12 TIN的差, 确定主时钟到从时钟的每个待选第一延 时;选择待选第一延时的最小值对应的 Sync报文 S i ,提取该 Sync报文 S i的发送时间信息 Tl i 和接收时间信息 T2 i , 并确定第一频率补偿值; 根据每个接收时间信息 T61、 Τ62
Τ6Ν与对应的每个发送时间信息 Τ51、 Τ52 Τ5Ν的差, 确定主时钟到从时钟的每个待 选第三延时; 选择待选第三延时的最小值对应的 Delay-Resp报文 Sj , 提取该 Delay-Resp报 文 S j的发送时间信息 T5 j和接收时间信息 T6 j , 并确定第二频率补偿值, i为位于 1和 N之间 的整数。
本发明实施例提供一种跨非 1588网络传输精密时钟报文的方法及系统, 该方法包括: 从时钟接收主时钟发送多个含有每个第一发送时间信息的 Syn 艮文, 并确定每个第一接收 时间信息, 向主时钟发送多个含有每个第二发送时间信息的 Delay-Req报文, 并接收主时 钟返回的对应的多个含有每个第二接收时间信息的 De lay-Re s p报文, 根据上述接收时间和 发送时间, 确定链路延时并进行时钟同步。 由于在本发明实施例中主、 从时钟之间在穿越 非基于 IEEE1588协议的交换机进行时钟同步时, 每个时钟同步报文时发送多个, 即使非基 于 IEEE1588协议的交换机基于队列和存储 /转发机制, 但是多个时钟同步报文在交换机的 出端口的不排队的情况下, 总会存在不受存储 /转发机制的报文, 从而可以有效的降低时 延的抖动, 提高时钟同步的精度。 附图说明 图 1为基于 I EEE 1588协议的交换机主、 从时钟进行同步的示意图;
图 2为主、 从交换机穿越非基于 I EEE 1588协议的交换机进行时钟同步的结构示意图; 图 3为本发明实施例提供的一种跨非 1588网络传输精密时钟 4艮文的过程示意图; 图 4为本发明实施例提供的主时钟与从时钟之间的时钟同步过程示意图;
图 5为本发明实施例提供的一种跨非 1588网络传输精密时钟报文的具体过程示意图; 图 6为本发明实施例提供的一种跨非 1588网络传输精密时钟 4艮文系统的结构示意图。 具体实施方式 本发明为了在主、 从交换机穿越非基于 IEEE1588协议的交换机进行时钟同步时, 提高 对时的精度, 提供了一种跨非 1588网络传输精密时钟报文的方法及系统。
下面结合说明书附图, 对本发明进行详细说明。
图 3为本发明实施例提供的一种跨非 1588网络传输精密时钟报文的过程示意图, 该过 程包括以下步骤:
S301 : 在每个时钟同步周期内, 主时钟按照设定的时间间隔向从时钟发送多个 Sync报 文 Sl、 S2 SN, 其中每个 Sync^艮文中含有 Sync^艮文的发送时间信息 Tl l、 T12
TIN, N为大于 1的整数。
具体的, 在本发明实施例中釆用一步法进行时钟同步, 其中, 每个时钟同步周期是指 主时钟与从时钟之间完成一轮 Sync^艮文、 Delay-Re^艮文和 Delay-Resp^艮文的交互之后, 完成主时钟对从时钟的时间和频率同步的过程。
本发明实施例中为了有效的减小穿越非基于 I EEE 1588协议的交换机进行对时时, 引起 的精度低的问题, 主时钟在向从时钟发送 Sync报文时, 发送多个, 例如可以为 512个, 或 128个, 或 1000个等。 并且主时钟每向从时钟发送一个 Sync^艮文, 都会在该 Sync^艮文中携 带发送该 Sync^艮文的发送时间信息 (Tl l、 T12 TIN ), 以便从时钟准确对时。
S302: 从时钟接收主时钟发送的每个 Sync报文, 记录接收每个 Sync报文的接收时间信 息 T21、 Τ22 Τ2Ν, 从时钟在接收到主时钟发送的第一个 Sync^艮文 SI时, 按照设定 的时间间隔向主时钟发送对应的多个 Delay-Re^艮文 SI、 S2 SN,其中每个 Delay-Req 报文中包含该 Delay-Req报文的发送时间信息 T31、 Τ32 Τ3Ν。
该多个含有每个发送时间信息的 Sync报文穿越非基于 IEEE1588协议的交换机到达从 时钟, 从时钟根据接收到每个 Sync^艮文的时间, 确定与每个 Sync^艮文对应的每个接收时间 信息 (T21、 Τ22、 ……、 Τ2Ν)。
例如, 接收到含有发送时间信息为 Α的 Sync报文的时间为 B, 则与该 Sync报文对应的接 收时间信息为 B。
当从时钟接收到主时钟发送的多个 Sync报文时, 为了响应主时钟, 该从时钟向主时钟 发送对应的多个 Delay-Re^艮文。 并且, 在本发明实施例中, 可以当从时钟接收到主时钟 发送的一个 Sync^艮文时, 向主时钟返回一个含有该 Delay-Re^艮文发送时间信息 (T31、
Τ32 Τ3Ν) 的 Delay-Re^艮文。 当然为了提高时钟同步的效率, 当从时钟接收到一 个到达的 Sync报文时, 可以根据设置的报文数量, 向主时钟返回含该 Delay-Req报文发送 时间信息 (T3K T32 T3N) 的多个 Delay-Req报文, 其中该设置的报文数量与主时 钟设置的发送 Sync报文的数量相同。
S303: 主时钟针对接收到的每个 Delay-Re^艮文, 记录接收到每个 Delay-Re^艮文的接 收时间信息 T41、 Τ42 Τ4Ν, 并向按照设定的时间间隔向从时钟发送多个 Delay-Resp
■ί艮文 Sl、 S2 SN, 其中每个 Delay-Resp^艮文中包含 Delay-Resp^艮文的发送时间信息
T51、 Τ52、 ……、 Τ5Ν。
当主时钟接收到从时钟发送的每个含有该 De lay-Re^艮文发送时间信息的 De lay-Req 报文后, 确定接收到每个 Delay-Req报文的时间信息, 将该每个时间信息确定为该每个
Delay-Req报文的接收时间信息 (T41、 Τ42 Τ4Ν ), 将每个 Delay-Req报文的接收时 间信息包含在对应的每个 De lay-Re s p报文中发送给从时钟, 其中所述每个 De lay-Re s p报文 中还包括主时钟发送该 Delay-Resp报文的发送时间信息 (T5K T52 T5N )。
S304: 从时钟接收主时钟发送的每个 Delay-Resp报文, 记录接收每个 Delay-Resp报文 的接收时间信息 T61、 Τ62 Τ6Ν。
当从时钟接收到主时钟发送的每个 De 1 ay-Res p报文后, 确定接收到每个 De 1 ay-Res p报 文的时间信心, 将该每个时间信息确定为每个 Delay-Resp^艮文的接收时间信息 ( T61、
Τ62 Τ6Ν), 并获取该接收到的每个 Delay-Resp^艮文中携带的含有主时钟接收所述 每个 Delay-Req报文的接收时间信息(T41、 Τ42 Τ4Ν )和主时钟发送每个 Delay-Resp ·ί艮文的发送时间信息 (Τ5Κ Τ52 Τ5Ν)。
S305: 从时钟根据每个发送时间信息 Til、 T12 TIN和对应的每个接收时间信 息 T21、 Τ22 Τ2Ν, 确定主时钟到从时钟的第一延时, 以及根据每个发送时间信息
Τ31、 Τ32 Τ3Ν和对应的每个接收时间信息 Τ41、 Τ42 Τ4Ν, 确定从时钟到主 时钟的第二延时, 根据所述第一延时和第二延时, 确定链路延时并进行时间同步。
具体的, 从时钟可以根据与主时钟之间交互的每个 Sync报文, 确定每个 Sync报文的发 送时间信息 Tl l、 Τ12、 ……、 TIN和对应的每个接收时间信息 Τ21、 Τ22、 ……、 Τ2Ν, 从而 可以确定主时钟到从时钟的链路的每个待选第一延时, 之后, 从时钟还可以根据与主时钟 之间交互的 Delay-Req报文包含的该的发送时间信息 Τ31、 Τ32 Τ3Ν和 Delay-Resp报 文包含的该 Delay-Req报文对应的接收时间信息 T41、 Τ42 Τ4Ν, 确定从时钟到主时 钟的链路的每个待选第二延时。 当确定了每个待选第一延时和每个待选第二延时后, 可以 在待选第一延时中任意选择一个作为第一延时, 也可以在待选第一延时中选择一个最小值 作为第一延时, 或者还可以将每个待选第一延时的平均值作为第一延时, 相应的确定第二 延时的方法相同。
根据所述第一延时和第二延时, 确定链路延时并进行时钟同步。
当确定了第一延时和第二延时后, 即可以根据第一延时和第二延时确定链路的平均延 时, 从而可以根据该平均延时进行时钟同步。
当选择每个待选第一延时的最小值作为第一延时时, 可以认为该时钟同步 ·ί艮文在经过 非基于 IEEE1588的交换机时没有在队列中等待, 且交换机当前没有发送其他报文时对应的 延时, 从而可以保证时钟同步的精度。
S306: 从时钟根据每个发送时间 Tl l、 T12 TIN和对应的每个接收时间信息 Τ21、
Τ22 Τ2Ν,确定主时钟到从时钟的第一频率补偿值,以及根据每个发送时间信息 Τ51、
Τ52 Τ5Ν和对应的每个接收时间信息 Τ61、 Τ62 Τ6Ν, 确定主时钟到从时钟 的第二频率补偿值, 根据所述第一频率补偿值和第二频率补偿值, 确定主时钟与从时钟的 频率补偿值并进行频率同步。
具体的, 从时钟根据与主时钟之间交互的每个 Sync报文, 确定每个 Sync报文的发送时 间信息 Tl l、 T12 TIN和对应的每个接收时间信息 Τ21、 Τ22 Τ2Ν, 从而可以 确定主时钟到从时钟的链路的每个待选第一延时, 之后, 从时钟根据与主时钟之间交互的 每个 Delay-Resp报文, 确定每个 Delay-Resp报文的发送时间信息 T51、 Τ52、 ……、 Τ5Ν和 对应的每个接收时间信息 Τ61、 Τ62 Τ6Ν, 从而可以确定主时钟到从时钟的链路的 每个待选第三延时, 当确定了每个待选第一延时和每个待选第三延时后, 可以在待选第一 延时中任意选择一个作为第一延时, 也可以在待选第一延时中选择一个最小值作为第一延 时, 或者还可以将每个待选第一延时的平均值作为第一延时, 相应的确定第三延时的方法 相同。
根据所述第一延时和第三延时, 确定主时钟与从时钟之间对应的第一频率补偿值和第 二频率补偿值, 根据频率反算算法, 确定主时钟与从时钟的频率补偿值, 并根据所述频率 补偿值对从时钟进行频率同步。 当选择每个待选第一延时的最小值作为第一延时时, 可以认为该时钟同步 ·ί艮文在经过 非基于 IEEE1588的交换机时没有在队列中等待, 且交换机当前没有发送其他报文时对应的 延时, 从而可以保证时钟同步的精度。
由于在本发明实施例中主、 从时钟之间在穿越非基于 IEEE1588协议的交换机进行时钟 同步时, 每个时钟同步报文时发送多个, 即使非基于 IEEE1588协议的交换机基于队列和存 储 /转发机制, 但是多个时钟同步报文在交换机的出端口的不排队的情况下, 总会存在不 受存储 /转发机制的报文, 从而可以有效的降低时延的抖动, 提高时钟同步的精度。
在本发明实施例中由于主时钟和从时钟在进行时钟同步时, 时钟同步报文要穿过非基 于 IEEE1588协议的交换机, 如果时钟同步报文在该交换机的发送端口不排队的情况下, 报 文转发的延时的抖动会比较小, 可以控制在 200ns内, 因此在本发明实施例中釆用发送大 量时钟同步 4艮文的方式, 从而确定主、 从时钟之间的链路延时。
为了减少时钟同步报文的发送数量, 提高时钟同步的效率, 在本发明实施例中釆用一 步法进行时钟同步。 由于在本发明实施例中每个报文发送多个, 主时钟和从时钟在每个时 钟同步周期内发送的每种报文的数量可以预先设置。 例如对于主时钟, 其每秒钟可以发送 128到 2000个 Sync^艮文, 具体的在每个时钟同步周期内发送 Syn 艮文的数量可以进行设置, 同样, 从时钟发送的时钟同步报文的数量也可以预先设置。 为了保证时钟同步的准确性, 可以在每个报文中携带顺序标识信息, 由主、 从时钟的发送端口在进行发送时, 将该顺序 标识信息添加到每个报文中。
图 4为本发明实施例提供的主时钟与从时钟之间的时钟同步过程示意图, 现结合图 4对 本发明实施例中的时钟同步过程进行说明。
具体的, 主时钟根据自身设置的时钟同步报文的发送数量, 发送对应数量的多个 Sync 报文(S l、 S2 SN ), 并且在发送每个 Sync报文时, 根据该 Sync报文的发送时间, 将每个发送时间信息 (Tl l、 T12 TIN ) 包含在 Sync报文中, 并且根据该 Sync报文 的发送顺序, 将顺序标识信息添加到该 Sync^艮文中。 主时钟在发送每个 Sync^艮文时, 可以 按照固定的时间间隔发送, 也可以任意发送, 只要在每个 Sync报文中包含当前时刻的发送 时间信息以及顺序标识信息即可。 例如, 每个时钟同步周期内, 主时钟发送 512个 Sync^艮 文, 主时钟向从时钟发送的每个 Sync报文的顺序标识信息可以预先约定, Sync报文的顺序 标识信息可以从 1开始, 一直到 512标识主时钟发送的每个 Sync^艮文。
当从时钟接收到主时钟发送的 Sync^艮文时, 可以根据接收到每个 Sync^艮文的时间, 记 录每个 Syn 艮文的收时间信息 (T21、 Τ22 Τ2Ν )。 由于在每个 Syn 艮文中携带送时 间信息及顺序标识信息, 因此从时钟可以对 Sync报文进行区别, 并且确定每个 Sync报文的 接收时间, 从而可以确定每个 Sync报文的接收时间信息。
从时钟接收到主时钟发送的每个 Sync^艮文时 , 可以相应的向主时钟返回 De l ay-Req¾ 文, 其中在该 Delay-Req报文中包含发送该报文的发送时间信息 ( T31、 Τ32 Τ3Ν )。 另外, 在本发明实施例中为了进一步提高时钟同步的效率, 向主时钟发送对应的多个含有 发送时间信息 ( Τ31、 Τ32 Τ3Ν ) 的 Delay-Req报文包括:
当接收到所述主时钟发送的第一个 Sync^艮文时, 向主时钟发送对应的多个含有发送时 间信息的 Delay-Re^艮文。
即, 当从时钟接收到主时钟发送的 Sync报文时, 由于在从时钟中保存有需要发送的 Delay-Req报文的数量 SN, 因此为了提高时钟同步的效率, 该从时钟即可向主时钟返回对 应的多个含有每个发送时间信息(T31、 Τ32 Τ3Ν)的 Delay-Req报文, 而无需接收到 每个 Syn 艮文再进行每个 Delay-Re^艮文的发送。 另外, 在该实施例中当从时钟发送该多 个 Delay-Re^艮文时, 也是可以按照固定的时间间隔来发送, 也可以任意发送, 只要保证 发送该多个 Delay-Re^艮文即可。
从时钟在向主时钟发送每个 Delay-Re^艮文时, 该每个 Delay-Re^艮文中包含当前发送 该 4艮文的发送时间信息 (T31、 Τ32 Τ3Ν ), 并且, 为了进一步的标识该 Delay-Req 报文的发送顺序, 可以在每个 Delay-Req报文中携带该报文的顺序标识信息。 同样的, 例 如, 每个时钟同步周期内, 主时钟发送 512个 Sync^艮文, 从时钟向主时钟发送的每个 De 1 ay-Re^艮文的顺序标识可以预先约定, De 1 ay-Re^艮文的顺序标识信息可以从 1开始, 一直到 512标识从时钟发送的每个 De 1 ay-Re^艮文。
主时钟在接收到从时钟发送每个 Delay-Re^艮文时, 记录接收每个 Delay-Resp^艮文的 接收时间信息 (T41、 Τ42 Τ4Ν ), 并针对接收到的每个 Delay-Re^艮文, 主时钟向 从时钟返回对应的 Delay-Resp^艮文, 其中, 每个 Delay-Resp^艮文中携带主时钟接收到该
Delay-Resp报文的接收时间信息 (T41、 Τ42 Τ4Ν )和主时钟发送该 Delay-Resp报 文的发送时间信息 (T51、 Τ52 Τ5Ν )。 另外, 为了减少时钟同步 ·ί艮文对主时钟 CPU 的冲击, 在本发明实施例中主时钟釆用硬件打时间戳的方法, 所述方法包括:
主时钟包含 FPGA芯片,所述主时钟接收到每个 Delay-Re^艮文,记录接收时间信息 T4 i , 并立即转发 Delay-Resp报文 S i , 其中该 Delay-Resp报文中包含的发送时间信息 T5 i与 T4 i相 等, i为位于 1和 N之间的整数。
即, 主时钟接收到每个 Delay-Re^艮文后, FPGA芯片通过直接打时间戳的方式, 记录 当前时间然后立即回复 Delay-Resp^艮文, 由于是硬件打时间戳的方式, 因此, 接收 Delay-Req报文的时间与发送 Delay-Resp报文的时间相同, 从而减少了大量 Delay-Req报文 对主时钟 CPU的冲击。 另外, 为了进一步提高主时钟对从时钟的时钟同步精度, 避免因更 高级的主时钟对主时钟进行同时产生的抖动, 从而引起的主时钟与从时钟之间同步精度降 低的问题, 所述方法还包括:
在当前时钟同步周期内, 当所述主时钟确定自身的时钟发生变化时, 所述主时钟停止 与所述从时钟之间的时钟同步操作, 并重新与所述从时钟进行步骤 A及后续步骤, 其中所 述主时钟自身的时钟发生变化包括, 所述主时钟接收到 GPS或完成与其他更高级别的主时 钟的时钟同步操作。
具体的, 主时钟在收到 GPS信号或其他更高级别的主时钟的时钟同步报文对自身的时 钟进行调整, 导致主时钟自身的时钟发生变化时, 主时钟停止当前与从时钟之间的时钟同 步操作, 即, 在当前的时钟同步周期内, 当主时钟正在向从时钟发送第 S i个 Sync^艮文时, 主时钟在完成自身的时钟调整后, 停止下一个序号为 S i+1的 Sync^艮文的发送, 重新发送序 号为 S1的 Sync^艮文启动新的一个时钟同步周期, 相应的当主时钟接收从时钟发送的 De lay-Req报文或者主时钟向从时钟发送 De lay-Resp报文时, 釆用的方法相同。
图 5为本发明实施例提供的一种跨非 1588网络传输精密时钟报文的具体过程示意图, 该过程包括以下步骤:
S501 : 主时钟根据预先设置的时钟同步报文的发送数量, 向从时钟发送该对应数量的 多个 Sync^艮文, 并且根据每个 Sync^艮文的发送时间, 在每个 Sync^艮文中包含对应的发送时 间信息 Tlx。
S502 : 从时钟判断在该时钟同步周期内是否接收到第一个 Sync报文, 当判断结果为是 时, 进行步骤 S503 , 否则, 进行步骤 S 502。
S503: 从时钟根据预先设置的时钟同步报文的发送数量, 向主时钟发送对应数量的多 个 De lay-Re^艮文, 并才 M居发送每个 De lay-Re^艮文的发送时间, 每个 De lay-Re^艮文中包 含对应的发送时间信息 T 3y。
S504: 从时钟根据接收到每个 Sync报文的时间, 确定接收该每个 Sync报文的接收时间 信息 T2x。 从时钟根据确定的每个接收时间信息 T2 i , 以及对应的每个发送时间信息 Tlx , 确定主时钟到从时钟的第一延时。
S505 : 主时钟根据接收到每个 De l ay-Req报文的时间, 确定接收时间信息 T4y, 并将接 收时间信息包含在对应的每个 De lay-Resp报文中, 将该 De lay-Resp报文发送给从时钟, 并 包含该 De lay-Re s ρ·ί艮文的发送时间信息 Τ5 ζ。
S506: 从时钟根据接收到的每个 De lay-Resp报文的时间, 确定每个 De lay-Resp报文的 接收时间信息 T6z , 获取每个 De lay-Resp^艮文中包含的时间信息 T5z和 T4y , 根据每个 De lay-Req报文的接收时间信息 T4y及对应的发送时间信息 T3y , 确定从时钟到主时钟的第 二延时, 根据每个 De lay-Resp报文的接收时间信息 T6z及对应的发送时间信息 Τ5ζ , 确定主 时钟到从时钟的第三延时。
S507 : 从时钟根据计算的第一延时和第二延时的平均值, 确定链路延时, 根据确定的 该链路延时进行时间同步。
S508 : 从时钟根据主时钟到从时钟的第一延时及第三延时, 确定主时钟到从时钟的第 一频率补偿值和二频率补偿值。
S509: 从时钟根据第一频率补偿值及二频率补偿值, 通过频率反算算法计算主时钟与 从时钟的频率补偿值, 并根据所述频率补偿值进行频率同步。
具体的,在本发明实施例中可以设置时钟同步的时间长度, 即设置调整时间窗的大小, 在该调整时间窗内, 通过一步法进行时钟同步, 例如该调整时间窗的大小为 2秒钟, 在该 调整时间窗内主时钟发送 512个 Sync报文, 从时钟发送 512个 De 1 ay-Req报文, 主时钟回应 512个 De lay-Resp报文。 在每个调整时间窗内, 主时钟和从时钟发送的时钟同步报文中携 带顺序标识信息, 该顺序标识信息为 Γ512的整数。
主时钟在向从时钟发送第一个 Sync^艮文时, 根据发送该 Sync^艮文的时间, 在该 Sync^艮 文中包含发送时间信息 T11 , 并且由主时钟的发送端口在该 Sync报文中添加顺序标识信息 S1 , 之后主时钟发送第二个 Syn 艮文, 在该 ·ί艮文中包含有发送该第二个 Syn 艮文的发送时 间信息 T12 , 及该报文的顺序标识信息 S2 , 之后以此类推, 主时钟完成 512个 Sync报文的发 送。
从时钟接收到主时钟发送的 Sync报文后, 识别该报文中携带的顺序标识信息, 当识别 该报文的顺序标识信息为 S1时, 确定新的时钟同步周期到来。 从时钟根据接收该 Sync报文 的接收时间信息 T21 , 及该第一个 Sync^艮文中包含的发送时间信息 T11 , 确定主时钟到从时 钟的第一个待选第一延时, 将当前的待选第一延时保存为第一延时, 之后根据接收第二个 Sync报文的接收时间信息 T22 , 及该 Sync报文中包含的发送时间信息 T12 , 确定第二个待选 第一延时。 判断该第二个待选第一延时是否小于保存的该第一延时, 当该第二个待选第一 延时小于该第一延时时, 釆用该第二个待选第一延时更新该第一延时, 否则, 保持该第一 延时不变。 之后, 釆用相同的方法, 确定每个 Sync^艮文的待选第一延时, 并判断是否对该 第一延时进行更新。
当从时钟接收到每个 Sync^艮文时, 从时钟生成 De lay-Re^艮文, 根据该调整时间窗内 该 De lay-Re^艮文的生成顺序, 在该 Re^艮文中携带对应的顺序标识信息, 并 #>据发送该 De lay-Re^艮文的时间, 将该发送时间信息 (T21、 Τ22 Τ2Ν ) 包含在 De lay-Req艮 文中。 或者为了提高时钟同步的效率, 在本发明实施例中该从时钟接收到第一个 Sync报文 时, 向主时钟发送 512个 De lay-Re^艮文, 根据发送每个 De lay-Re^艮文的时间, 在每个
De lay-Re^艮文中包含发送时间信息 (T31、 Τ32 Τ3Ν ), 并且从时钟的发送端口在 每个 De lay-Re^艮文中添加顺序标识信息 1—512。
由于主时钟不需要从从时钟获取任何信息, 因此主时钟接收到的每个 De 1 ay-Re^艮文 不上 CPU进行处理, 直接由主时钟的 FPGA向从时钟回复对应的 De lay-Resp报文, 并根据回 复每个 De lay-Resp报文的时间 ,将接收时间信息( T4K T42 T4N )包含在该 De lay-Resp 报文中, 并根据回复每个 De lay-Resp报文的顺序, 在该 De lay-Resp报文中携带对应的顺序 标识信息。
从时钟接收到主时钟发送的 De lay-Re s p报文后, 识别该报文中携带的顺序标识信息, 当识别该报文的顺序标识信息为 S1时, 确定新的时钟同步周期到来。 从时钟根据识别到的 该 De lay-Re s p报文包含的接收时间信息 T41 , 及发送对应顺序标识信息的 De 1 ay-Req报文的 发送时间信息 T31 , 确定从时钟到主时钟的第一个待选第二延时, 将当前的待选第二延时 保存为第二延时, 之后根据接收到的第二个 De 1 ay-Res p报文携带的接收时间信息 T42 , 及 发送第二个 De lay-Req报文的发送时间信息 T32 , 确定第二个待选第二延时。 判断该第二个 待选第二延时是否小于保存的该第二延时, 当该第二个待选第二延时小于该第二延时时, 釆用该第二个待选第二延时更新该第二延时, 否则, 保持该第二延时不变。 之后, 釆用相 同的方法, 根据接收到的每个 De lay-Resp报文识别每个 De lay-Req报文的接收时间信息, 确定每个 De 1 ay-Req报文的待选第二延时, 并判断是否对该第二延时进行更新。
从时钟根据确定的第一延时和第二延时, 确定第一延时和第二延时的平均值, 根据该 平均值进行时钟同步。
从时钟接收到主时钟发送的 De lay-Re s p报文后, 识别该报文中携带的顺序标识信息, 当识别该报文的顺序标识信息为 S 1时, 确定新的时钟同步周期到来。 从时钟根据接收该 De lay-Resp报文的接收时间信息 T61 , 及该第一个 De lay-Resp报文中包含的发送时间信息 T51 , 确定主时钟到从时钟的第一个待选第三延时, 将当前的待选第三延时保存为第三延 时, 之后根据接收第二个 De lay-Resp报文的接收时间信息 T62 , 及该 De lay-Resp报文中包 含的发送时间信息 T52 , 确定主时钟到从时钟的第二个待选第三延时。 判断该第二个待选 第三延时是否小于保存的该第三延时, 当该第二个待选第三延时小于该第三延时时, 釆用 该第二个待选第三延时更新该第三延时, 否则, 保持该第三延时不变。 之后, 釆用相同的 方法, 确定每个 De lay-Resp报文的待选第三延时, 并判断是否对该第三延时进行更新。
由于在本发明实施例中主、 从时钟之间在穿越非基于 IEEE1588协议的交换机进行时钟 同步时, 每个时钟同步报文时发送多个, 即使非基于 IEEE1588协议的交换机基于队列和存 储 /转发机制, 但是多个时钟同步报文在交换机的出端口的不排队的情况下, 总会存在不 受存储 /转发机制的报文, 从而可以有效的降低时延的抖动, 提高时钟同步的精度。 图 6为 本发明实施例提供的一种跨非 1588网络传输精密时钟 4艮文系统的结构示意图, 所述系统包 括:
主时钟 61 , 用于在每个时钟同步周期内, 按照设定的时间间隔向从时钟发送多个 Sync ·ί艮文 Sl、 S2 SN,其中每个 Sync^艮文中含有 Sync^艮文的发送时间信息 Tl l、 T12
TIN; 针对接收到的每个 De 1 ay-Re^艮文, 记录接收到每个 De 1 ay-Re^艮文的接收时间信息
T41、 Τ42 Τ4Ν , 并向按照设定的时间间隔向从时钟发送多个 De lay-Resp^艮文 SI、
S2 SN , 其中每个 De lay-Resp报文中包含 De lay-Resp报文的发送时间信息 T51、 T52 T5N, N为大于 1的整数;
从时钟 62 , 用于接收主时钟发送的每个 Sync^艮文, 记录接收每个 Sync^艮文的接收时间 信息 T21、 Τ22 Τ2Ν, 从时钟在接收到主时钟发送的第一个 Sync报文 SI时, 按照设 定的时间间隔向主时钟发送对应的多个 Delay-Re^艮文 Sl、 S2 SN , 其中每个 Delay-Req报文中包含该 Delay-Req报文的发送时间信息 T31、 Τ32 Τ3Ν; 接收主时 钟发送的每个 De lay-Re s ρ ·ί艮文, 记录接收每个 De lay-Re s p报文的接收时间信息 T61、
T62 T6N; 根据每个发送时间信息 Tl l、 T12 TIN和对应的每个接收时间信 息 T21、 Τ22 Τ2Ν, 确定主时钟到从时钟的第一延时, 以及根据每个发送时间信息
Τ31、 Τ32 Τ3Ν和对应的每个接收时间信息 Τ41、 Τ42 Τ4Ν, 确定从时钟到主 时钟的第二延时, 根据所述第一延时和第二延时, 确定链路延时并进行时间同步; 根据每 个发送时间 Tl l、 T12 TIN和对应的每个接收时间信息 Τ21、 Τ22 Τ2Ν, 确定 主时钟到从时钟的第一频率补偿值, 以及根据每个发送时间信息 Τ51、 Τ52 Τ5Ν和 对应的每个接收时间信息 Τ61、 Τ62 Τ6Ν, 确定从时钟到主时钟的第二频率补偿值, 根据所述第一频率补偿值和第二频率补偿值, 确定主时钟与从时钟的频率补偿值并进行频 率同步。
所述主时钟 61 , 具体用于包含 FPGA芯片, 接收到每个 Delay-Re^艮文, 记录接收时间 信息 T4 i , 并立即转发 Delay-Resp报文 S i , 其中该 Delay-Resp报文中包含的发送时间信息 T5 i与 T4 i相等, i为位于 1和 N之间的整数。
所述主时钟 61 , 还用于在当前时钟同步周期内, 确定自身的时钟发生变化时, 停止与 所述从时钟之间的时钟同步操作, 并重新开始与所述从时钟进行时钟同步操作, 其中所述 主时钟自身的时钟发生变化包括, 所述主时钟接收到 GPS或完成与其他更高级别的主时钟 的时钟同步操作。
所述从时钟 62 , 具体用于根据每个接收时间信息 T21、 Τ22 Τ2Ν与对应的每个 发送时间信息 Tl l、 T12 TIN的差, 确定主时钟到从时钟的每个待选第一延时; 选 择待选第一延时的最小值作为主时钟到从时钟的第一延时; 根据每个接收时间信息 T41、
Τ42 Τ4Ν与对应的每个发送时间信息 Τ31、 Τ32 Τ3Ν的差, 确定从时钟到主 时钟的每个待选第二延时; 选择待选第二延时的最小值作为从时钟到主时钟的第二延时。
所述从时钟 62 , 具体用于根据每个接收时间信息 Τ21、 Τ22 Τ2Ν与对应的每个 发送时间信息 Tl l、 T12 TIN的差, 确定主时钟到从时钟的每个待选第一延时; 选 择待选第一延时的最小值对应的 Sync报文 S i , 提取该 Sync报文 S i的发送时间信息 Tl i和接 收时间信息 T2 i , 并确定第一频率补偿值; 根据每个接收时间信息 T61、 Τ62 Τ6Ν与 对应的每个发送时间信息 Τ51、 Τ52 Τ5Ν的差, 确定主时钟到从时钟的每个待选第 三延时; 选择待选第三延时的最小值对应的 Delay-Resp报文 Sj , 提取该 Delay-Resp报文 Sj 的发送时间信息 T5 j和接收时间信息 T6 j , 并确定第二频率补偿值, i为位于 1和 N之间的整 数。
本发明实施例提供一种基于 1588协议的时钟同步方法、 系统及装置, 该方法包括: 从 时钟接收主时钟发送多个含有每个第一发送时间信息的 Syn 艮文, 并确定每个第一接收时 间信息, 向主时钟发送多个含有每个第二发送时间信息的 De lay-Re^艮文, 并接收主时钟 返回的对应的多个含有每个第二接收时间信息的 De lay-Re s p报文, 根据上述接收时间和发 送时间, 确定链路延时并进行时钟同步。 由于在本发明实施例中主、 从时钟之间在穿越 非基于 IEEE1588协议的交换机进行时钟同步时, 每个时钟同步报文时发送多个, 即使非基 于 IEEE1588协议的交换机基于队列和存储 /转发机制, 但是多个时钟同步报文在交换机的 出端口的不排队的情况下, 总会存在不受存储 /转发机制的 ·ί艮文, 从而可以有效的降低时 延的抖动, 提高时钟同步的精度。
本领域内的技术人员应明白, 本申请的实施例可提供为方法、 系统、 或计算机程序产 品。 因此, 本申请可釆用完全硬件实施例、 完全软件实施例、 或结合软件和硬件方面的实 施例的形式。 而且, 本申请可釆用在一个或多个其中包含有计算机可用程序代码的计算机 可用存储介盾 (包括但不限于磁盘存储器、 CD-R0M、 光学存储器等)上实施的计算机程序 产品的形式。
本申请是参照根据本申请实施例的方法、 设备(系统)、 和计算机程序产品的流程图 和 /或方框图来描述的。 应理解可由计算机程序指令实现流程图和 /或方框图中的每一流 程和 /或方框、 以及流程图和 /或方框图中的流程和 /或方框的结合。 可提供这些计算机 程序指令到通用计算机、 专用计算机、 嵌入式处理机或其他可编程数据处理设备的处理器 以产生一个机器, 使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用 于实现在流程图一个流程或多个流程和 /或方框图一个方框或多个方框中指定的功能的 装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方 式工作的计算机可读存储器中, 使得存储在该计算机可读存储器中的指令产生包括指令装 置的制造品, 该指令装置实现在流程图一个流程或多个流程和 /或方框图一个方框或多个 方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上, 使得在计算机 或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理, 从而在计算机或其他 可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和 /或方框图一个 方框或多个方框中指定的功能的步骤。
尽管已描述了本申请的优选实施例, 但本领域内的技术人员一旦得知了基本创造性概 念, 则可对这些实施例做出另外的变更和修改。 所以, 所附权利要求意欲解释为包括优选 实施例以及落入本申请范围的所有变更和修改。
显然, 本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和 范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内, 则本申请也意图包含这些改动和变型在内。

Claims

权 利 要 求
1、 一种跨非 1588网络传输精密时钟报文的方法, 其特征在于, 所述方法包括:
A、 在每个时钟同步周期内, 主时钟按照设定的时间间隔向从时钟发送多个 Sync报文 Sl、 S2 SN, 其中每个 Syn 艮文中含有 Syn 艮文的发送时间信息 Tl l、 T12
TIN, N为大于 1的整数;
B、 从时钟接收主时钟发送的每个 Sync^艮文, 记录接收每个 Sync^艮文的接收时间信息
T21、 Τ22 Τ2Ν, 从时钟在接收到主时钟发送的第一个 Sync^艮文 SI时, 按照设定的 时间间隔向主时钟发送对应的多个 Delay-Re^艮文 Sl、 S2 SN, 其中每个 Delay-Req 报文中包含该 Delay-Req报文的发送时间信息 T31、 Τ32 Τ3Ν;
C, 主时钟针对接收到的每个 Delay-Req报文, 记录接收到每个 Delay-Req报文的接收 时间信息 T41、 Τ42 Τ4Ν, 并向按照设定的时间间隔向从时钟发送多个 Delay-Resp
■ί艮文 Sl、 S2 SN, 其中每个 Delay-Resp^艮文中包含 Delay-Resp^艮文的发送时间信息
T51、 Τ52、 ……、 Τ5Ν;
D、 从时钟接收主时钟发送的每个 Delay-Resp^艮文, 记录接收每个 Delay-Resp^艮文的 接收时间信息 T61、 Τ62 Τ6Ν;
Ε、从时钟根据每个发送时间信息 Tl l、 T12 TIN和对应的每个接收时间信息 Τ21、
Τ22 Τ2Ν , 确定主时钟到从时钟的第一延时, 以及根据每个发送时间信息 Τ31、
Τ32 Τ3Ν和对应的每个接收时间信息 Τ41、 Τ42 Τ4Ν, 确定从时钟到主时钟 的第二延时, 根据所述第一延时和第二延时, 确定链路延时并进行时间同步;
F、 从时钟根据每个发送时间 Ti l、 T12 TIN和对应的每个接收时间信息 T21、
Τ22 Τ2Ν,确定主时钟到从时钟的第一频率补偿值,以及根据每个发送时间信息 Τ51、
Τ52 Τ5Ν和对应的每个接收时间信息 Τ61、 Τ62 Τ6Ν, 确定主时钟到从时钟 的第二频率补偿值, 根据所述第一频率补偿值和第二频率补偿值, 确定主时钟与从时钟的 频率补偿值并进行频率同步。
2、 如权利要求 1所述的方法, 其特征在于, 所述主时钟包含 FPGA芯片, 所述主时钟接 收到每个 Delay-Re^艮文, 记录接收时间信息 T4 i , 并立即转发 Delay-Resp^艮文 S i , 其中该 Delay-Res p报文中包含的发送时间信息 T 5 i与 T4 i相等, i为位于 1和 N之间的整数。
3、 如权利要求 1所述的方法, 其特征在于, 所述方法还包括:
在当前时钟同步周期内, 当所述主时钟确定自身的时钟发生变化时, 所述主时钟停止 与所述从时钟之间的时钟同步操作, 并重新与所述从时钟进行步骤 A及后续步骤, 其中所 述主时钟自身的时钟发生变化包括, 所述主时钟接收到 GPS或完成与其他更高级别的主时 钟的时钟同步操作。
4、如权利要求 1所述的方法, 其特征在于, 所述确定主时钟到从时钟的第一延时包括: 根据每个接收时间信息 T21、 T22 Τ2Ν与对应的每个发送时间信息 Tl l、 T12
Τ 1 Ν的差, 确定主时钟到从时钟的每个待选第一延时;
选择待选第一延时的最小值作为主时钟到从时钟的第一延时;
其中, 确定从时钟到主时钟的第二延时包括:
根据每个接收时间信息 Τ41、 Τ42 Τ4Ν与对应的每个发送时间信息 Τ31、 Τ32
Τ3Ν的差, 确定从时钟到主时钟的每个待选第二延时;
选择待选第二延时的最小值作为从时钟到主时钟的第二延时。
5、 如权利要求 1所述的方法, 其特征在于, 所述确定主时钟到从时钟的第一频率补偿 值包括:
根据每个接收时间信息 Τ21、 Τ22 Τ2Ν与对应的每个发送时间信息 Tl l、 T12
Τ 1 Ν的差, 确定主时钟到从时钟的每个待选第一延时;
选择待选第一延时的最小值对应的 Sync报文 S i , 提取该 Sync报文 S i的发送时间信息 Tl i和接收时间信息 T2 i , 并确定第一频率补偿值, i为位于 1和 N之间的整数;
其中, 确定从时钟到主时钟的第二频率补偿值包括:
根据每个接收时间信息 T61、 T62 Τ6Ν与对应的每个发送时间信息 Τ51、 Τ52
Τ 5 Ν的差, 确定主时钟到从时钟的每个待选第三延时;
选择待选第三延时的最小值对应的 De lay-Re s p报文 S j , 提取该 De lay-Re s p报文 S j的发 送时间信息 T5 j和接收时间信息 T6 j , 并确定第二频率补偿值。
6、 一种跨非 1588网络传输精密时钟报文的系统, 其特征在于, 所述系统包括: 主时钟, 用于在每个时钟同步周期内, 按照设定的时间间隔向从时钟发送多个 Sync报 文 Sl、 S2 SN, 其中每个 Sync^艮文中含有 Sync^艮文的发送时间信息 Tl l、 T12
TIN; 针对接收到的每个 De 1 ay-Re^艮文, 记录接收到每个 De 1 ay-Re^艮文的接收时间信息
T41、 Τ42 Τ4Ν, 并向按照设定的时间间隔向从时钟发送多个 Delay-Resp^艮文 SI、
S2 SN , 其中每个 Delay-Resp报文中包含 Delay-Resp报文的发送时间信息 T51、 Τ52 Τ5Ν, Ν为大于 1的整数;
从时钟, 用于接收主时钟发送的每个 Sync报文, 记录接收每个 Sync报文的接收时间信 息 T21、 Τ22 Τ2Ν, 从时钟在接收到主时钟发送的第一个 Sync^艮文 SI时, 按照设定 的时间间隔向主时钟发送对应的多个 Delay-Re^艮文 Sl、 S2 SN,其中每个 Delay-Req 报文中包含该 Delay-Req报文的发送时间信息 T31、 Τ32 Τ3Ν; 接收主时钟发送的每 个 Delay-Resp报文, 记录接收每个 Delay-Resp报文的接收时间信息 T61、 T62 T6N; 根据每个发送时间信息 Tl l、 T12 TIN和对应的每个接收时间信息 Τ21、 Τ22
Τ2Ν, 确定主时钟到从时钟的第一延时, 以及根据每个发送时间信息 Τ31、 Τ32 Τ3Ν 和对应的每个接收时间信息 Τ41、 Τ42 Τ4Ν, 确定从时钟到主时钟的第二延时, 根 据所述第一延时和第二延时, 确定链路延时并进行时间同步; 根据每个发送时间 T11、
T12 TIN和对应的每个接收时间信息 T21、 Τ22 Τ2Ν, 确定主时钟到从时钟 的第一频率补偿值, 以及根据每个发送时间信息 Τ51、 Τ52 Τ5Ν和对应的每个接收 时间信息 Τ61、 Τ62 Τ6Ν, 确定主时钟到从时钟的第二频率补偿值, 根据所述第一 频率补偿值和第二频率补偿值, 确定主时钟与从时钟的频率补偿值并进行频率同步。
7、 如权利要求 6所述的系统, 其特征在于, 所述主时钟, 具体用于包含 FPGA芯片, 接 收到每个 Delay-Re^艮文, 记录接收时间信息 T4 i , 并立即转发 Delay-Resp^艮文 S i , 其中该 Delay-Res p报文中包含的发送时间信息 T 5 i与 T4 i相等, i为位于 1和 N之间的整数。
8、 如权利要求 6所述的系统, 其特征在于, 所述主时钟, 还用于在当前时钟同步周期 内, 确定自身的时钟发生变化时, 停止与所述从时钟之间的时钟同步操作, 并重新开始与 所述从时钟进行时钟同步操作, 其中所述主时钟自身的时钟发生变化包括, 所述主时钟接 收到 GPS或完成与其他更高级别的主时钟的时钟同步操作。
9、 如权利要求 6所述的系统, 其特征在于, 所述从时钟, 具体用于根据每个接收时间 信息 T21、 Τ22 Τ2Ν与对应的每个发送时间信息 Tl l、 T12 TIN的差, 确定主 时钟到从时钟的每个待选第一延时; 选择待选第一延时的最小值作为主时钟到从时钟的第 一延时; 根据每个接收时间信息 T41、 Τ42 Τ4Ν与对应的每个发送时间信息 Τ31、
Τ32 Τ3Ν的差, 确定从时钟到主时钟的每个待选第二延时; 选择待选第二延时的最 小值作为从时钟到主时钟的第二延时。
10、 如权利要求 6所述的系统, 其特征在于, 所述从时钟, 具体用于根据每个接收时 间信息 Τ21、 Τ22 Τ2Ν与对应的每个发送时间信息 Tl l、 T12 TIN的差, 确定 主时钟到从时钟的每个待选第一延时; 选择待选第一延时的最小值对应的 Sync报文 S i , 提 取该 Sync报文 S i的发送时间信息 Tl i和接收时间信息 T2 i , 并确定第一频率补偿值; 根据每 个接收时间信息 T61、 Τ62 Τ6Ν与对应的每个发送时间信息 Τ51、 Τ52 Τ5Ν的 差, 确定主时钟到从时钟的每个待选第三延时; 选择待选第三延时的最小值对应的 Delay-Resp报文 Sj , 提取该 Delay-Resp报文 S j的发送时间信息 T5 j和接收时间信息 T6 j , 并 确定第二频率补偿值, i为位于 1和 N之间的整数。
PCT/CN2013/082176 2013-08-23 2013-08-23 一种跨非1588网络传输精密时钟报文的方法及系统 WO2015024250A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2013/082176 WO2015024250A1 (zh) 2013-08-23 2013-08-23 一种跨非1588网络传输精密时钟报文的方法及系统

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2013/082176 WO2015024250A1 (zh) 2013-08-23 2013-08-23 一种跨非1588网络传输精密时钟报文的方法及系统

Publications (1)

Publication Number Publication Date
WO2015024250A1 true WO2015024250A1 (zh) 2015-02-26

Family

ID=52482984

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/082176 WO2015024250A1 (zh) 2013-08-23 2013-08-23 一种跨非1588网络传输精密时钟报文的方法及系统

Country Status (1)

Country Link
WO (1) WO2015024250A1 (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101335587A (zh) * 2008-07-23 2008-12-31 重庆邮电大学 工业无线网络的精确时间同步方法
CN101420747A (zh) * 2008-11-12 2009-04-29 华为技术有限公司 同步方法、基站、网络服务器以及通信系统
CN101425891A (zh) * 2008-12-09 2009-05-06 中兴通讯股份有限公司 时间同步方法、系统和客户端

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101335587A (zh) * 2008-07-23 2008-12-31 重庆邮电大学 工业无线网络的精确时间同步方法
CN101420747A (zh) * 2008-11-12 2009-04-29 华为技术有限公司 同步方法、基站、网络服务器以及通信系统
CN101425891A (zh) * 2008-12-09 2009-05-06 中兴通讯股份有限公司 时间同步方法、系统和客户端

Similar Documents

Publication Publication Date Title
US10404608B2 (en) Systems, devices, and methods for low-jitter communication over a packet-switched network
CN103580846B (zh) 一种跨非1588网络传输精密时钟报文的方法及系统
US10158444B1 (en) Event-driven precision time transfer
US8850058B2 (en) Ethernet-based data transmission method, ethernet nodes and control system
KR102031268B1 (ko) 시간-인식 디바이스들 사이에 시간 정보를 통신하는 방법 및 장치
EP2515501B1 (en) Media clock negotiation
JP5495323B2 (ja) ネットワークを介した時刻同期装置
EP2715557B1 (en) Method for improving accuracy in computation of one-way transfer time for network time synchronization
WO2018006686A1 (zh) 一种通信网络设备间时间同步的优化方法、装置及设备
JP2006319972A (ja) ネットワークを介した時間同期化システムおよび方法
JP7394986B2 (ja) データパケットを送信する方法、及びこの方法を実施する装置
CN108028781B (zh) 用于网络往返时间估计的技术
JP6036179B2 (ja) 通信装置及び同期方法
WO2018041108A1 (zh) 确定时间同步报文的时钟时间的方法、装置和设备
JP5891142B2 (ja) 通信システム
WO2015024250A1 (zh) 一种跨非1588网络传输精密时钟报文的方法及系统
CN103441832A (zh) 基于ptp的时钟同步方法、系统和设备
EP2273706B1 (en) Synchronization packet-delay-variation dampening (SPD)
WO2016177240A1 (zh) 一种实现频率同步的方法和装置
US11360505B2 (en) Distributed network time synchronization
Deshpande et al. Towards a Network Aware Model of the Time Uncertainty Bound in Precision Time Protocol
JP6625842B2 (ja) 通信装置、システム及び方法
US20230179314A1 (en) In-band signaling for ingress ptp packets at a master entity
JP2023061877A (ja) 時分割スケジュールの調整方式、通信装置、時分割スケジュールの調整方法
Yang et al. The design and implementation of time synchronization for CNC systems based on switched Ethernet

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13891897

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13891897

Country of ref document: EP

Kind code of ref document: A1