A network time synchronization method
By maintaining the master port vector table within the node and dynamically adjusting the synchronization message transmission, the problems of high time synchronization message overhead and conflicts are solved, and efficient time synchronization is achieved.
Patent Information
- Application Number
- CN202411977835.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2044-12-31
AI Technical Summary
In existing time synchronization solutions, time synchronization message overhead is large, resulting in additional bandwidth consumption, and there is a possibility of conflict between time-sensitive services and time synchronization signaling messages.
Maintain a master port vector table within each node to record the clock performance of each node, dynamically adjust the synchronization message transmission interval, and selectively send synchronization messages to avoid conflicts with time-sensitive services.
By dynamically adjusting the transmission of synchronization messages, bandwidth consumption is reduced, conflicts between time-sensitive services and time synchronization signaling messages are avoided, and protocol efficiency and compatibility are improved.
Smart Images

Figure CN119766382B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of communication networks, and in particular relates to a network time synchronization method. Background Art
[0002] With the rapid development of industrial automation and embedded systems, and the increasing demand for real-time performance, reliability, efficiency, and data diversity in fields such as avionics and automotive electronics, traditional Ethernet technology is gradually becoming limited and unable to fully adapt to these new challenges. Against this backdrop, real-time Ethernet technology, particularly Time-Sensitive Networking (TSN), a key component of modern industrial networks, is expanding in importance and application, becoming a core technology supporting industrial development.
[0003] TSN (Time-Sensitive Networking) is a next-generation network architecture developed by optimizing existing Ethernet protocols based on traditional Ethernet technology. TSN aims to achieve precise latency control, bandwidth reservation, and low-latency data transmission. Its standardization is primarily driven by the IEEE 802.1 committee. Compared to traditional Ethernet, TSN, through a series of open standard protocols including IEEE802.1AS, IEEE802.1Qbv, IEEE802.1Qci, IEEE802.1CB, and IEEE802.1Qch, provides high-reliability, low-latency, and low-jitter communication solutions for a variety of fields, including industrial automation, smart grids, and the Internet of Vehicles. Furthermore, TSN utilizes the IEEE802.1AS time synchronization mechanism to ensure efficient collaboration between devices, enabling accurate and reliable data transmission according to scheduled times, meeting real-time requirements.
[0004] In real-time Ethernet technologies, such as Time-Sensitive Networking (TSN), time synchronization is fundamental to ensuring service determinism and real-time performance. To ensure that all devices in the network share a common time reference, thereby guaranteeing the accuracy of critical service data transmission and the overall stability and security of the system, high-level time synchronization is essential. In critical application areas such as aviation and autonomous vehicles, ensuring extremely high time synchronization accuracy is crucial, effectively preventing service conflicts that could arise from slight discrepancies in local clocks. Therefore, designing and improving time synchronization protocols, reducing implementation complexity and bandwidth consumption, and improving fault tolerance and time synchronization accuracy have become key research directions driving the continued development of TSN technology.
[0005] Existing time synchronization solutions include the SAE AS6802 protocol, IEEE 1588 protocol, and IEEE 802.1AS protocol. In IEEE 802.1AS, the transmission interval of synchronization messages is initially set to a fixed value. Excessive time synchronization may bring additional network load. Therefore, the shortcomings of existing technologies are:
[0006] First, different network devices have different clock performance. Traditional time synchronization solutions use a fixed synchronization period. Frequent synchronization of devices with excellent clock performance can add additional network load. Furthermore, although existing solutions can dynamically adjust the synchronization period, all network devices must participate in each synchronization, which can waste bandwidth.
[0007] Second, time-sensitive services may conflict with time synchronization messages. The time-sensitive service scheduling algorithm reserves time slots for time synchronization. However, in existing variable synchronization period solutions, the transmission of time synchronization messages may not fall within the reserved time slots, potentially colliding with time-sensitive services. Summary of the Invention
[0008] The technical problems to be solved by the present invention are:
[0009] In order to avoid the deficiencies of the prior art, the present invention provides a network time synchronization method for solving the problems in the prior art of large time synchronization message overhead resulting in extra bandwidth consumption and conflicts between time-sensitive services and time synchronization signaling messages.
[0010] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0011] A network time synchronization method, characterized by comprising:
[0012] A master port vector table is maintained inside each node, which records the maximum clock drift rate and maximum clock drift of all nodes under each master port.
[0013] According to the synchronized status message, each node completes the initialization of the master port vector table;
[0014] When the synchronization time arrives, the root node updates the master port vector table and selectively sends synchronization messages;
[0015] The slave node receives the synchronization message, synchronizes its own time and updates its own clock drift rate. At the same time, it replies to the parent node through the slave port with a status message, notifying its own clock drift rate.
[0016] After receiving the status message, each node updates its own master port vector table. If the maximum clock drift rate and maximum clock drift value of all nodes in the subtree with this node as the root node change, it will notify the parent node along the slave port.
[0017] A further technical solution of the present invention: the selectively sending synchronization messages includes:
[0018] The root node synchronizes according to its own interval t sync interval Update the maximum estimated clock offset value t of all ports in the master port vector table max drift ;
[0019] According to the current maximum estimated clock offset value t of each master port max drift , maximum clock deviation speed v max drift and the synchronization interval t sync interval Calculate the maximum estimated clock offset value t when the next synchronization time arrives max driftnext time ;
[0020] If the next synchronization time arrives, the maximum estimated clock offset value t max drift next time If the synchronization accuracy is exceeded, a synchronization message is sent to the port.
[0021] A further technical solution of the present invention is that when the maximum clock drift rate and the maximum clock drift value of all nodes in the subtree with the current node as the root node change, the updating of the own master port vector table is notified to the parent node along the slave port, including:
[0022] Each node stores the maximum clock drift speed v of all nodes in the subtree with the current node as the root node. subtree max drift and the current maximum estimated drift t subtree max drift ;
[0023] When the node receives the status message, it updates the main port vector table entry corresponding to the port that received the status message, and traverses the main port vector table entry according to the port that received the message, and sets the maximum clock drift speed v in the entry to max drift and the current maximum estimated drift t max drift Replaced with the values of the two fields in the status message;
[0024] The node will calculate the drift speed v according to the main port vector table and its own clock drift , calculate the new v subtree max drift and t subtree max drift ;
[0025] If an update occurs, that is, v subtree max drift and t subtree max drift If a change occurs and the current node is not the root node, a status message is sent to the slave port.
[0026] A further technical solution of the present invention is that each node completes the initialization of the master port vector table, including:
[0027] Each node initiates link measurement and records link delay;
[0028] The root node initiates synchronization and sends synchronization messages along all master ports;
[0029] After receiving the synchronization message, the slave node corrects its own clock based on the link delay and updates its own clock drift rate. At the same time, it replies with a status message to the parent node along the slave port, notifying its own clock drift rate.
[0030] After receiving the status message, each node updates its own information and selectively notifies the parent node based on the updated main port vector table.
[0031] A further technical solution of the present invention also includes receiving a synchronization message from a node, and when the slave node is a non-leaf node, it is necessary to forward the synchronization message along all master ports.
[0032] A further technical solution of the present invention: the link measurement includes:
[0033] Each node sends a PdelayReq message to the slave node;
[0034] After receiving the PdelayReq message, each node replies with a PdelayResp message to the port;
[0035] Each node calculates the link delay based on the received PdelayResp message.
[0036] A further technical solution of the present invention is that the selective notification to the parent node based on the updated own master port vector table includes:
[0037] If the maximum clock drift rate and maximum clock drift value of all nodes in the subtree with this node as the root node change, it will be notified to the parent node along the slave port.
[0038] A computer system, characterized in that it includes: one or more processors, and a computer-readable storage medium for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned method.
[0039] A computer-readable storage medium is characterized by storing computer-executable instructions, which are used to implement the above method when executed.
[0040] A computer program product, characterized by comprising computer executable instructions, wherein the instructions are used to implement the above method when executed.
[0041] The beneficial effects of the present invention are:
[0042] The present invention provides a network time synchronization method that records the clock performance of the nodes under each port by maintaining a master port vector table in each node. When the node receives a synchronization message, it dynamically decides which ports to forward it to, thereby solving the problems of large time synchronization message overhead and conflict between time-sensitive services and time synchronization signaling messages in the prior art.
[0043] First, this method can dynamically adjust the transmission interval of synchronization messages according to the clock performance of each node in the network, thereby improving protocol efficiency and reducing bandwidth consumption caused by time synchronization messages.
[0044] Second, this method selectively sends or forwards synchronization messages based on the minimum synchronization interval, ensuring that time synchronization can be performed within the reserved time slot, avoiding conflicts with time-sensitive services, and improving compatibility with existing protocols. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings are only for the purpose of illustrating particular embodiments and are not to be considered limiting of the present invention. Like reference symbols denote like parts throughout the drawings.
[0046] Figure 1 It is an interactive schematic diagram of the present invention.
[0047] Figure 2 It is a flow chart for implementing the present invention.
[0048] Figure 3 This is a sub-flowchart for implementing step (6) of the present invention.
[0049] Figure 4 This is a sub-flowchart for implementing step (8) of the present invention. DETAILED DESCRIPTION
[0050] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only intended to illustrate the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
[0051] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0052] The implementation idea of the present invention is as follows: 1) a master port vector table is maintained inside each node, which records the maximum clock drift rate and maximum clock drift of all nodes under each master port; 2) during the startup phase, each node will perform a link measurement, record the link delay with the parent node, and then initiate a synchronization by the root node; 3) after receiving the synchronization message sent by the root node, the node will synchronize its own clock and forward it to all master ports; 4) after receiving the synchronization message, each node will simultaneously reply a status message to the parent node along the slave port to notify Its own clock drift rate; 5) After receiving the status message, each node will update its own master port vector table. If the maximum clock drift rate and maximum clock drift value of all nodes in the subtree with this node as the root node change, it will be notified to the parent node along the slave port; 6) Based on the status message, each node can complete the initialization of the master port vector table; 7) Thereafter, every time a synchronization cycle arrives, the root node will update the master port vector table and decide which ports to send the synchronization message. Non-leaf nodes will also perform the same operation after receiving the synchronization message.
[0053] In order to enable those skilled in the art to better understand the present invention, the present invention is described in detail below with reference to specific embodiments.
[0054] The flow chart for realizing the present invention is shown in the attached diagram. Figure 2 Shown, including:
[0055] (1) Maintain the main port vector table inside the node, record the port number, the maximum clock drift speed v of all nodes under the port max drift And the maximum estimated clock drift of all nodes under this port t max drift .
[0056] Specifically, a master port vector table is maintained for each node. The table has three columns. The first column is the master port number, and the second column is the maximum clock drift speed v of all nodes under the port. max driftThe third column is the maximum estimated clock drift of all nodes under this port, t max drift .
[0057] (2) Set up the time synchronization spanning tree and configure the minimum synchronization interval through the Best Master Clock Algorithm (BMCA) or external configuration.
[0058] Specifically, the time synchronization spanning tree can be configured externally or generated by calculation by all nodes, and both are compatible with the master port vector table set in (1).
[0059] (3) After each device is powered on, link measurement is initiated.
[0060] (3a) Each node sends a PdelayReq message to the slave node.
[0061] (3b) After receiving the PdelayReq message, each node replies with a PdelayResp message to the port.
[0062] (3c) Each node calculates the link delay based on the received PdelayResp message.
[0063] Specifically, the link measurement method is consistent with the IEEE 802.1AS protocol and is compatible with this method.
[0064] (4) After the minimum synchronization interval, the root node synchronization time arrives, and the root node initiates synchronization and sends synchronization messages along all master ports.
[0065] (5) After receiving the synchronization message, the node will first correct its own clock, which can be divided into the following two types:
[0066] (5a) After receiving the synchronization message, the non-leaf node updates the synchronization field of the message according to the link measurement results, forwards the synchronization message to all master ports, and corrects its own clock at the same time.
[0067] (5b) After receiving the synchronization message, the leaf node corrects its own clock based on the link measurement results.
[0068] Specifically, when the first synchronization time arrives, the root node sends a synchronization message to all master ports. After the non-leaf nodes complete their own synchronization, they send synchronization messages to all master ports. In other words, all nodes participate in the first synchronization.
[0069] Then calculate the clock drift per unit time v drift The calculation method is to divide the correction value by the difference between the current timestamp and the node startup timestamp. The formula is as follows:
[0070]
[0071] After that, the node sends a status message to the slave port. The message has two fields, namely, the maximum clock drift speed v of all nodes in the subtree with the current node as the root node and subtree max drift and the maximum estimated drift t subtree max drift At this time v subtree max drift is the clock drift per unit time v drift , t subtree max drift is 0.
[0072] Specifically, after a node receives a synchronization message and completes its own clock correction, it will first reply with a status message with a value of v drift and 0. After receiving the status message, it decides whether to forward it to the parent node based on whether the content of the status message has changed, thus saving bandwidth.
[0073] (6) After receiving the status message, the node will update its own information and selectively send a status message to the slave port.
[0074] (6a) Each node stores the maximum clock drift speed v of all nodes in the subtree with the current node as the root node. subtree max drift and the current maximum estimated drift t subtree max drift .
[0075] Specifically, after the main port vector table is updated, the node will v subtree max drift and t subtree max drift Temporarily save as v′ subtree max drift and t′ subtree max drift , and recalculate the v of this node sbtree max drift and t subtree max drift If they have changed, a status message is sent to the slave port. The two fields in the message are the new v subtree max drift and t subtree max drift .
[0076] (6b) When the node receives the status message, it updates the master port vector table entry corresponding to the port that received the status message. According to the port that received the message, it traverses the master port vector table to find the corresponding entry, and sets the maximum clock drift speed v in the entry to max drift and the current maximum estimated drift t max drift Replaced with the values of the two fields in the status message.
[0077] (6c) The node will be based on the master port vector table and its own clock drift speed v drift , calculate the new v subtree max drift and t subtree max drift .
[0078] (6d) If an update occurs, that is, v subtree max driftand t subtree max drift If a change occurs and the current node is not the root node, a status message is sent to the slave port.
[0079] (7) After the first round of synchronization, each node completes the initialization of the master port vector table through the received status message and synchronizes the clock with the root node, and the startup phase is completed.
[0080] Specifically, after completing the first round of synchronization, each node synchronizes its clock with the root node and completes the initialization of the master port vector table compared to IEEE802.1AS. After that, the root node initiates synchronization according to the configured minimum synchronization interval.
[0081] (8) Thereafter, every time the minimum synchronization interval passes, the root node will update its own master port vector table and selectively send a synchronization message.
[0082] (8a) The root node synchronizes itself according to its own synchronization interval t stnc interval Update the maximum estimated clock offset value t of all ports in the master port vector table max drift The calculation process is to add the current maximum estimated clock offset value to the synchronization interval and the product of the maximum clock offset speed. The formula is as follows:
[0083] t′ max drift =t max drift +t sync interval *v max drift
[0084] (8b) Based on the current maximum estimated clock offset value t of each master port max drift , maximum clock deviation speed v max drift and the synchronization interval t sync interval Calculate the maximum estimated clock offset value t when the next synchronization time arrives max drift next time The calculation process is to add the current maximum estimated clock offset value to the product of the maximum clock offset speed and the synchronization interval. The formula is as follows:
[0085] t max drift next time =t max drift +t sync interval *v max drift
[0086] (8c) If the next synchronization time arrives, the maximum estimated clock offset value t max drift next time If the synchronization accuracy is exceeded, a synchronization message is sent to the port.
[0087] (9) After receiving the synchronization message, the node will also perform the master port vector table update and synchronization message selective forwarding operations.
[0088] (9a) After receiving the synchronization message, the node corrects its own clock based on the link measurement and the synchronization field in the synchronization message. The calculation method is consistent with IEEE 802.1AS.
[0089] (9b) Node update synchronization interval t sync intrval , and updates the maximum estimated clock offset value t of each item in the master port vector table according to the synchronization interval max drift .
[0090] Specifically, the synchronization interval is calculated as the difference between the current synchronization timestamp and the previous synchronization timestamp:
[0091] t sync interval =t current timestamp -t last timestamp
[0092] The maximum estimated clock offset is calculated as the current maximum estimated clock offset plus the product of the maximum clock offset rate of all nodes connected to the port and the synchronization interval of the node:
[0093] t′ max drift =t max drift +t sync interval *v max drift
[0094] (9c) As with the root node, calculate the maximum estimated clock offset value of each port during the next synchronization.
[0095] t max drift next time =t max drift +t sync interval *v max drift
[0096] (9d) If the next synchronization time arrives, the maximum estimated clock offset value t max drift next time If the synchronization accuracy is exceeded, the synchronization field in the synchronization message is updated and the synchronization message is sent to the port.
[0097] (10) As in the startup phase, after receiving the synchronization message, the node will reply with a status message. After receiving the status message, the node will update its own information and selectively send a status message to the slave port.
[0098] Specifically, after receiving the synchronization message, the node will reply to the slave port with a status message with the field value v drift and 0; after receiving the status message, the node will update the v of the corresponding port in the main port vector table max drift and t max drift , and recalculate the maximum clock drift speed v of all nodes in the subtree with the current node as the root node subtree max drift and drift t subtree max driftIf an update occurs, a status message is sent to the primary port.
[0099] The above description is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with this technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present invention, and these modifications or replacements should all be included in the scope of protection of the present invention.
Claims
1. A network time synchronization method, characterized in that: include: A master port vector table is maintained inside each node, which records the maximum clock drift rate and maximum clock drift of all nodes under each master port. According to the synchronized status message, each node completes the initialization of the master port vector table; When the synchronization time arrives, the root node updates the master port vector table and selectively sends synchronization messages; The selectively sending a synchronization message includes: The root node synchronizes according to its own interval Update the maximum estimated clock skew value of all ports in the master port vector table ; Based on the current maximum estimated clock offset value of each master port , Maximum clock skew speed and synchronization interval Calculate the maximum estimated clock offset when the next synchronization time arrives ; If the next synchronization time arrives, the maximum estimated clock offset value If the synchronization accuracy is exceeded, a synchronization message is sent to the port; The slave node receives the synchronization message, synchronizes its own time and updates its own clock drift rate. At the same time, it replies to the parent node through the slave port with a status message, notifying its own clock drift rate. After receiving the status message, each node updates its own master port vector table. If the maximum clock drift rate and maximum clock drift value of all nodes in the subtree with this node as the root node change, it will notify the parent node along the slave port.
2. A network time synchronization method according to claim 1, characterized in that: The updating of the master port vector table of the node itself, if the maximum clock drift rate and the maximum clock drift value of all nodes in the subtree with the node as the root node change, will be notified to the parent node along the slave port, including: Each node stores the maximum clock drift speed of all nodes in the subtree with the current node as the root node. and the current maximum estimated drift ; When the node receives the status message, it updates the main port vector table entry corresponding to the port that received the status message, and traverses the main port vector table entry according to the port that received the message, and sets the maximum clock drift speed in the entry to and the current maximum estimated drift Replaced with the values of the two fields in the status message; The node will calculate the drift speed of the master port vector table and its own clock , calculate the new and ; If an update occurs, and If a change occurs and the current node is not the root node, a status message is sent to the slave port.
3. A network time synchronization method according to claim 1, characterized in that: Each node completes the master port vector table initialization, including: Each node initiates link measurement and records link delay; The root node initiates synchronization and sends synchronization messages along all master ports; After receiving the synchronization message, the slave node corrects its own clock based on the link delay and updates its own clock drift rate. At the same time, it replies with a status message to the parent node along the slave port, notifying its own clock drift rate. After receiving the status message, each node updates its own information and selectively notifies the parent node based on the updated main port vector table.
4. A network time synchronization method according to claim 3, characterized in that: It also includes receiving a synchronization message from the slave node. When the slave node is a non-leaf node, the synchronization message needs to be forwarded along all master ports.
5. A network time synchronization method according to claim 3, characterized in that: The link measurement includes: Each node sends a PdelayReq message to the slave node; After receiving the PdelayReq message, each node replies with a PdelayResp message to the port; Each node calculates the link delay based on the received PdelayResp message.
6. A network time synchronization method according to claim 3, characterized in that: The selective notification to the parent node based on the updated own master port vector table includes: If the maximum clock drift rate and maximum clock drift value of all nodes in the subtree with this node as the root node change, it will be notified to the parent node along the slave port.
7. A computer system, characterized in that include: One or more processors, and a computer-readable storage medium for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method of claim 1.
8. A computer-readable storage medium, characterized in that Computer-executable instructions are stored, and when the instructions are executed, they are used to implement the method of claim 1.
9. A computer program product, characterized in that The invention comprises computer executable instructions, which are used to implement the method of claim 1 when the instructions are executed.
Citation Information
Patent Citations
Wireless sensor network confidence weighted time synchronization method for steel structure flaw detection
CN110572874A
Synchronous efficient convergence method and system of 802.1 AS
CN118487693A