CN114499734B - Communication clock synchronization method, system and equipment based on PTP - Google Patents

Communication clock synchronization method, system and equipment based on PTP Download PDF

Info

Publication number
CN114499734B
CN114499734B CN202210179988.7A CN202210179988A CN114499734B CN 114499734 B CN114499734 B CN 114499734B CN 202210179988 A CN202210179988 A CN 202210179988A CN 114499734 B CN114499734 B CN 114499734B
Authority
CN
China
Prior art keywords
clock
equipment
master
deviation amount
absolute
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202210179988.7A
Other languages
Chinese (zh)
Other versions
CN114499734A (en
Inventor
何志刚
曾黎明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Belong Communication Technology Co ltd
Original Assignee
Nanjing Belong Communication Technology Co ltd
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 Nanjing Belong Communication Technology Co ltd filed Critical Nanjing Belong Communication Technology Co ltd
Priority to CN202210179988.7A priority Critical patent/CN114499734B/en
Publication of CN114499734A publication Critical patent/CN114499734A/en
Application granted granted Critical
Publication of CN114499734B publication Critical patent/CN114499734B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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

Landscapes

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

Abstract

The application provides a communication clock synchronization method, a system and a device based on PTP. In the method, each device can respectively acquire a master clock token as a master clock, and correspondingly acquire a device deviation amount matrix according to the deviation amount between the own crystal oscillator clock of the device uploaded by each level of devices and an absolute clock source signal T. Therefore, each slave device can correct the absolute clock source signal T received by the device according to the subordination relation and the deviation amount corresponding to each node on the synchronous path of the slave device, accurately calibrate the device clock, and solve the problems of accumulated error and synchronization caused by the crystal oscillator error of the device. According to the method and the device, the master-slave relation among all devices in the system can be flexibly adjusted through the circulation of the master clock token, the fact that all devices in the system can accurately calibrate the crystal oscillator clock error is guaranteed in a dynamic mode, the crystal oscillator clock error is corrected through the device deviation quantity matrix, and the fact that all devices in a PTP domain can keep high synchronization in the interval period of each calibration is guaranteed.

Description

Communication clock synchronization method, system and equipment based on PTP
Technical Field
The application relates to the technical field of communication networks, in particular to a communication clock synchronization method, a system and equipment based on PTP.
Background
In a communication network, tasks in each device can be guaranteed to run normally only by network clock synchronization. Therefore, the system uses Precision Time Protocol (PTP) for Time synchronization. A network to which the PTP protocol is applied is called a PTP domain, and generally the PTP domain includes one master clock and more slave clocks. The master clock 10 uses a Global Positioning System (GPS) as a clock source to obtain a GPS absolute clock. The master clock 10 and the slave clocks periodically exchange messages, so that the slave clocks adjust the time thereof according to the exchanged messages, and the time synchronization with the master clock 10 is realized; and then, the slave clock periodically exchanges messages with the downstream slave clock, so that the downstream slave clock adjusts the time of the slave clock according to the exchanged messages, thereby realizing the time synchronization with the slave clock and finally realizing the time synchronization of the whole PTP domain.
When a slave clock has time deviation due to crystal oscillator failure and the like, the synchronization time of the downstream slave clock also deviates correspondingly after the downstream slave clock is synchronized, in this case, the slave clock at the previous stage needs to be calibrated to eliminate the time deviation, so as to eliminate the corresponding time deviation generated by the downstream slave clock. However, due to the failure of the crystal oscillator, even if the slave clock which has failed originally after calibration has time deviation, the time system has deviation amount of each slave clock in the period between each calibration, and a long period is required for calibrating all slave clocks in the PTP domain once, which can seriously affect the operation of the devices in the practical domain.
Disclosure of Invention
Aiming at the defects of the prior art, the utility model provides a communication clock synchronization method, system and equipment based on PTP, which replaces the master clock equipment with the preset master clock period in the mode of master clock token, so that each equipment can be respectively used as the master clock equipment to receive and transmit the absolute clock source signal T, and regularly calibrates the delay of the synchronization path according to the deviation between the absolute clock source signal T and the crystal oscillator clock of the equipment, thereby ensuring the clock synchronization between each equipment of the system. The technical scheme is specifically adopted in the application.
First, in order to achieve the above object, a communication clock synchronization method based on PTP is provided, which includes: each device acquires a master clock token in a preset master clock period respectively and directly receives an absolute clock source signal T from a global positioning system in the valid period of the master clock token; when the master clock token of any equipment is detected to be lost, triggering each equipment to uniformly upload the current equipment time t of each equipment to the equipment currently acquiring the master clock token; the equipment which obtains the master clock token at present respectively calculates the deviation tau of the current equipment time T uploaded by each equipment and the absolute clock source signal T received by each equipment, and establishes and issues a deviation matrix [ D ] of each equipment; and each device calculates the path deviation amount sigma D corresponding to the synchronous path of the device according to the master-slave relationship of the device through the device deviation amount matrix [ D ], and corrects the received upstream device clock according to the path deviation amount sigma D.
Optionally, in the method for synchronizing a communication clock based on PTP, a master clock cycle of each device acquiring the master clock token is as follows: the method comprises the following steps of (1) fixing a time point every day, powering on equipment every time, or networking equipment every time; the step of obtaining the master clock token comprises: the device uploads a token request signal to an absolute clock source at a fixed time point every day, or when the device is powered on every time, or when the device is networked every time, the absolute clock source takes the device number to which the token request signal belongs as a mark value when sending a next absolute clock source signal T, and sends the mark value to each device, and each device decodes the corresponding absolute clock source signal T only when verifying that the device number of the device conforms to the mark value.
Optionally, in the method for synchronizing a communication clock based on a PTP, when each device verifies that the device number does not match the tag value, the following steps are performed: firstly, determining whether the current time belongs to the master clock period of the equipment, if so, judging that the master clock token of the equipment is lost, and triggering the equipment to uniformly upload the current equipment time of the equipment to the equipment which is corresponding to the mark value and currently obtains the master clock token; if not, receiving the upstream device clock according to the master-slave relationship, calculating a path deviation amount sigma D corresponding to the device synchronous path by inquiring the device deviation amount matrix [ D ], and correcting the received upstream device clock according to the path deviation amount sigma D.
Optionally, in the method for synchronizing a communication clock based on PTP, positions of matrix elements in the device deviation amount matrix [ D ] correspond to device numbers one to one, and values of the matrix elements correspond to a deviation amount τ of a current device time T of a corresponding device and an absolute clock source signal T received by the current device time T.
Optionally, in any one of the above methods for synchronizing a communication clock based on PTP, the step of calculating the deviation τ of the current device time T uploaded by the device and the absolute clock source signal T received by the device includes: time M of last obtaining of master clock token by calling device 1 And the current time M 2 Calculating the deviation amount
Figure BDA0003522078220000031
Optionally, in the method for synchronizing a communication clock based on PTP as described in any one of the above, the step of correcting the clock of the upstream device received by the upstream device according to the path deviation amount Σ d includes: respectively calling a device deviation matrix [ D ] according to the master-slave relation]Corresponding to the deviation amount tau of each device on the synchronous path upstream of the device, calculating sigma d = ∑ sigma i∈U τ i ×(M 2 -M 1 ) (ii) a The clock of the upstream equipment received by the equipment is Delay + Offset + ∑ d; where U represents the set of upstream devices in the device's synchronization path, τ i Indicating upstream facilities in a facility synchronization pathCorresponding to the device deviation matrix [ D ]]The amount of deviation in (d).
A PTP based communication clock synchronization system, comprising: the device comprises a plurality of devices with independent crystal oscillator clocks, wherein one or a plurality of devices acquire a master clock token, directly receive an absolute clock source signal T from a global positioning system in the valid period of the master clock token and issue the absolute clock source signal T to the devices step by step, and the other devices synchronize according to the absolute clock source signal T issued to the devices and forward the absolute clock source signal T to the next step; the absolute clock source is used for periodically sending absolute clock source signals T of the global positioning system, receiving token request signals of each device and sending the device number to which the token request signals belong to each device as a mark value to each device when the next absolute clock source signal T is sent according to the token request signals; wherein, between each equipment: when the master clock token of any equipment is lost, triggering each equipment to uniformly upload the current equipment time t of each equipment to the equipment currently acquiring the master clock token; the equipment which obtains the master clock token at present respectively calculates the deviation tau of the current equipment time T uploaded by each equipment and the absolute clock source signal T received by each equipment, and establishes and issues a deviation matrix [ D ] of each equipment; and each device calculates the path deviation amount sigma D corresponding to the synchronous path of the device according to the master-slave relationship of the device through the device deviation amount matrix [ D ], and corrects the received upstream device clock according to the path deviation amount sigma D.
Optionally, in the PTP-based communication clock synchronization system, when each device synchronizes according to the absolute clock source signal T sent to the device: receiving an upstream device clock according to the master-slave relationship, calculating a path deviation amount sigma D corresponding to a synchronous path of the device by inquiring a device deviation amount matrix [ D ], correcting the received upstream device clock according to the path deviation amount sigma D, synchronizing the internal clock of the device to be consistent with the corrected upstream device clock, and forwarding an absolute clock source signal T according to the corrected clock.
Meanwhile, in order to achieve the above object, the present application further provides a communication clock synchronization device based on PTP, including: the control unit is used for synchronizing the clock source signal T according to the absolute clock signal T transmitted to the control unit; the master clock token module uploads a token request signal to an absolute clock source in a preset master clock period, and triggers the control unit to execute when the received marker value is consistent with the serial number of the equipment according to the marker value in the absolute clock source signal T: directly receiving and issuing absolute clock source signals T from a global positioning system, receiving current equipment time T corresponding to the equipment uploaded by other equipment, respectively calculating the deviation tau of the current equipment time T uploaded by the equipment and the absolute clock source signals T received by the equipment, and establishing and issuing a deviation matrix [ D ] of the equipment; and when the received mark value does not accord with the equipment number, the control unit is triggered to execute the following steps: according to the master-slave relation, respectively calculating a path deviation amount sigma D corresponding to the synchronous path of the equipment through an equipment deviation amount matrix [ D ], and correcting the received upstream equipment clock according to the path deviation amount sigma D; and the storage module is used for storing the deviation amount matrix [ D ] of each device.
Optionally, in any one of the above-described communication clock synchronizing devices based on PTP, when the control unit synchronizes according to the absolute clock source signal T sent thereto: receiving an upstream device clock according to the master-slave relation, calculating a path deviation amount sigma D corresponding to the device synchronization path by inquiring a device deviation amount matrix [ D ], correcting the received upstream device clock according to the path deviation amount sigma D, synchronizing the internal clock of the device to be consistent with the corrected upstream device clock, and forwarding an absolute clock source signal T according to the corrected clock.
Advantageous effects
In the method, each device can acquire a master clock token as a master clock in a preset master clock period to issue an absolute clock source signal T to each level of device, and correspondingly acquire a device deviation amount matrix according to the deviation amount between the own crystal oscillator clock of the device uploaded by each level of device and the absolute clock source signal T. Therefore, each slave device can correct the absolute clock source signal T received by the device according to the subordination relation and the deviation amount corresponding to each node on the synchronous path, accurately calibrate the device clock according to the absolute clock source signal T, and overcome the synchronization problem caused by the accumulation of the crystal oscillator error of the device. According to the method and the device, the master-slave relation among the devices in the system can be flexibly adjusted through the circulation of the master clock token, so that the devices in the system can be guaranteed to accurately calibrate the crystal oscillator clock error in a dynamic mode, the crystal oscillator clock error is corrected through the device deviation quantity matrix [ D ], and all the devices in a PTP domain can be guaranteed to keep high synchronization in an interval period between each calibration.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the application.
Drawings
The accompanying drawings are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the principles of the application and not limit the application. In the drawings:
FIG. 1 is a schematic diagram of a synchronization mode of a PTP-based communication clock synchronization system in different master clock token states according to the present application;
FIG. 2 is a schematic flowchart illustrating steps of a PTP-based communication clock synchronization method according to the present application;
fig. 3 is a schematic diagram of the interaction process between the master and slave clock devices in the present application.
Detailed Description
In order to make the purpose and technical solutions of the embodiments of the present application clearer, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings of the embodiments of the present application. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the described embodiments of the application without any inventive step, are within the scope of protection of the application.
It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
The term "connected" as used herein may mean either a direct connection between components or an indirect connection between components via other components.
The meaning of "upper stage and lower stage" in this application refers to that when the absolute clock source signal T is forwarded from itself to another device, the device is the upper stage, and the device receiving the absolute clock source signal T is the lower stage, but not the specific limitation on the device mechanism of this application.
Fig. 1 is a PTP-based communication clock synchronization system according to the present application, which includes: several devices with independent crystal clocks and absolute clock sources consisting of global positioning system.
The absolute clock source periodically sends an absolute clock source signal T of a Global Positioning System (GPS) according to a period of 1 second or 2 seconds, receives a token request signal of each device, and sends a device number to which the token request signal belongs as a mark value to each device when the absolute clock source signal T of the next period is sent according to the token request signal.
And each device in the system is respectively provided with:
the control unit is used for synchronizing the clock source signal T according to the absolute clock signal T transmitted to the control unit;
the master clock token module uploads a token request signal to an absolute clock source in a preset master clock period, and triggers the control unit to execute when the received marker value is consistent with the serial number of the equipment according to the marker value in the absolute clock source signal T: directly receiving and issuing an absolute clock source signal T from a global positioning system, receiving current equipment time T corresponding to the equipment and uploaded by other equipment, respectively calculating the deviation amount tau of the current equipment time T uploaded by the equipment and the absolute clock source signal T received by the equipment, and establishing and issuing an equipment deviation amount matrix [ D ]; and when the received mark value does not accord with the equipment number, the control unit is triggered to execute the following steps: according to the master-slave relation, respectively calculating a path deviation amount sigma D corresponding to the synchronous path of the equipment through an equipment deviation amount matrix [ D ], and correcting the received upstream equipment clock according to the path deviation amount sigma D;
and the storage module is used for storing the deviation amount matrix [ D ] of each device.
In the system, the master-slave relationship of the equipment can be flexibly configured at will in front of the equipment, the equipment nodes can be increased or decreased at will, and the networking relationship corresponding to the upper-level clock of the equipment is configured correspondingly only when the equipment nodes are increased or decreased.
Therefore, at a certain moment, one or a few devices in the system acquire a master clock token, and obtain a master clock authority through verification of a mark value, at this moment, each master clock device can directly receive an absolute clock source signal T from a global positioning system in the valid period of the master clock token, gradually send an absolute clock source signal T to each device, receive current device crystal oscillation time T uploaded by each slave clock device at the next stage, establish and send a slave clock device deviation amount matrix [ D ] according to the current device crystal oscillation time T of each slave clock device and the deviation amount tau of the absolute clock source signal T, respectively represent a specific slave clock device through the position number of each matrix element position in the device deviation amount matrix [ D ], and respectively represent the deviation amount tau between the current device crystal oscillation time T and the absolute clock source signal T in the slave clock device corresponding to the position through the value of each matrix element in the device deviation amount matrix [ D ].
The device deviation amount matrix [ D ] can be used for data storage through a buffer, a register or any format. And the positions of the elements of each matrix in the equipment deviation amount matrix [ D ] are respectively in one-to-one correspondence with the serial numbers of each equipment. Therefore, after receiving the absolute clock source signal T, each slave device can respectively inquire the deviation amount of each device in the device deviation amount matrix [ D ] corresponding to the synchronous forwarding route thereof, thereby calculating the path deviation amount sigma D corresponding to the device synchronous route according to the master-slave forwarding sequence relation of the device, and correcting the received upstream device clock according to the path deviation amount sigma D. Each slave device can also realize clock synchronization according to the corrected accurate clock data after accurately correcting the device clock thereof, and forwards the absolute clock source signal T corresponding to the slave device to the next level slave clock device to which the slave device belongs. In the forwarding process, the absolute clock source signal T can be marked by marking the number of the equipment, so that the master-slave sequence in the clock synchronization process can be directly recorded in the forwarding process of the absolute clock source signal T, and each slave clock equipment can respectively know the corresponding synchronous forwarding path.
Taking the system shown in fig. 1 as an example, each device in the system can be operated according to the manner shown in fig. 2 by configuring the program running in the control unit:
respectively acquiring master clock tokens in a preset master clock period, and directly receiving an absolute clock source signal T from a global positioning system in the valid period of the master clock tokens;
when detecting that the master clock token of the equipment is lost, triggering all the equipment to respectively upload the current equipment time t of each equipment to the equipment currently acquiring the master clock token;
the equipment which obtains the master clock token at present respectively calculates the deviation tau of the current equipment time T uploaded by each equipment and the absolute clock source signal T received by the equipment, and establishes and issues an equipment deviation matrix [ D ];
therefore, each device in the system can respectively calculate the path deviation sigma D corresponding to the synchronous path of the device by inquiring the device deviation matrix [ D ] according to the master-slave relationship, correct the received upstream device clock according to the path deviation sigma D, overcome the accumulated error of the crystal oscillator of the device and the transmission delay on the path, accurately realize the clock synchronization among the devices and keep the running pace of the devices in the system consistent.
Taking the system state shown on the left side of fig. 1 as an example:
when each device in the system is electrified for the first time, a token request signal can be uploaded to an absolute clock source by a first electrified device A, the absolute clock source takes the device number A to which the token request signal belongs as a mark value when sending a next absolute clock source signal T after receiving the request signal and sends the mark value to each subsequent electrified device, and each new electrified device can know that the device A corresponding to the mark value is a main clock device in the period when verifying that the device number does not accord with the mark value, so that a superior-subordinate interactive network is correspondingly organized, and the superior-subordinate clock device sends the corresponding absolute clock source signal T to a subordinate device step by step; and when receiving the absolute clock source signal T, the equipment A can determine that the equipment acquires the master clock token through the mark value, so that the corresponding absolute clock source signal T can be directly decoded, the absolute clock source signal T is respectively issued to the next-stage slave clock equipment B, D and E, the first-stage slave clock equipment B forwards the absolute clock source signal T acquired by the equipment B to the next-stage slave clock equipment C, the equipment E forwards the absolute clock source signal T acquired by the equipment B to the equipment F, and the second-stage slave clock equipment F forwards the absolute clock source signal T acquired by the equipment F to the third-stage slave clock equipment, thereby realizing the clock synchronization among the equipment in the system.
In the step-by-step forwarding process, each device can mark the serial number of the device at the mark tail of the previous device when issuing the absolute clock source signal T after calibration. The step-by-step marking is carried out, namely, the networking grading state among the devices can be provided for other devices in the system by copying step-by-step marking information when the current crystal oscillator device time t of the device is uploaded; or, when receiving the absolute clock source signal T marked at the previous stage, the device may also obtain the classification status according to the marking order, obtain the corresponding information of the devices at the previous stages of the device, and correct the received upstream device clock according to the path deviation amount Σ d by tracing the path deviation amount Σ d of each node device corresponding to the device synchronization path.
Taking device C as an example, when receiving the absolute clock source signal T sent by the superior device B, the device synchronization path obtained according to the marking sequence is GPS → a → B → C. Thereby receiving the upstream device clock according to its master-slave relationship and querying the device offset matrix [ D]Calculating the path deviation amount sigma d = ∑ sigma corresponding to the synchronous path of the equipment i∈U τ i ×(M 2 -M 1 ) Correcting the received upstream device clock according to the path deviation amount Σ d, synchronizing the device internal clock to coincide with the corrected upstream device clock, and forwarding the absolute clock to the next-stage slave clock device in accordance with the corrected clockThe source signal T. Wherein, U represents the collection (A, B) of the upstream equipment in the synchronous path of the equipment, it can be through the mark that the absolute clock source signal T that is forwarded step by step carries from the master clock to the corresponding slave clock apparatus step by step; tau is i A device deviation amount matrix [ D ] representing the correspondence between the upstream devices i = A, B in the device synchronization path]Amount of deviation in (1), M 1 Indicating the time at which the device last acquired the master clock token, M 2 Indicating the current time of day.
When the system time runs to a fixed time point of replacing the master clock every day, or when a new device is powered on, or when a new device is reconnected, or when the original device is powered on or disconnected after power failure and reconnected, a corresponding device, for example, a device B on the right side of fig. 1 uploads a token request signal to an absolute clock source, the absolute clock source receives the request and takes the device number to which the token request signal belongs as a mark value when a next absolute clock source signal T is transmitted, the mark value is issued to each device, the device B, when verifying that the device number of the device B is consistent with the mark value, decodes the corresponding absolute clock source signal T as a new master clock device, and forwards the absolute clock source signal T to a slave clock device C and a next stage.
And other equipment executes the following steps when the mark in the received absolute clock source signal T does not accord with the serial number of the equipment:
it is first determined whether the current time belongs to its master clock cycle,
if the current device time T is the current device time T uploaded by the other devices at the moment, and the deviation amount tau of the absolute clock source signal T received by the current device time T and the absolute clock source signal T received by the current device time T, and the moment M of obtaining the master clock token by each obtained slave clock device for the latest time are obtained 1 And the current time M 2 Calculating the deviation corresponding to the slave clock device
Figure BDA0003522078220000111
Storing the deviation τMemory to device deviation amount matrix [ D]The element position of the corresponding slave clock device in the system represents the deviation amount of the crystal oscillator of the device per se relative to the absolute clock source in the unit clock period, and the accumulated error of the crystal oscillator of the device is corrected by multiplying the deviation amount by the period of the crystal oscillator per se;
if not, determining that the clock is slave clock equipment, then keeping receiving the upstream equipment clock according to the master-slave relation, calculating a path deviation amount sigma D matched with the equipment synchronous path through inquiring an equipment deviation amount matrix [ D ], and correcting the received upstream equipment clock into Delay + Offset + sigma D according to the path deviation amount sigma D;
wherein, the device deviation matrix [ D ] is respectively obtained according to the master-slave relation]Corresponding to the deviation amount tau of each device on the synchronous path upstream of the device, calculating sigma d = ∑ sigma i∈U τ i ×(M 2 -M 1 ) The sum of the accumulated deviation amount of each superior device crystal oscillator clock on the device synchronization path from the last master clock token;
as shown with reference to figure 3 of the drawings,
offset represents the time Offset, i.e., the time-to-arrival slave clock device (slave) -time-to-issue master clock device (master) -transmission delay, where Offset = t 2 -t 1 Delay, where Delay represents the average path Delay and is master->slave and slave->mean value of master. For example, the master clock device time is 2018-03-28, 54 (timestamp: 1522245241000001), the slave clock device just started time is 2000-01-01 00, 26 000123 (timestamp: 946681286000123), delay is 9466816000123-1522245241000001-1000111 = -575563956000011 if 1.000111 seconds. Knowing the difference-575563956000011, the slave clock device can adjust its time.
In which the transmission is delayed
Figure BDA0003522078220000121
I.e. the difference between two arrival times and two transmission times is divided by 2.
Therefore, the method dynamically adjusts the superior-subordinate relation of each device through the master clock token, so that when the control unit of each device synchronizes according to the absolute clock source signal T issued to the control unit: receiving an upstream device clock according to the master-slave relation, calculating a path deviation amount sigma D corresponding to a synchronous path of the device by inquiring a device deviation amount matrix [ D ], correcting the received upstream device clock according to the path deviation amount sigma D, synchronizing the internal clock of the device to be consistent with the corrected upstream device clock, forwarding an absolute clock source signal T according to the corrected clock, realizing that the clock synchronization of the devices in the system is kept completely consistent, and overcoming the accumulated error of the crystal oscillator of each device. Because the superior-inferior relation between each device in the PTP domain is dynamically adjusted in real time, each device can be used as a main clock device to directly compare the deviation between the crystal oscillator clock of the device and the absolute clock source signal T, therefore, the method can accurately obtain the deviation of the crystal oscillator oscillation frequency in each device relative to the clock period of the absolute clock source, thereby calculating and obtaining the accumulated deviation of each device, further obtaining the accurate error of each device in the path relative to the absolute clock source through the superior-inferior relation between the devices, and further ensuring that each device in the system can accurately correct the deviation between the device and the absolute clock between the synchronous time points and accurately synchronize.
The dynamic adjustment mode of the master clock token enables each device in the method to flexibly acquire the master clock authority, so that the addition of new devices or the removal of existing devices in a system cannot be influenced, the networking mode of the system cannot be influenced by the number of the devices in the method, and the superior-subordinate relation of a synchronous path between the devices can be directly acquired by absolutely marking a clock source signal T. The system can more flexibly adjust the superior-subordinate relation between the devices in a master clock token dynamic adjustment mode, is flexible in networking, and cannot influence the clock synchronization effect.
The above are merely embodiments of the present application, and the description is specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the protection scope of the present application.

