CN-122027064-A - Time-sensitive network time synchronization method based on frequency overcompensation
Abstract
The invention discloses a time synchronization method of a time sensitive network based on frequency overcompensation, and belongs to the technical field of deterministic communication. The method comprises five steps of message receiving and analyzing, synchronization times judging, primary phase synchronization, secondary phase synchronization, frequency ratio calculation and frequency overcompensation. The slave clock adopts a phase adjustment mode to complete initial alignment and calculate the frequency ratio of the master clock and the slave clock when receiving time synchronization messages for the first time and the second time, the phase is kept unchanged from the third time of synchronization, and the local clock frequency is adjusted by calculating an overcompensation coefficient, so that the slave clock has the same display time as the master clock when the next synchronization period arrives. The invention replaces the traditional phase adjustment mode by the frequency overcompensation mechanism, so that the local time of the slave clock is continuously changed without jumping, the clock stride phenomenon is fundamentally eliminated, the problem that the gating scheduling period is skipped or repeatedly executed due to clock stride is avoided, and the deterministic transmission characteristic of the time-sensitive network is ensured.
Inventors
- ZHONG ZUTING
- XU ZHENLONG
- ZHANG PENG
- WU PANFENG
Assignees
- 山东航天电子技术研究所
Dates
- Publication Date
- 20260512
- Application Date
- 20251212
Claims (8)
- 1. The time synchronization method of the time sensitive network based on the frequency overcompensation is characterized by comprising the following steps: S1, a message receiving and analyzing step, namely receiving a time synchronization message sent by a previous clock to be synchronized by a slave clock, analyzing message information and obtaining time stamp information of a master clock; S2, judging the synchronous times, namely judging the current time of receiving the time synchronous message according to the analysis result, if the time synchronous message is the first time, executing the step S3, if the time synchronous message is the second time, executing the step S4, and if the time synchronous message is the third time or more, executing the step S5; s3, a first phase synchronization step, namely keeping the local clock frequency of the slave clock unchanged, and adjusting the phase of the slave clock to enable the display time of the slave clock to be consistent with the display time of the master clock; S4, the secondary phase synchronization and frequency ratio calculation step, namely keeping the local clock frequency of the slave clock unchanged, adjusting the phase of the slave clock to be consistent with the phase of the master clock, and calculating the frequency ratio of the master clock and the slave clock according to the time stamp of the master clock and the slave clock in the last synchronization; And S5, the frequency overcompensation step is to keep the phase of the slave clock unchanged, calculate an overcompensation coefficient according to the time deviation and the synchronous period of the current master clock and adjust the local clock frequency of the slave clock according to the overcompensation coefficient so that the slave clock has the same display time as the master clock when the next synchronous period arrives.
- 2. A time synchronization method for a frequency overcompensation based time sensitive network according to claim 1, wherein the step S1 comprises the following sub-steps: s11, receiving the previous stage clock according to a fixed synchronization period from the communication interface of the clock A time synchronization message is sent; S12, analyzing the time synchronization message, and extracting a master clock sending time stamp and a master clock receiving time stamp carried in the message; s13, recording a local time stamp when the slave clock locally receives the message, and generating an analysis result containing master-slave clock time stamp information.
- 3. A time synchronization method for a frequency overcompensation based time sensitive network according to claim 1, wherein the step S2 comprises the sub-steps of: S21, setting a synchronous counter, wherein the initial value is 0, and adding 1 to the counter after receiving a time synchronous message each time; s22, reading the current counter value According to The value of (2) makes branch judgment when When the first synchronization state is marked When the signal is marked as a secondary synchronous state When the synchronous state is marked as a steady state synchronous state; s23, jumping to a corresponding processing step according to the synchronous state of the mark.
- 4. A time synchronization method for a frequency overcompensation based time sensitive network according to claim 1, wherein the step S3 comprises the sub-steps of: s31, according to the analysis result, obtaining the display time of the master clock in the first synchronization ; S32, obtaining the local display time of the slave clock in the first synchronization ; S33, calculating time deviation of master clock and slave clock ; S34, directly setting the local time of the slave clock as the master clock time, namely enabling the slave clock display time to be equal to Completing the first phase synchronization; s35, storing the master clock time stamp of the synchronous moment And slave clock time stamping For use in subsequent frequency calculations.
- 5. The method for time synchronization of a frequency overcompensation based time sensitive network according to claim 1, wherein the step S4 comprises the following sub-steps: S41, according to the analysis result, obtaining the display time of the main clock in the second synchronization ; S42, obtaining the local display time of the slave clock in the second synchronization ; S43, adjusting the phase of the slave clock to enable the display time of the slave clock and the master clock time Consistent; s44, reading the master-slave clock time stamp stored in the step S35 during the first synchronization And ; S45, calculating the master-slave clock frequency ratio according to the following formula according to the time stamp of the two times of synchronization : ; Wherein, the Is the ratio of the slave clock frequency to the master clock frequency; A local timestamp of the slave clock at the second synchronization; A local timestamp of the slave clock at the first synchronization; a time stamp of the master clock at the time of the second synchronization; A time stamp of the master clock at the time of first synchronization; s46, storing the master-slave clock time stamp and the frequency ratio of the current synchronization For use in the frequency overcompensation step.
- 6. The method for time synchronization of a frequency overcompensation based time sensitive network according to claim 1, wherein the step S5 comprises the following sub-steps: S51, obtaining the current first Display time of master clock in secondary synchronization And local display time of slave clock ; S52, reading the last time Master clock timestamp saved at secondary synchronization ; S53, calculating the time deviation of the current master-slave clock ; S54, calculating the time increment of the master clock in the synchronous period ; S55, calculating an overcompensation coefficient according to the following formula : ; Wherein, the The slave clock frequency is used for representing the proportion of the slave clock frequency to be adjusted relative to the master clock frequency; is the first A timestamp of the master clock at the time of secondary synchronization; is the first Local timestamp of slave clock at secondary synchronization; is the first A timestamp of the master clock at the time of secondary synchronization; S56, according to the overcompensation coefficient Adjusting the local clock frequency of the slave clock, wherein the adjusted frequency ratio is After a synchronization period, the display time of the slave clock is consistent with the display time of the master clock; s57, updating and storing the master-slave clock time stamp of the current synchronization for the next frequency overcompensation calculation.
- 7. The method for time synchronization of frequency overcompensation based on time sensitive network according to claim 6, wherein in the step S56, the adjusted new frequency ratio is Calculated according to the following formula: ; Wherein, the A new frequency ratio of the slave clock relative to the master clock after adjustment; To from the first Subsynchronization to the first A time increment of the slave clock during the secondary synchronization; To from the first Subsynchronization to the first A time increment of the master clock during the secondary synchronization; is the first A timestamp of the master clock at the time of secondary synchronization; is the first Local timestamp of slave clock at secondary synchronization; is the first The time stamp of the master clock in the secondary synchronization, and the value 1 represents the reference ratio when the frequencies of the master clock and the slave clock are the same.
- 8. The time synchronization method of a time sensitive network based on frequency overcompensation according to claim 1, wherein the frequency overcompensation operation of step S5 is performed in each synchronization period, and gradual synchronization convergence of master-slave clocks is achieved by continuous frequency fine tuning, so as to avoid clock strides caused by phase jumps.
Description
Time-sensitive network time synchronization method based on frequency overcompensation Technical Field The invention relates to the technical field of deterministic communication, in particular to a time synchronization method of a time sensitive network based on frequency overcompensation. Background Time sensitive networks are a new deterministic ethernet technology based on the IEEE802.1 family of standards, whose design goal is to provide bounded and predictable latency guarantees for data transmission on a traditional ethernet basis. The time sensitive network can meet the severe requirements of industrial control, vehicle-mounted communication, avionics and other fields on real-time performance and certainty by introducing time-aware shaping, flow scheduling, frame preemption and other mechanisms. In a protocol system of a time sensitive network, an IEEE802.1Qbv time perception shaper protocol and an IEEE802.1Qci flow supervision protocol are core protocols for realizing deterministic transmission, and the protocols control the sending and forwarding of data frames through a pre-planned time window so as to ensure that key data can reach a destination node in a preset time. Time synchronization is a fundamental support technique for time-sensitive networks to implement deterministic transmissions. Each node in the time sensitive network needs to maintain a highly consistent time reference to ensure that each node can perform gating scheduling operations according to a uniform schedule. The IEEE802.1as protocol defines a time synchronization mechanism in time sensitive networks, which is adapted and optimized for ethernet based on the IEEE1588 precision time protocol. In the time synchronization process, one master clock is used as a global time reference in the network, and other slave clocks calibrate the local time of the slave clocks by periodically receiving time synchronization messages sent by the master clock, so that all nodes in the whole network keep time consistent. Existing time synchronization techniques commonly employ a control mechanism that combines phase adjustment with frequency adjustment. The phase adjustment refers to directly modifying the local time value of the slave clock to align with the master clock in time, and the frequency adjustment refers to adjusting the running frequency of the slave clock to be consistent with the frequency of the master clock. In the actual synchronization process, the slave clock generally needs to eliminate the time deviation from the master clock through phase adjustment, and then maintain the time synchronization state of the slave clock and the master clock through frequency adjustment. However, the phase adjustment process causes a clock stepping phenomenon, i.e., a discrete transition from the local time of the clock, which is represented as a positive or negative transition of the time value. The deterministic transmission characteristics of time-sensitive networks are severely affected by clock strides. The ieee802.1qbv protocol controls the sending time of various data frames through a preset gating and scheduling period, each gating period is divided into a plurality of time windows, and data frames with different priorities can only be sent in the corresponding time windows. When a clock stride occurs from the clock, its local time may span one or more gating schedule periods, which may result in some time windows being skipped to fail to transmit a data frame that is to be transmitted, or some time windows being repeatedly performed to transmit a data frame that is not to be transmitted. This situation can disrupt the carefully planned traffic scheduling scheme of the time-sensitive network, such that critical data frames cannot be transmitted within the expected time, ultimately resulting in the entire network losing deterministic transmission capacity. Therefore, how to avoid clock stride phenomenon under the premise of ensuring time synchronization accuracy is a key problem to be solved in time synchronization technology of time sensitive network. Disclosure of Invention In order to solve the problems in the background technology, the invention provides a time synchronization method of a time sensitive network based on frequency overcompensation, which comprises the following steps: S1, a message receiving and analyzing step, namely receiving a time synchronization message sent by a previous clock to be synchronized by a slave clock, analyzing message information and obtaining time stamp information of a master clock; S2, judging the synchronous times, namely judging the current time of receiving the time synchronous message according to the analysis result, if the time synchronous message is the first time, executing the step S3, if the time synchronous message is the second time, executing the step S4, and if the time synchronous message is the third time or more, executing the step S5; s3, a first phase synchronization step, nam