Network node time synchronization method and industrial internet
By periodically detecting and correcting the frequency offset rate and transmission delay of the slave node clock, the synchronization of the slave node clock is achieved based on the master node clock, which solves the problem of clock synchronization in the industrial control network, improves synchronization efficiency and accuracy, and reduces costs.
Patent Information
- Application Number
- CN202411851369.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-06-13
AI Technical Summary
In the field of industrial control, it is very important to maintain clock synchronization of each node in the network, but the prior art is difficult to effectively solve the problem of the synchronization of slave node clocks and master node clocks, especially under the influence of frequency offset rate and transmission delay.
By determining the master node and slave node in the network, the frequency offset rate and transmission delay of the slave clock relative to the master clock are periodically detected, and the current timestamp of the slave clock is corrected based on the current timestamp of the master clock, synchronizing the slave clock and the master clock is achieved.
While maintaining the clocks of each node in the network, this method reduces the cost of synchronization and improves the efficiency and accuracy of network clock synchronization.
Smart Images

Figure CN120150883A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of industrial Internet. More specifically, the present invention relates to a time synchronization method for network nodes and an industrial Internet. Background Art
[0002] As an important carrier of intelligent manufacturing, robots are called "the pearl on the crown of manufacturing" and are a strong driving force for promoting industrial transformation and upgrading.
[0003] Real-time monitoring and remote operation and maintenance of robots are one of the core contents of the robot industrial Internet, providing functions such as real-time device status monitoring, data collection, storage, device management, operation and maintenance, etc., meeting customer needs such as device management, alarm management, energy consumption management, data statistics, and device fault monitoring and analysis, and helping enterprises achieve efficient operation management of devices and realize the digitization and automation of device management.
[0004] For fields such as industrial control, all tasks are based on a time reference. How to maintain clock synchronization among nodes in the network is very important. Summary of the Invention
[0005] The present invention provides a time synchronization method for network nodes, aiming to improve the above problems.
[0006] The present invention is implemented as follows. A time synchronization method for network nodes is as follows:
[0007] (1) Determine the master node and slave nodes in the network;
[0008] (2) Periodically detect the frequency offset rate Rf of the slave clock relative to the master clock and the transmission delay Ndelay between the master node and the slave node, and correct the current timestamp of the slave clock based on the current timestamp of the master clock to achieve synchronization between the slave clock and the master clock.
[0009] Furthermore, the accuracy of the master clock on the master node is higher than that of the slave clock on the slave node.
[0010] Furthermore, the process of obtaining the frequency deviation between the master node and the slave node is as follows:
[0011] The master node sends a first sync message, and the master clock generates a timestamp T when sending the first sync message 1 , the slave node receives the first sync message sent by the master node, and the slave clock generates a timestamp T when receiving the first sync message 2 ;
[0012] The master node sends a first Follow_up message, and the first Follow_up message carries the timestamp T when sending the first sync message1 Receive the first Follow_up message from the slave node, and obtain the timestamp T when the first sync message was sent after parsing 1 ;
[0013] The master node sends the second sync message, and the master clock generates the timestamp T when the second sync message is sent 3 The slave node receives the second sync message sent by the master node, and the slave clock generates the timestamp T when the second sync message is received 4 ;
[0014] The master node sends the second Follow_up message, and the second Follow_up message carries the timestamp T when the second group of sync messages is sent 3 The slave node receives the second Follow_up message, and obtains the timestamp T when the second sync message is sent after parsing 3 ;
[0015] The slave node calculates the frequency offset rate Rf of its slave clock relative to the master clock based on the timestamp T 1 to the timestamp T 4 to calculate its frequency offset rate Rf of the slave clock relative to the master clock
[0016] Furthermore, the calculation formula of the frequency offset rate Rf is specifically as follows:
[0017]
[0018] Furthermore, the process of obtaining the transmission delay Ndelay between the master node and the slave node is specifically as follows:
[0019] The slave node sends a Pdelay_Req message to the master node, and the slave clock generates the timestamp T when the Pdelay_Req message is sent 5 The master node receives the Pdelay_Req message, and the master clock generates the timestamp T when the Pdelay_Req message is received 6 ;
[0020] The master node sends a Pdelay_Resp message, and the master clock generates the timestamp T when the Pdelay_Resp message is sent 7 The Pdelay_Resp message carries the timestamp T when the Pdelay_Req message is received 6 ;
[0021] The slave node receives the Pdelay_Resp message, and the slave clock generates the timestamp T when the Pdelay_Resp message is received 8 Parse the Pdelay_Resp message to obtain the timestamp T when the Pdelay_Req message is received 6 ;
[0022] The master node sends a third Follow_up message, and the third Follow_up message carries the timestamp T when the Pdelay_Resp message is sent. 7 The slave node receives the third Follow_up message, and after parsing, obtains the timestamp T when the Pdelay_Resp message is sent. 7 ;
[0023] Based on the timestamp T 5 to the timestamp T 8 the slave node calculates the transmission delay Ndelay between it and the master node at the current frequency offset rate Rf.
[0024] Furthermore, the calculation formula of the transmission delay Ndelay is specifically as follows:
[0025]
[0026] Furthermore, the method for correcting the slave clock timestamp based on the master clock timestamp is specifically as follows:
[0027] The master node sends a third sync message, and the master clock generates the timestamp T when the third sync message is sent. 9 The slave node receives the third sync message sent by the master node, and the slave clock generates the timestamp T when the third sync message is received. 10 ;
[0028] The master node sends a fourth Follow_up message, and the fourth Follow_up message carries the timestamp T when the third sync message is sent. 9 The slave node receives the fourth Follow_up message, and after parsing, obtains the timestamp T when the third sync message is sent. 9 Based on the timestamp T 9 and the timestamp T 10 calculate the slave clock timestamp T synchronized with the master clock timestamp T at the current frequency offset rate Rf and transmission delay Ndelay. b a a .
[0029] Furthermore, the time formula of the timestamp T corresponding to the slave clock is specifically as follows: a
[0030]
[0030] T a = T 9 + Ndelay + Rf * (T b - T 10 ).
[0031] The present invention is implemented as follows. An industrial Internet of Things, the industrial Internet of Things includes:
[0032] At least one master node and slave nodes networked with the master node. The master node and the slave nodes periodically correct the timestamps of the slave nodes based on the time synchronization method of the above network nodes.
[0033] In the present invention, a master clock with high clock accuracy is set in the network, and the time of the slave clock is calibrated based on the master clock regularly. While keeping the clocks of each node in the network basically synchronized, the cost required to keep the network clock basically synchronized is relatively low. Description of the Drawings
[0034] Figure 1 It is a schematic diagram of the time synchronization method for network nodes provided by an embodiment of the present invention. Embodiment
[0036] The following will further describe in detail the specific embodiments of the present invention by describing the embodiments with reference to the drawings, so as to help those skilled in the art to have a more complete, accurate and in-depth understanding of the inventive concept and technical solution of the present invention.
[0037] Figure 1 It is a schematic diagram of the time synchronization method for network nodes provided by an embodiment of the present invention. The method is as follows:
[0038] (1) Determine the master node in the time-sensitive network TSN, and the remaining nodes are slave nodes. The accuracy of the master clock on the master node is higher than that of the slave clock on the slave nodes.
[0039] (2) Periodically detect the frequency offset rate Rf of the slave clock relative to the master clock and the transmission delay Ndelay between the master node and the slave nodes, and then correct the current timestamp of the slave clock based on the current timestamp of the master clock to achieve the synchronization of the slave clock and the master clock.
[0040] Correct the timestamp of the slave clock based on the timestamp of the master clock to achieve the time synchronization of the slave clock and the master clock.
[0041] In the example of the present invention, a master node is set in the time-sensitive network TSN composed of multiple nodes, and the remaining nodes in the time-sensitive network TSN are set as slave nodes. The clock on the master node is called the master clock, and the clock on the slave node is called the slave clock. The slave node generates the timestamp on the data packet based on the slave clock. However, the device price of the slave clock is relatively low and the accuracy is poor. During use, the problem of increasing time deviation occurs as the use time increases. To improve the above problem, the present invention sets a master node. The accuracy of the clock adopted by the master node is extremely high, and the price of the master clock is also relatively high. The slave clock uses the master clock as a reference and corrects its own timestamp regularly to avoid the long-term accumulation of time deviation.
[0042] In an embodiment of the present invention, all slave nodes in a Time-Sensitive Network (TSN) need to periodically correct timestamps based on the master clock of the master node. The process of correcting the timestamp of the slave clock is as follows: Determine the frequency offset rate Rf of the slave clock relative to the master clock, determine the transmission delay Ndelay between the master node and the slave node based on the frequency offset rate Rf, and correct the timestamp of the slave clock based on the timestamp of the master clock to achieve synchronization between the slave clock and the master clock.
[0043] (21) Detect the current frequency offset rate Rf of the slave clock relative to the master clock:
[0044] In an actual Time-Sensitive Network (TSN), the frequencies of each node are often not exactly the same. Therefore, two sets of sync messages and two sets of Follow_up messages are required to calculate the frequency deviation between each node. The process of obtaining the frequency deviation between the master node and the slave node is as follows:
[0045] The master node sends the first sync message, and the master clock generates the timestamp T when sending the first sync message 1 , and the slave node receives the first sync message sent by the master node, and the slave clock generates the timestamp T when receiving the first sync message 2 ;
[0046] The master node sends the first Follow_up message, and the first Follow_up message carries the timestamp T when sending the first sync message 1 , and the slave node receives the first Follow_up message, and obtains the timestamp T when sending the first sync message after parsing 1 ;
[0047] The master node sends the second sync message, and the master clock generates the timestamp T when sending the second sync message 3 , and the slave node receives the second sync message sent by the master node, and the slave clock generates the timestamp T when receiving the second sync message 4 ;
[0048] The master node sends the second Follow_up message, and the second Follow_up message carries the timestamp T when sending the second sync message 3 , and the slave node receives the second Follow_up message, and obtains the timestamp T when sending the second sync message after parsing 3 ;
[0049] The slave node calculates the frequency offset rate Rf of the slave clock relative to the master clock based on the timestamp T 1 to the timestamp T 4 . The specific calculation formula is as follows:
[0050]
[0051] (22) Detect the transmission delay Ndelay between the master node and the slave node;
[0052] In the embodiment of the present invention, the process of obtaining the transmission delay Ndelay between the master node and the slave node is as follows:
[0053] The slave node sends a Pdelay_Req message to the master node, and the slave clock generates a timestamp T when sending the Pdelay_Req message 5 ;
[0054] The master node receives the Pdelay_Req message, and the master clock generates a timestamp T when receiving the Pdelay_Req message 6 ;
[0055] The master node sends a Pdelay_Resp message, and the master clock generates a timestamp T when sending the Pdelay_Resp message 7 , and the Pdelay_Resp message carries the timestamp T when receiving the Pdelay_Req message 6 ;
[0056] The slave node receives the Pdelay_Resp message, and the slave clock generates a timestamp T when receiving the Pdelay_Resp message 8 , and parses the Pdelay_Resp message to obtain the timestamp T when receiving the Pdelay_Req message 6 ;
[0057] The master node sends a third Follow_up message ( Figure 1 the Pdelay_Resp_Follow_up message in 7 ), and the third Follow_up message carries the timestamp T when sending the Pdelay_Resp message 7 ;
[0058] The slave node calculates the transmission delay Ndelay between it and the master node under the current frequency offset rate Rf based on the timestamp T 5 to the timestamp T 8 , and the specific calculation formula of the transmission delay Ndelay is as follows:
[0059]
[0060] (23) After detecting the frequency offset rate Rf and the transmission delay Ndelay, the slave node corrects the timestamp of its slave clock based on the current timestamp of the master clock;
[0061] In the embodiment of the present invention, the slave clock timestamp correction method based on the master clock timestamp is as follows:
[0062] The master node sends a third sync message, and the master clock generates a timestamp T when sending the third sync message 9 , the slave node receives the third sync message sent by the master node, and the slave clock generates a timestamp T when receiving the third sync message 10 ;
[0063] The master node sends a fourth Follow_up message, and the fourth Follow_up message carries the timestamp T when sending the third sync message 9 , the slave node receives the fourth Follow_up message, and after parsing, obtains the timestamp T when sending the third sync message 9 , based on the timestamp T 9 and the timestamp T 10 calculate the current frequency offset rate Rf and the transmission delay Ndelay, and the slave clock timestamp T synchronized with the master clock timestamp T b , and the time formula of the timestamp T corresponding to the slave clock a is specifically as follows:
[0064] T a = T 9 + Ndelay + Rf * (T b - T 10 ) .
[0065] The embodiment of the present invention also provides an industrial Internet, which includes:
[0066] At least one master node, and slave nodes networked with the master node. The master node and the slave nodes periodically correct the timestamps of each slave node through the time synchronization method of the above network nodes.
[0067] By setting a master clock with high clock accuracy in the network and regularly calibrating the time of the slave clock based on the master clock, while keeping the clocks of each node in the network basically synchronized, and the cost required to keep the network clock basically synchronized is relatively low.
[0068] The present invention has been described exemplarily. Obviously, the specific implementation of the present invention is not limited by the above methods. As long as various non-substantive improvements are made by adopting the method concept and technical solution of the present invention, or the concept and technical solution of the present invention are directly applied to other occasions without improvement, they are all within the protection scope of the present invention.
Claims
1. A time synchronization method for network nodes, characterized in that: The method is specifically as follows: (1) Determine the master node and slave node in the network; (2) Periodically detect the frequency offset rate Rf of the slave clock relative to the master clock and the transmission delay Ndelay between the master node and the slave node, and correct the current timestamp of the slave clock based on the current timestamp of the master clock to achieve synchronization between the slave clock and the master clock.
2. The time synchronization method of network nodes as claimed in claim 1, characterized in that: The master clock on the master node is more accurate than the slave clock on the slave node.
3. The time synchronization method of network nodes as claimed in claim 1, characterized in that: The frequency deviation acquisition process between the master node and the slave node is as follows: The master node sends a first sync message, the master clock generates a timestamp T1 when the first sync message is sent, the slave node receives the first sync message sent by the master node, and the slave clock generates a timestamp T2 when the first sync message is received; The master node sends a first Follow_up message, which carries the timestamp T1 when the first sync message is sent. The slave node receives the first Follow_up message, and obtains the timestamp T1 when the first sync message is sent after parsing. The master node sends a second sync message, the master clock generates a timestamp T3 when the second sync message is sent, the slave node receives the second sync message sent by the master node, and the slave clock generates a timestamp T4 when the second sync message is received; The master node sends a second Follow_up message, which carries the timestamp T3 when the second sync message is sent. The slave node receives the second Follow_up message, parses it, and obtains the timestamp T3 when the second sync message is sent. The slave node calculates the frequency offset rate Rf of the slave clock relative to the master clock based on timestamps T1 to T4.
4. The time synchronization method of network nodes as claimed in claim 3, characterized in that: The calculation formula of the frequency deviation rate Rf is as follows:
5. The time synchronization method of network nodes as claimed in claim 1, characterized in that: The specific process of obtaining the transmission delay Ndelay between the master node and the slave node is as follows: The slave node sends a Pdelay_Req message to the master node, and the slave clock generates a timestamp T5 when the Pdelay_Req message is sent; The master node receives the Pdelay_Req message, and the master clock generates a timestamp T6 when the Pdelay_Req message is received; The master node sends a Pdelay_Resp message, and the master clock generates a timestamp T7 when the Pdelay_Resp message is sent. The Pdelay_Resp message carries a timestamp T6 when the Pdelay_Req message is received. The slave node receives the Pdelay_Resp message, generates a timestamp T8 when the Pdelay_Resp message is received from the clock, and parses the Pdelay_Resp message to obtain a timestamp T6 when the Pdelay_Req message is received; The master node sends a third Follow_up message, which carries the timestamp T7 when the Pdelay_Resp message is sent. The slave node receives the third Follow_up message, parses it, and obtains the timestamp T7 when the Pdelay_Resp message is sent. The slave node calculates the transmission delay Ndelay between it and the master node at the current frequency offset rate Rf based on timestamp T5 to timestamp T8.
6. The time synchronization method of network nodes as claimed in claim 5, characterized in that: The calculation formula of transmission delay Ndelay is as follows:
7. The time synchronization method of network nodes as claimed in claim 1, characterized in that: The slave clock timestamp correction method based on the master clock timestamp is as follows: The master node sends the third sync message, the master clock generates a timestamp T9 when the third sync message is sent, the slave node receives the third sync message sent by the master node, and the slave clock generates a timestamp T9 when the third sync message is received. 10 ; The master node sends a fourth Follow_up message, which carries the timestamp T9 when the third sync message is sent. The slave node receives the fourth Follow_up message, parses it, and obtains the timestamp T9 when the third sync message is sent. Based on the timestamp T9 and the timestamp T 10 Calculate the current frequency offset rate Rf and the transmission delay Ndelay with the master clock timestamp T b Synchronous slave clock timestamp T a .
8. The time synchronization method of network nodes as claimed in claim 1, characterized in that: The timestamp T corresponding to the slave clock a The time formula is as follows: T a =T9+Ndelay+Rf*(T b -T 10 )。 9. An industrial Internet, characterized in that: The Industrial Internet includes: At least one master node, and slave nodes networked with the master node, the master node and the slave nodes periodically correct the timestamps of each slave node based on the time synchronization method for network nodes described in any one of claims 1 to 8.
Citation Information
Cited By
Equipment time synchronization method and device in wireless local area network
CN120711502A
Method and apparatus for time synchronization of devices in a wireless local area network
CN120711502B