Claims (10)

1. A communication clock synchronization method based on PTP is characterized by comprising the following steps:
each device acquires a master clock token in a preset master clock period respectively and directly receives an absolute clock source signal T from a global positioning system in the valid period of the master clock token;
when the mark in the received absolute clock source signal T does not accord with the mark value of the equipment number, the following steps are executed:
it is first determined whether the current time belongs to its master clock cycle,
if so, determining that the master clock token of the device is lost,
when the master clock token of any equipment is detected to be lost, triggering each equipment to uniformly upload the current equipment time t of each equipment to the equipment currently acquiring the master clock token;
respectively calculating the deviation tau of the current equipment time T uploaded by each equipment and the absolute clock source signal T received by the equipment which obtains the master clock token at present, and establishing and issuing an equipment deviation matrix [ D ];
and each device calculates the path deviation amount sigma D corresponding to the synchronous path of the device according to the master-slave relationship of the device through the device deviation amount matrix [ D ], and corrects the received upstream device clock according to the path deviation amount sigma D.
2. The PTP-based communication clock synchronization method of claim 1, wherein the master clock cycle at which each device acquires the master clock token is: the method comprises the following steps of (1) fixing a time point every day, powering on equipment every time, or networking equipment every time;
the step of obtaining the master clock token comprises: the device uploads a token request signal to an absolute clock source at a fixed time point every day, or when the device is powered on every time, or when the device is networked every time, the absolute clock source takes the device number to which the token request signal belongs as a mark value when sending a next absolute clock source signal T, and sends the mark value to each device, and each device decodes the corresponding absolute clock source signal T only when verifying that the device number of the device conforms to the mark value.
3. The PTP-based communication clock synchronization method of claim 2, wherein each device verifies its device number and performs the following steps if it does not match the tag value:
when the current time is determined not to belong to the main clock period, the upstream device clock is received according to the master-slave relation, the path deviation amount sigma D matched with the device synchronous path is calculated by inquiring the device deviation amount matrix [ D ], and the received upstream device clock is corrected according to the path deviation amount sigma D.
4. The PTP-based communication clock synchronization method according to claim 2, wherein the matrix element positions in the device deviation amount matrix [ D ] correspond to the device numbers one by one, and the matrix element values correspond to the deviation amount τ of the current device time T of the corresponding device and the absolute clock source signal T received by the current device time T.
5. A PTP based communication clock synchronization method according to any one of claims 1-4, wherein the step of calculating the deviation τ of the current device time T uploaded by the device from its received absolute clock source signal T comprises:
time M of last obtaining of master clock token by calling device 1 And the current time M 2
Figure FDA0004051208360000021
6. The PTP-based communication clock synchronization method of claim 5, wherein the step of correcting the clock of the upstream device received by it in accordance with the path deviation amount Σ d includes:
respectively calling a device deviation matrix [ D ] according to the master-slave relation]Corresponding to the deviation amount tau of each device on the synchronous path upstream of the device, calculating sigma d = ∑ sigma i∈U τ i ×(M 2 -M 1 );
The clock of the upstream equipment received by the equipment is Delay + Offset + ∑ d;
where U represents the set of upstream devices in the device synchronization path, τ i A device deviation amount matrix [ D ] representing the amount of deviation of each upstream device in the device synchronization path]The amount of deviation in (2).
7. A PTP-based communication clock synchronization system, comprising:
the device comprises a plurality of devices with independent crystal oscillator clocks, wherein one or a plurality of devices acquire a master clock token, directly receive an absolute clock source signal T from a global positioning system in the valid period of the master clock token and issue the absolute clock source signal T to the devices step by step, and the other devices synchronize according to the absolute clock source signal T issued to the devices and forward the absolute clock source signal T to the next step;
the absolute clock source is used for periodically sending absolute clock source signals T of the global positioning system, receiving token request signals of each device and sending the device number to which the token request signals belong to each device as a mark value to each device when the next absolute clock source signal T is sent according to the token request signals;
wherein, between each equipment:
when the mark in the received absolute clock source signal T does not accord with the mark value of the equipment number, the following steps are executed:
it is first determined whether the current time belongs to its master clock cycle,
if so, determining that the master clock token of the device is lost,
when the master clock token of any equipment is lost, triggering each equipment to uniformly upload the current equipment time t of each equipment to the equipment currently acquiring the master clock token;
the equipment which obtains the master clock token at present respectively calculates the deviation tau of the current equipment time T uploaded by each equipment and the absolute clock source signal T received by each equipment, and establishes and issues a deviation matrix [ D ] of each equipment;
and each device calculates the path deviation amount sigma D corresponding to the synchronous path of the device according to the master-slave relationship of the device through the device deviation amount matrix [ D ], and corrects the received upstream device clock according to the path deviation amount sigma D.
8. The PTP-based communication clock synchronization system of claim 7, wherein when each device synchronizes according to the absolute clock source signal T sent to it: receiving an upstream device clock according to the master-slave relation, calculating a path deviation amount sigma D corresponding to the device synchronization path by inquiring a device deviation amount matrix [ D ], correcting the received upstream device clock according to the path deviation amount sigma D, synchronizing the internal clock of the device to be consistent with the corrected upstream device clock, and forwarding an absolute clock source signal T according to the corrected clock.
9. A PTP-based communication clock synchronizing apparatus, comprising:
the control unit is used for synchronizing the clock source signal T according to the absolute clock signal T transmitted to the control unit;
the master clock token module uploads a token request signal to an absolute clock source in a preset master clock period, and triggers the control unit to execute when the received marker value is consistent with the serial number of the equipment according to the marker value in the absolute clock source signal T: directly receiving and issuing absolute clock source signals T from a global positioning system, receiving current equipment time T corresponding to the equipment uploaded by other equipment, respectively calculating the deviation tau of the current equipment time T uploaded by the equipment and the absolute clock source signals T received by the equipment, and establishing and issuing a deviation matrix [ D ] of the equipment; and when the received mark value does not accord with the equipment number, the control unit is triggered to execute the following steps: firstly, determining whether the current time belongs to the main clock period of the equipment, if so, judging that the main clock token of the equipment is lost, if not, respectively calculating a path deviation amount sigma D corresponding to the synchronous path of the equipment through an equipment deviation amount matrix [ D ] according to the master-slave relationship, and correcting the received upstream equipment clock according to the path deviation amount sigma D;
and the storage module is used for storing the deviation amount matrix [ D ] of each device.
10. The PTP-based communication clock synchronization apparatus according to claim 9, wherein when the control unit synchronizes according to the absolute clock source signal T sent thereto: receiving an upstream device clock according to the master-slave relation, calculating a path deviation amount sigma D corresponding to the device synchronization path by inquiring a device deviation amount matrix [ D ], correcting the received upstream device clock according to the path deviation amount sigma D, synchronizing the internal clock of the device to be consistent with the corrected upstream device clock, and forwarding an absolute clock source signal T according to the corrected clock.
CN202210179988.7A 2022-02-25 2022-02-25 Communication clock synchronization method, system and equipment based on PTP Active CN114499734B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210179988.7A CN114499734B (en) 2022-02-25 2022-02-25 Communication clock synchronization method, system and equipment based on PTP

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210179988.7A CN114499734B (en) 2022-02-25 2022-02-25 Communication clock synchronization method, system and equipment based on PTP

Publications (2)

Publication Number Publication Date
CN114499734A CN114499734A (en) 2022-05-13
CN114499734B true CN114499734B (en) 2023-03-28

Family

ID=81483771

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210179988.7A Active CN114499734B (en) 2022-02-25 2022-02-25 Communication clock synchronization method, system and equipment based on PTP

Country Status (1)

Country Link
CN (1) CN114499734B (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1798018A (en) * 2004-12-30 2006-07-05 中兴通讯股份有限公司 Device and method for synchronizing system clock
CN203596827U (en) * 2013-08-16 2014-05-14 北京卓越信通电子股份有限公司 Time synchronization system, switch, and embedded interface board
EP3382918B1 (en) * 2017-03-30 2022-09-28 ADVA Optical Networking SE System and method of clock management in a packet data network
CN111490843B (en) * 2020-04-03 2021-10-26 腾讯科技(深圳)有限公司 Time checking method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN114499734A (en) 2022-05-13

Similar Documents

Publication Publication Date Title
US8576883B2 (en) Measurement and adjustment of real-time values according to residence time in networking equipment without access to real time
US5566180A (en) Method for recognizing events and synchronizing clocks
US8295267B2 (en) Clock synchronization system, method, and apparatus for communication
KR101175882B1 (en) A method for distributing a common time reference within a distributed architecture
CN101425865B (en) Method and system for synchronizing clock of transmission network as well as subordinate clock side entity
US20080298398A1 (en) Transparent Spider
US20090135677A1 (en) System and method for application layer time synchronization without creating a time discrepancy or gap in time
CN105450384A (en) Synchronous clock time synchronization apparatus for communication module
EP2811672A1 (en) Communication apparatus, communication system, and communication method for time synchronization
US11456849B2 (en) Method and apparatus for synchronizing different communication ports
CN110719135A (en) Time calibration method and system and electronic device
WO2017032113A1 (en) Method and apparatus for measuring time synchronization deviation
CN110113127B (en) Method and system for transmitting time based on 1588 protocol
JP6227888B2 (en) Communication system, synchronization system, and communication method
US6647026B1 (en) Frame phase synchronous system and a method thereof
US8369308B2 (en) Remote I/O system and synchronization method in the same
WO2014101668A1 (en) Time synchronization processing method and apparatus
CN114499734B (en) Communication clock synchronization method, system and equipment based on PTP
JP2012178770A (en) Time synchronizing system
US20220026857A1 (en) Time transmission correction device, time transmission system, and delay measurement method
WO2013161110A1 (en) Communication system, communication device and time information correction method
CN101420281A (en) Be used between network element, transmitting the method and apparatus of time value in a few days
KR20190072745A (en) Stable Network-based Time Synchronization Method
EP3068076A1 (en) Automatic determination of asymmetrical delay in transmission networks
JP3538374B2 (en) Time supply system and time supply device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant