Clock synchronization method and device
Through the mapping relationship between the clock timestamp and the reference time scale between the master node and the slave node, combined with the slave clock time, the compensation parameters are determined, which solves the problem in the existing technology that clock synchronization cannot ensure that the time deviation is bounded, and achieves high accuracy clock synchronization.
Patent Information
- Application Number
- PCT/CN2024/073814
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-28
- Filing Date
- 2024-01-24
- Publication Date
- 2024-09-06
AI Technical Summary
Existing clock synchronization methods cannot guarantee bounded time deviations between master and slave nodes, especially in Global Navigation Satellite System (GNSS) receivers, where frequency synchronization is costly and cannot provide time or phase synchronization.
Through the mapping relationship between the master clock time stamp of the master node and the reference time scale of the slave node and the time combination of the timestamp corresponding to the reference time scale of the slave node and the slave clock time, the compensation parameters are determined to realize the communication between the slave node and the master node. Clock synchronization between devices ensures that the time deviation is bounded.
It effectively realizes clock synchronization between the slave node and the master node, improves the accuracy and precision of synchronization, reduces the jitter of the slave clock output time of the slave node, and avoids the re-convergence process.
Smart Images

Figure CN2024073814_06092024_PF_FP
Abstract
Description
Clock synchronization method and device
[0001] This application claims priority to the Chinese patent application number 202310217122.5 filed with the Patent Office of China on February 28, 2023, with the invention name “Clock Synchronization Method and Device”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of communication technology, and in particular to a clock synchronization method and device. Background Art
[0003] In communication systems, some electronic devices require clock synchronization, and network timing can be achieved through various synchronization technologies. Clock synchronization within a network can be achieved through time, frequency, and phase. Frequency refers to the number of complete oscillations of energy in the form of a wave per second, or the rate at which periodic events occur. Frequency synchronization is the ability to distribute precise frequencies across a network. Phase refers to the fraction of a period that has completed a cycle at a specific reference time, expressed as an angle. In phase synchronization, multiple clocks of different frequencies are synchronized. Time refers to the time of day, and time synchronization refers to the distribution of time across network clocks. Time synchronization is one way to achieve phase synchronization.
[0004] Because time and phase synchronization using Global Navigation Satellite System (GNSS) receivers, such as the Global Positioning System (GPS), is expensive, two protocols have been defined to provide frequency synchronization over Ethernet interfaces. This can be achieved through either of the following methods: Synchronous Ethernet (SyncE) is a physical layer technology that supports the transmission of frequencies from one hop to another, traceable to an external source, such as a network clock. It distributes synchronization at the physical layer. Because SyncE operates at the physical layer, all Ethernet devices along the synchronization path must support SyncE. Furthermore, while SyncE provides stable frequency synchronization, it does not provide time or phase synchronization; these require separate protocols. Packet-based frequency synchronization methods rely on the transmission of dedicated "event packets." These "event packets" form a large number of instants in the packet time signal. The time of these instants is encoded as time stamps in the packet master clock and transmitted across the packet network to the packet slave clocks. Since time is an integral of frequency, the time stamps can be used to recover the frequency.
[0005] The packet-based frequency synchronization method described in ITU-T G.8263 is essentially a frequency locking method, which aims to maintain the frequency deviation between the packet slave clock and the packet master clock within a certain range. However, this synchronization method cannot guarantee that the time deviation between the packet slave clock and the packet master clock is bounded.
[0006] Summary of the Invention
[0007] In view of the above content, it is necessary to provide a clock synchronization method and device, which determines the compensation parameters through the mapping relationship between the master clock of the master node and the reference time mark of the slave node and the time combination of the timestamp corresponding to the reference time mark of the slave node at the same moment and the slave clock time, and realizes the clock synchronization between the slave node and the master node based on the compensation parameters to ensure that the time deviation between the master node and the slave node is bounded.
[0008] In the first aspect, an embodiment of the present application provides a clock synchronization method, which is applied to a slave node, and the clock synchronization method includes: receiving a synchronization message sent by a master node, the synchronization message carrying the master clock timestamp of the master node; establishing a mapping relationship between the master clock of the master node and the reference time stamp of the slave node based on the master clock timestamp and the timestamp corresponding to the reference time stamp of the slave node when the slave node receives the synchronization message; obtaining a time combination of the timestamp corresponding to the reference time stamp of the slave node and the slave clock time of the slave node, the reference time stamp of the slave node and its corresponding slave clock time having the same acquisition time; determining a compensation parameter based on the mapping relationship and the time combination, so as to synchronize the clocks of the slave node and the master node based on the compensation parameter.
[0009] By adopting the above technical solution, the compensation parameters are determined by the mapping relationship between the master clock of the master node and the reference time scale of the slave node and the time combination of the timestamp corresponding to the reference time scale of the slave node and the slave clock time of the slave node, and the reference slave clock of the slave node is compensated according to the compensation parameters to achieve clock synchronization between the slave node and the master node.
[0010] Furthermore, the compensation parameters and mapping relationships can be executed by a more powerful component in the slave node, such as a CPU. This facilitates the calculation of soft clock time deviation compensation in a CPU or a network programmable component such as a network processor (NP) or FPGA, rather than relying on the slave node's clock hardware circuitry.
[0011] Among them, the synchronization messages sent between the master node and the slave node are sent periodically and continuously. The slave node can perform statistical calculations on the timestamps in the multiple synchronization messages received and the timestamps corresponding to when the slave node receives the synchronization message (for example, using a preset statistical algorithm to perform statistical calculations) to determine the mapping relationship between the master clock and the reference time of the slave node.
[0012] The slave node's reference time corresponds to the timestamp of the slave's clock time. The slave's slave clock time is the application time output after the slave and master nodes synchronize their clocks. The application time is the output time determined by the slave node after correcting the reference time, also known as the slave's application time.
[0013] Based on the first aspect, in a possible implementation method, the compensation parameters include time compensation parameters, and determining the compensation parameters based on the mapping relationship and the time combination includes: determining the initial time offset between the master node and the slave node corresponding to the specific moment based on the mapping relationship and the time combination corresponding to the specific moment; determining the time compensation parameters based on the mapping relationship, the time combination and the initial time offset.
[0014] By adopting the above technical solution, the initial time offset is determined and the time offset between the master node and the slave node, i.e., the time compensation parameter, is determined based on the initial time offset to ensure that the time deviation when the slave node and the master node perform clock synchronization is bounded.
[0015] Furthermore, in the process of determining the time compensation parameter, the initial frequency offset between the master node and the slave node is locked to improve the accuracy of clock synchronization.
[0016] Based on the first aspect, in a possible implementation, the compensation parameters also include frequency offset compensation parameters, and the clock synchronization method also includes: determining the frequency compensation parameters between the master node and the slave node within a preset frequency compensation period interval based on a mapping relationship and a time combination.
[0017] By adopting the above technical solution, after time compensation is performed on the slave node, frequency compensation is periodically performed on the slave node to achieve clock synchronization between the slave node and the master node, thereby improving the accuracy of clock synchronization between the slave node and the master node.
[0018] Based on the first aspect, in a possible implementation, the mapping relationship between the master clock of the master node and the reference time stamp of the slave node is: T1(t) = a + b * T2(t), wherein T1(t) is the timestamp of the master node at time t carried by the synchronization message, T2(t) is the timestamp corresponding to the reference time stamp of the slave node at time t, a is the time deviation parameter, and b is the frequency offset parameter; based on the mapping relationship and the time combination corresponding to the specific moment, the initial time offset between the master node and the slave node corresponding to the specific moment is determined as: initialOffset = a(0) + b(0) * T2n(0) – Tb(0);
[0019] Wherein, initialOffset is the initial time offset between the master node and the slave node at the initial moment, T2n(0) is the timestamp corresponding to the reference time scale of the slave node at the initial moment, Tb(0) is the slave clock time of the slave node at the initial moment, a(0) is the time deviation parameter at the initial moment, and b(0) is the frequency offset parameter at the initial moment;
[0020] The time compensation parameters are determined based on the mapping relationship, time combination and initial time offset: Offset = T1(t) – Tb(t) – initialOffset; T1(t) = a + * T2n(t);
[0021] Where Offset is the time compensation parameter, Tb(t) is the slave clock time of the slave node at time t, and T2n(t) is the timestamp corresponding to the reference time scale of the slave node at time t.
[0022] By adopting the above technical solution, the mapping relationship between the master clock of the master node and the reference time scale of the slave node is a linear regression function. The time compensation parameter is calculated based on the mapping relationship, which can greatly improve the clock synchronization performance between the slave node and the master node.
[0023] Based on the first aspect, in one possible implementation, the frequency compensation parameter between the master node and the slave node corresponding to the compensation cycle interval is determined based on the mapping relationship and the time combination: freqComp = (b-1)*C; where freqComp is the frequency compensation parameter and C is the compensation cycle interval.
[0024] By adopting the above technical solution, the frequency compensation parameters within the compensation period interval are determined according to the above mapping relationship, and the reference time of the slave node is compensated according to the time compensation parameters and the frequency compensation parameters to ensure the clock synchronization performance of the slave node.
[0025] Based on the first aspect, in a possible implementation method, establishing a mapping relationship between the master clock timestamp of the master node and the reference time stamp of the slave node includes: constructing an original point set based on the master clock timestamps of multiple master nodes and the timestamps corresponding to the reference time stamps of the slave nodes; determining the minimum point in the original point set; determining the selected point in the selected point set based on the minimum point; and determining the mapping relationship between the master clock of the master node and the reference time stamp of the slave node based on the selected point set.
[0026] With the above technical solution, a selected point is determined by a minimum point algorithm, and a mapping relationship is determined based on the selected point, wherein the minimum point may be a point where the packet delay is minimum when a packet delay variation (PDV) exists.
[0027] Based on the first aspect, in a possible implementation method, the clock synchronization method also includes: determining an abnormal point set based on the minimum point, wherein the jitter between the master clock timestamp of the master node and the reference time stamp of the slave node in the abnormal point set exceeds a preset jitter range; determining that a route switching occurs in the path between the master node and the slave node based on the abnormal point set, and updating the selected point set based on the abnormal point set.
[0028] Using this technical solution, if an outlier is determined to be caused by a route switch, the outlier in the set of outlier points can be used as a new selected point, increasing the number of selected points and improving the accuracy and timeliness of mapping relationships. This allows for the identification and compensation of inherent delay variations in synchronization message transmission delays, effectively reducing jitter in the slave node's slave clock output time.
[0029] Based on the first aspect, in a possible implementation method, determining that a route switching occurs in a path between a master node and a slave node based on a set of outlier points includes: if the minimum point in the set of outlier points satisfies the following route switching conditions, determining that a route switching occurs in a path between the master node and the slave node: route switching condition one: the number of minimum points in the set of outlier points is greater than a preset number threshold; route switching condition two: the jitter between the minimum points in the set of outlier points is within a preset jitter range.
[0030] Using this technical solution, the aforementioned judgment conditions are used to determine whether the minimum point in the outlier set meets the switching conditions. If so, the minimum point in the outlier set is used as the new selected point. By increasing the number of selected points, the accuracy and timeliness of the mapping relationship are improved. Without external notification, based on the timestamp carried in the master node's synchronization message and the timestamp corresponding to the slave node's reference time stamp, the slave node can detect changes in the inherent delay of packet messages in the packet switching network caused by scenarios such as route switching.
[0031] Based on the first aspect, in a possible implementation, the route switching condition further includes: route switching condition three: a difference in inherent delay between a selected point in the selected point set and an outlier point in the outlier point set is greater than a preset distance range.
[0032] The routing switching condition three is used to avoid misjudging non-routing switching abnormal points caused by ambient temperature changes as routing switching abnormal points.
[0033] Based on the first aspect, in one possible implementation, a method for determining the difference in inherent delay includes: determining an average value of all selected points in a selected point set to obtain a first average point; determining an average value of all outliers in an outlier point set to obtain a second average point; determining a frequency offset calculation parameter based on the selected points in the selected point set and the outliers in the outlier point set; and determining the difference in inherent delay according to the following formula:
[0034] deltaOffsetCausedByRouteChange = –(T1outlier - T1selected) + (T2outlier - T2selected) * b_routechange; where deltaOffsetCausedByRouteChange is the difference in inherent delay, T1outlier is the ordinate of the first average point, T2outlier is the abscissa of the first average point, b_routechange is a frequency offset calculation parameter, T1selected is the ordinate of the second average point, and T2selected is the abscissa of the second average point.
[0035] The above technical solution is adopted to achieve the determination of route switching during the transmission of synchronization messages, and then determine the delay compensation caused by the route switching. The difference in inherent delay is used to compensate for the increase in transmission delay caused by the route switching, so as to ensure the boundedness of clock synchronization between the slave node and the master node. When the inherent delay of the synchronization message changes, most existing technologies are unable to perceive it, resulting in huge jitter in the frequency and time of the slave clock of the slave node, and usually a long reconvergence time. The present application saves the historical minimum point sequence after the route switching occurs in the abnormal point set, and by switching these historical minimum point sequences to the selected point set, it can achieve seamless switching, effectively reducing the frequency and time jitter of the slave node's grouped slave clock, and avoiding the oscillation and reconvergence process of the slave node's grouped slave clock algorithm.
[0036] Based on the first aspect, in a possible implementation method, determining the frequency deviation calculation parameters based on determining the selected points in the selected point set and the outlier points in the outlier point set includes: obtaining a first mapping relationship corresponding to all selected points in the selected point set and a second mapping relationship corresponding to all outlier points in the outlier point set; and determining the frequency deviation calculation parameters based on the first mapping relationship and the second mapping relationship.
[0037] By adopting the above technical solution, the frequency offset parameter is determined by selecting the mapping relationship corresponding to the set with smaller jitter, so as to improve the accuracy of the inherent delay difference calculation.
[0038] Based on the first aspect, in one possible implementation, determining a frequency offset parameter based on determining a selected point in a selected point set and an outlier in an outlier set includes: obtaining a first jitter range for the selected point in the selected point set and a second jitter range for the outlier in the outlier set; and determining a mapping relationship between the sets with smaller jitter in the first jitter range and the second jitter range to determine a frequency offset calculation parameter. Using the above technical solution, the frequency offset calculation parameter is determined by averaging the mapping relationships corresponding to the selected quantity sets, thereby improving the accuracy of the inherent delay difference calculation.
[0039] Based on the first aspect, in a possible implementation manner, a synchronization message sent by the master node is received through a packet switching network.
[0040] In the second aspect, a slave node is provided, which includes a reference time stamp module, a packet message timestamp module, a statistics module, a packet slave clock correction module and a compensation calculation module; the packet message timestamp module is used to receive a synchronization message sent by the master node, and the synchronization message carries the master clock timestamp of the master node; it is also used to receive the timestamp corresponding to the reference time stamp of the slave node when the slave node receives the synchronization message sent by the reference time stamp module, and send the master clock timestamp of the master node and the timestamp corresponding to the reference time stamp of the slave node to the statistics module; the statistics module is used to receive the master clock timestamp of the master node and the timestamp corresponding to the reference time stamp of the slave node and establish the master clock and The mapping relationship between the reference time scales of the slave nodes is obtained, and then the mapping relationship is sent to the compensation calculation module; the compensation calculation module is used to receive the mapping relationship, and is also used to receive the notification message sent by the group slave clock correction module, the notification message carries the time combination of the timestamp corresponding to the reference time scale of the slave node and the slave clock time of the slave node, and the timestamp corresponding to the reference time scale of the slave node and the acquisition time of its corresponding slave clock time are the same; the compensation calculation module is also used to determine the compensation parameters based on the mapping relationship and the time combination, and send the compensation parameters to the group slave clock correction module, so that the group slave clock correction module synchronizes the clock of the slave node based on the compensation parameters.
[0041] Based on the second aspect, in one possible implementation method, the compensation parameters include time compensation parameters, and the compensation calculation module is further used to: determine the initial time offset between the master node and the slave node corresponding to the specific moment based on the mapping relationship and the time combination corresponding to the specific moment; determine the time compensation parameters based on the mapping relationship, the time combination and the initial time offset.
[0042] Based on the second aspect, in a possible implementation, the compensation parameters also include frequency offset compensation parameters, and the compensation calculation module is further used to: determine the frequency compensation parameters between the master node and the slave node within a preset frequency compensation period interval based on a mapping relationship and a time combination.
[0043] Based on the second aspect, in a possible implementation method, the mapping relationship is: T1(t) = a+b*T2(t), wherein T1(t) is the timestamp of the master node at time t carried by the synchronization message, T2(t) is the timestamp corresponding to the reference time mark of the slave node at time t, a is the time deviation parameter, and b is the frequency offset parameter; the compensation calculation module is further used to: determine the initial time offset between the master node and the slave node corresponding to the specific moment based on the mapping relationship and the time combination corresponding to the specific moment as: initialOffset = a(0)+b(0)*T2n(0)–Tb(0); wherein initialOffset is the initial time offset between the master node and the slave node at the initial moment, T2n(0) is the timestamp corresponding to the reference time mark of the slave node at the initial moment, Tb(0) is the slave clock time of the slave node at the initial moment, a(0) is the time deviation parameter at the initial moment, and b(0) is the frequency offset parameter at the initial moment;
[0044] The time compensation parameters are determined based on the mapping relationship, time combination and initial time offset: Offset = T1(t) – Tb(t) – initialOffset; T1(t) = a + b * T2n(t);
[0045] Where Offset is the time compensation parameter, Tb(t) is the slave clock time of the node at time t, and T2n(t) is the reference time scale of the slave node at time t.
[0046] Based on the second aspect, in one possible implementation method, the compensation calculation module is further used to: determine the frequency compensation parameter between the master node and the slave node corresponding to the compensation cycle interval based on the mapping relationship and the time combination: freqComp = (b-1) * C; wherein freqComp is the frequency compensation parameter, and C is the compensation cycle interval.
[0047] Based on the second aspect, in a possible implementation method, the statistical module is further used to: construct an original point set based on the master clock timestamps of multiple master nodes and the timestamps corresponding to the reference time scales of the slave nodes; determine the minimum point in the original point set; determine the selected point in the selected point set based on the minimum point; determine the mapping relationship between the master clock of the master node and the reference time scale of the slave node based on the selected point set.
[0048] Based on the second aspect, in a possible implementation method, the statistical module is also used to: determine an abnormal point set based on the minimum point, in which the jitter between the master clock timestamp of the master node and the timestamp corresponding to the reference time scale of the slave node exceeds a preset jitter range; determine a route switch between the path between the master node and the slave node based on the abnormal point set, and update the selected point set based on the abnormal point set.
[0049] Based on the second aspect, in a possible implementation method, the statistical module is also used to: if the minimum point in the outlier point set meets the following route switching conditions, determine that the path between the master node and the slave node undergoes route switching: route switching condition one: the number of minimum points in the outlier point set is greater than a preset number threshold; route switching condition two: the jitter between the minimum points in the outlier point set is within a preset jitter range.
[0050] Based on the second aspect, in a possible implementation, the route switching condition further includes: route switching condition three: the difference in inherent delay between the selected point in the selected point set and the outlier point in the outlier point set is greater than a preset delay range.
[0051] Based on the second aspect, in a possible implementation method, the statistical module is further used to: determine the average value of all selected points in the selected point set to obtain a first average point; determine the average value of all outlier points in the outlier point set to obtain a second average point; determine the frequency offset calculation parameter based on the selected points in the selected point set and the outlier points in the outlier point set; determine the difference in inherent delay according to the following formula: deltaOffsetCausedByRouteChange = –(T1outlier-T1selected)+b_routechange*(T2outlier-T2selected); wherein deltaOffsetCausedByRouteChange is the difference in inherent delay, T1outlier is the vertical coordinate of the first average point, T2outlier is the horizontal coordinate of the first average point, b_routechange is the frequency offset calculation parameter, T1selected is the vertical coordinate of the second average point, and T2selected is the horizontal coordinate of the second average point.
[0052] Based on the second aspect, in a possible implementation method, determining the frequency offset parameter based on determining the selected points in the selected point set and the outlier points in the outlier point set includes: obtaining a first mapping relationship corresponding to all selected points in the selected point set and a second mapping relationship corresponding to all outlier points in the outlier point set; and determining the frequency offset calculation parameter based on the first mapping relationship and the second mapping relationship.
[0053] Based on the second aspect, in a possible implementation method, determining the frequency deviation calculation parameters based on determining the selected points in the selected point set and the outlier points in the outlier point set includes: obtaining the first jitter range of the selected points in the selected point set and the second jitter range of the outlier points in the outlier point set; determining the mapping relationship between the corresponding sets with smaller jitter in the first jitter range and the second jitter range to determine the frequency deviation calculation parameters.
[0054] Based on the second aspect, in a possible implementation manner, the packet message timestamp module is used to receive a synchronization message sent by the master node through a packet switching network.
[0055] In a third aspect, a slave node is provided, comprising: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the clock synchronization method as described in any one of the first aspects.
[0056] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the clock synchronization method as described in any one of the first aspects is implemented.
[0057] It should be understood that the technical effects brought about by any design in the second to fourth aspects can refer to the beneficial effects of the corresponding methods provided above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] FIG1 is a schematic diagram of a clock synchronization architecture provided in an embodiment of the present application.
[0059] FIG2 is a schematic diagram of an architecture for calculating compensation parameters provided in an embodiment of the present application.
[0060] FIG3 is a schematic diagram of an architecture for determining a mapping relationship provided in an embodiment of the present application.
[0061] FIG4 is a schematic diagram of a transmission delay of a synchronization message provided in an embodiment of the present application.
[0062] FIG5 is a schematic diagram of a scenario in which routing switching of a synchronization message occurs, provided in an embodiment of the present application.
[0063] FIG6 is a schematic diagram of a scenario in which synchronization message congestion occurs, provided in an embodiment of the present application.
[0064] FIG7 is a flow chart of a synchronization method provided by an embodiment of the present application.
[0065] FIG8 is a schematic diagram of the structure of a slave node provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the said features. In the description of the embodiments of the present application, words such as "exemplary" or "for example" are used to identify examples, illustrations or explanations. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or design schemes. Specifically, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete way.
[0067] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art in the art of this application. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. It should be understood that, in this application, unless otherwise specified, "a plurality of" means two or more than two, and "and / or" includes any and all combinations of one or more of the associated listed items.
[0068] For ease of understanding, the technical solutions in the embodiments of the present application are described below with reference to the accompanying drawings.
[0069] Figure 1 is a schematic diagram of a clock synchronization architecture provided by an embodiment of the present application. As shown in Figure 1, the clock synchronization architecture includes a master node and a slave node. The master node sends a synchronization message carrying a packet master clock timestamp T1(t) to the slave node through a packet switching network. Wherein, t identifies the packet master clock timestamp of the master node or the timestamp corresponding to the reference time stamp is the sampling value at time t, or is calculated from the sampling value at time t. In this way, during the synchronization process between the slave node and the master node, the master node periodically sends a synchronization message to the slave node in a unidirectional manner, and the slave node does not need to return a response message to the synchronization message to the master node, that is, the clock synchronization between the slave node and the master node is achieved based on the synchronization message sent unidirectionally by the master node to the slave node. Wherein, the packet master clock timestamp T1(t) is also called the timestamp of the packet master clock of the master node or the master packet device time.
[0070] It is understood that a master node has a master clock, and a slave node has a slave clock. Typically, the master and slave clocks have a frequency or time offset. Clock synchronization techniques can be used to synchronize the master and slave clocks. However, existing clock synchronization techniques, such as the frequency synchronization method defined in ITU-T G.8263, cannot guarantee that the time offset between the master and slave nodes is bounded after synchronization.
[0071] In order to solve the technical problem that the existing clock synchronization method cannot ensure that the time deviation between the master node and the slave node is bounded, the clock synchronization architecture provided in the embodiment of the present application determines the compensation parameter through the mapping relationship between the master clock timestamp of the master node and the timestamp corresponding to the reference time stamp of the slave node, and the time combination of the timestamp corresponding to the reference time stamp of the slave node at the same moment and the slave clock time corresponding to the timestamp, and realizes clock synchronization between the slave node and the master node based on the compensation parameter to ensure that the time deviation between the master node and the slave node is bounded.
[0072] The following is an explanation of the multiple modules of the master node and the slave node in Figure 1. As shown in Figure 1, the slave node includes a packet message timestamp module, a reference time stamp, a statistics module, a compensation calculation module, and a packet slave clock correction module; it can be understood that the above-mentioned multiple modules of the slave node can be partially or completely merged, and each module can also be split according to its respective function.
[0073] In some embodiments, the slave node in Figure 1 may be a packet network device, such as a gateway, a switch, a router, a PC, a server, an end-side module containing a packet network module, an actuator containing a packet network module, a controller, a sensor, a network module, etc.
[0074] Among them, the synchronization message sent by the master node to the slave node can be a 1588 Sync message or an NTP message. It can be understood that in other embodiments, the synchronization message between the master node and the slave node can also be of other types, and this application does not limit this.
[0075] In the process of sending the synchronization message from the master node to the slave node through the packet switching network (Packet Switched Network) in Figure 1, a certain amount of packet delay variation (PDV) will be introduced, also known as delay jitter.
[0076] It can be understood that the embodiment of the present application is explained by taking the master node sending a synchronization message to the slave node through a packet switching network as an example. In other embodiments, the master node may send a synchronization message to the slave node through other communication networks. Since the transmission of the synchronization message in the communication network will introduce delay jitter, the delay jitter of different communication networks is different.
[0077] In some embodiments, one or more relay nodes may be included between the master node and the slave node, and the master node sends synchronization messages to the slave node through the relay nodes.
[0078] The reference time scale is used to provide a reference time scale for the slave node, and then provide a timestamp corresponding to the reference time scale to the packet message timestamp module and the packet slave clock correction module.
[0079] For example, the timestamp corresponding to the reference time provided to the packet timestamp module is T2(t), and the timestamp corresponding to the reference time provided to the packet slave clock correction module is T2'(t).
[0080] The timestamp corresponding to the reference time scale may be provided by a local clock of the slave node, such as a network adapter clock or a CPU clock.
[0081] The packet message timestamp module is used to receive synchronization messages sent by the master node, and also to receive the timestamp corresponding to the reference time stamp of the slave node sent by the reference time stamp. It then sends the master clock timestamp of the master node and the reference time stamp of the slave node to the statistics module. The timestamp corresponding to the reference time stamp of the slave node is the time corresponding to the reference time stamp of the slave node when the synchronization message sent by the master node is received by the slave node.
[0082] It can be understood that the packet message timestamp module can form a tuple of the master clock timestamp of the master node and the timestamp corresponding to the reference time stamp of the slave node corresponding to the master clock timestamp of the master node, and send the tuple to the statistical module; of course, in other embodiments, the packet message timestamp module can determine the difference between the master clock timestamp of the master node and the timestamp corresponding to the reference time stamp of the slave node corresponding to the master clock timestamp of the master node, and send the difference to the statistical module.
[0083] The timestamp of the master clock timestamp of the master node and the timestamp of the reference time stamp of the slave node correspond to the timestamp of the master clock of the master node and the timestamp of the reference time stamp of the slave node respectively, which means that the timestamps of the master clock and the slave node are collected at the same time. The collection time may be the time when the slave node receives the synchronization message sent by the master node.
[0084] The statistics module is used to receive the master clock timestamp of the master node and the timestamp corresponding to the reference time stamp of the corresponding slave node sent by the packet message timestamp module, and determine the mapping relationship between the master clock timestamp of the master node and the timestamp corresponding to the reference time stamp of the slave node, and then send the mapping relationship to the compensation calculation module.
[0085] In some embodiments, the statistical module receives the master clock timestamps of multiple master nodes and the timestamps corresponding to the reference time stamps of the corresponding slave nodes sent by the packet message timestamp module. The statistical module executes a preset statistical algorithm based on the master clock timestamps of the multiple master nodes and the timestamps corresponding to the reference time stamps of the slave nodes to establish a mapping relationship between the master clock of the master node and the reference time stamp of the slave node.
[0086] In some embodiments, a linear regression mapping relationship is established between the master clock of the master node and the reference time scale of the slave node: T1(t) = a + b * T2(t), where T1(t) is the timestamp of the master clock of the master node, T2(t) is the timestamp corresponding to the reference time scale of the slave node, a is the time deviation parameter between the master node and the slave node, and b is the frequency offset parameter between the master node and the slave node. It will be understood that in other embodiments, the mapping relationship between the master clock of the master node and the reference time scale of the slave node can be a quadratic linear regression or other linear regression, and is not limited to the linear regression described in the embodiments of the present application.
[0087] The mapping relationship is also called a mapping parameter, which is used to describe the relationship between T1(t) and T2(t).
[0088] Among them, the statistical algorithm can adopt a linear regression algorithm, such as a least squares method, an iterative solution algorithm, etc.
[0089] The compensation calculation module is configured to receive the mapping relationship sent by the statistics module and to receive a notification message sent by the grouped slave clock correction module. The notification message carries a time combination, comprising a timestamp corresponding to the reference time scale of the slave node and a slave clock time of the slave node corresponding to the reference time scale. The timestamp corresponding to the reference time scale and the slave clock time of the slave node corresponding to the reference time scale are collected at the same instant, i.e., the timestamp corresponding to the reference time scale and the slave clock time of the slave node are collected at the same instant.
[0090] The compensation calculation module is also used to determine the compensation parameters based on the notification message and the mapping relationship, and send the compensation parameters to the group slave clock correction module so that the group slave clock correction module can correct the group slave clock time of the slave node to achieve clock synchronization between the slave node and the master node.
[0091] In some embodiments, the compensation calculation module is used to determine the initial time offset between the master node and the slave node corresponding to a specific moment based on the mapping relationship and the time combination corresponding to the specific moment; and then determine the time compensation parameter based on the mapping relationship, the time combination and the initial time offset, that is, the compensation calculation module determines the initial time offset between the master node and the slave node and determines the time compensation offset based on the initial time offset, and compensates the reference clock of the slave node based on the time offset between the master node and the slave node to achieve clock synchronization between the master node and the slave node.
[0092] Furthermore, after determining the initial time offset, it is also used to determine the initial frequency offset between the master node and the slave node, so that in the process of determining the time compensation parameters, the frequency offset between the master node and the slave node is locked to improve the accuracy of the clock synchronization of the master node and the slave node.
[0093] The reference clock here may be a dedicated clock in the slave node serving as the slave clock time, may be a reference clock corresponding to a reference time scale, or may be a reference clock corresponding to a grouped slave correction module.
[0094] In some embodiments, first, the compensation calculation module periodically receives a notification message reported by the group slave clock correction module, where the notification message carries the slave clock time Tb(t) of the slave node output by the group slave clock correction module and the timestamp T2n(t) corresponding to the reference time stamp output by the reference time stamp at time t;
[0095] Secondly, the compensation calculation module maintains two mapping relationship registers a and b, and updates the mapping relationship registers according to the mapping relationships a(t) and b(t) input by the statistics module to ensure that the mapping relationship registers a and b correspond to the time deviation parameter a and frequency deviation parameter b in the latest mapping relationship;
[0096] Then, the compensation calculation module maintains an initial phase difference register initialOffset to lock the initial time offset of the group master clock of the master node and the group slave clock of the slave node.
[0097] Exemplarily, when the packet slave clock starts to be in a locked state, the compensation calculation module determines the time as t=0, and initializes initialOffset=a(0)+b(0)*T2n(0)−Tb(0);
[0098] Finally, the compensation calculation module receives the notification message sent by the group slave clock correction module. The notification message carries the group slave clock time Tb(t) sent by the group slave clock correction module and the time T2n(t) output by the reference time stamp at time t, calculates the time deviation compensation parameter Offset, and sends the time deviation compensation parameter to the group slave clock correction module, where a(0) is the time deviation parameter at the initial moment and b(0) is the frequency offset parameter at the initial moment.
[0099] The compensation calculation module calculates the time offset compensation parameter Offset using the following formula: Offset=T1(t)−Tb(t)−initialOffset, where T1(t)=a+b*T2n(t).
[0100] If Offset is a positive value, the group slave clock time Tb(t) of the slave node is slower than the master clock T1(t), and the Offset needs to be added to the group slave clock time Tb to achieve clock synchronization between the master node and the slave node. If Offset is a negative value, the group slave clock time Tb(t) of the slave node is faster than the master clock T1(t), and the Offset needs to be subtracted from the group slave clock time Tb to achieve clock synchronization between the master node and the slave node.
[0101] In some embodiments, if during the transmission of the synchronization message between the master node and the slave node, it is determined that a routing path switch occurs, resulting in a change in the transmission time of the synchronization message between the master node and the slave node, the jitter of the time layer corresponding to the master clock timestamp of the master node carried by the synchronization message after the routing switch and the reference time stamp of the slave node can be changed to determine the corresponding frequency offset increment (also known as the difference in inherent delay) deltaOffsetCasuedByRouteChange, that is, the frequency offset caused by the routing switch, and then the initialOffset is updated based on the frequency offset increment.
[0102] Specifically, initialOffset=initialOffset+deltaOffsetCasuedByRouteChange.
[0103] It is understood that in some embodiments, the master node and the slave node may switch multiple times during the process of transmitting multiple synchronization messages. For example, at the 5th minute, the master node switches to the B path, and at the 10th minute, the master node switches back to the A path. In this way, before the 5th minute, the locked frequency offset is initialOffset. When a route switch occurs, the updated frequency offset is initialOffset_orig. When a route switch occurs again at the 10th minute, if the time deviation between the switched path and the time before the 5th minute is less than a preset threshold, it is determined that the master node and the slave node's path has switched to the original path, and the frequency offset is updated to initialOffset. By resetting the frequency offset to initialOffset, the cumulative deviation of the initialOffset calculation caused by multiple route switches can be significantly reduced.
[0104] In some embodiments, the compensation calculation module is further configured to determine a frequency compensation parameter between the master node and the slave node within a preset compensation period interval based on the mapping relationship and the time combination. Specifically, the frequency compensation parameter is used to perform frequency compensation on the reference clock of the slave node to obtain the slave clock time of the slave node, thereby achieving clock synchronization between the slave node and the master node.
[0105] Furthermore, the compensation calculation module can determine the time compensation parameters and frequency compensation parameters according to the above method, and then perform time compensation on the reference clock of the slave node according to the time compensation parameters, and perform frequency compensation on the reference clock of the slave node according to the frequency compensation parameters and the compensation period interval, so as to achieve clock synchronization between the slave node and the master node.
[0106] In some embodiments, the compensation calculation module and the group slave clock correction module determine the compensation cycle interval, and determine the frequency offset between the master node and the slave node within the compensation cycle interval based on the notification message and the mapping relationship, and perform periodic frequency offset compensation on the reference clock of the slave node based on the determined frequency offset to obtain the reference clock time, thereby achieving clock synchronization between the slave node and the master node.
[0107] In some embodiments, if the compensation period interval is C and the mapping relationship is T1(t)=a+b*T2(t), then the frequency offset between the master node and the slave node is freqComp=(b-1)*C. If b=1 and freqComp=0, no frequency offset compensation is required. If b is not 1 and freqComp is not 0, the grouped slave clock correction module performs frequency offset compensation with a period of C on the slave clock time of the slave node based on the freqComp parameter input by the compensation calculation module.
[0108] Please refer to FIG2 . The grouped slave clock correction module in FIG2 includes a grouped slave clock time calculation module and a grouped slave clock time feedback module.
[0109] The reference time scale in FIG2 includes a first reference time scale and a second reference time scale. The first reference time scale and the second reference time scale may be the same reference time scale, or the first reference time scale and the second reference time scale may be two different reference time scales.
[0110] The group slave clock time calculation module has the following functions:
[0111] 1. Perform frequency compensation on the timestamp T2m(t) corresponding to the original clock before correction.
[0112] Among them, the original clock before correction can be the first reference time scale of the slave node, or the second reference time scale dedicated to the group slave clock correction module itself (such as the second reference time scale in Figure 2), which is not limited in this application.
[0113] Specifically, the compensation cycle interval C is determined, the frequency offset compensation value freqComp sent by the compensation calculation module is received, and then the slave clock time calculation module compensates the timestamp T2m(t) corresponding to the original clock before correction every C cycle duration.
[0114] △T2m=T2m(t)–T2m(t-1), where △T2m is the time length between the two original clock times T2m(t) and T2m(t-1) before the original clock frequency of the slave node is compensated.
[0115] ΔTb=ΔT2m+ΔT2m / C*freqComp, where ΔTb is the time length between the two original clock times T2m(t) and T2m(t-1) after the frequency compensation of the slave node.
[0116] Then the timestamp after frequency compensation of the slave clock T2m(t) of the slave node group is T2m(t)=T2m(t-1)+ΔTb.
[0117] 2. Perform time deviation compensation on the original time Tb before correction.
[0118] Specifically, the time offset compensation parameter Offset sent by the compensation calculation module is received, and time compensation is performed on Tb according to the time offset compensation parameter.
[0119] Exemplarily, Tb=Tb+Offset;
[0120] The group slave clock time feedback module is used to periodically combine Tb(t) input by the group slave clock time calculation module and T2n(t) output by the reference time scale at time t into a tuple, and send Tb(t) and T2n(t) to the compensation calculation module through a notification message so that the compensation calculation module can perform time deviation compensation calculation.
[0121] Please refer to Figure 3, which is a schematic diagram of a method for determining a mapping relationship by a statistical module provided in an embodiment of the present application.
[0122] Figure 3 includes original points, minimum points, selected points, and outliers. Original points are the T1(t), T2(t) tuples reported by the timestamp module for all packets. Minimum points are the output of minimum point selection processing on several original points. When a minimum point meets the conditions for inclusion in the set corresponding to the selected points, it is classified as a selected point. When a minimum point does not meet the conditions for inclusion in the set corresponding to the selected points, it is classified as an outlier.
[0123] Specifically, the statistical module calls the two-tuple consisting of T1(t) carried in the synchronization message sent by the master node and the reference time stamp T2(t) of the slave node a "point", and all the two-tuples sent by the packet message timestamp module to the peer module are called "original points", and then the original points are added to the original point FIFO set.
[0124] Among them, the size of the original point FIFO set is limited. The size can be preset as a fixed size, or it can be measured based on clock indicators such as TDEV and MTIE to determine the data jitter in the original point FIFO set, and then the size of the original point FIFO set can be dynamically adjusted based on the data jitter.
[0125] For example, when the data jitter in the raw point FIFO set is relatively large, the size of the raw point FIFO set can be increased to collect more data to reduce the error of the statistical algorithm; when the jitter is relatively small, the size of the raw point FIFO set can be reduced to increase the frequency of the statistical algorithm output.
[0126] The original point FIFO set is a first-in, first-out set. The first-entered original point FIFO set is deleted when the size of the original point FIFO set exceeds the preset size to ensure that the size of the original point FIFO set meets the set value.
[0127] When the number of raw points in the raw point FIFO set reaches a preset size threshold, the statistical module determines the selected points in the FIFO set according to the selected point selection algorithm.
[0128] Exemplarily, a point with the smallest packet delay (PacketDelay) is selected from all original point FIFO sets as the minimum point, and then the minimum point is added to the selected point FIFO set. Subsequently, the minimum point determined based on the minimum packet delay is compared with the selected point FIFO set to determine whether the deviation between the minimum point and the selected point set is within the preset jitter range. If the deviation is within the preset jitter range, the minimum point is added to the selected point FIFO set. If the deviation exceeds the preset jitter range, the minimum point is added to the abnormal point FIFO set.
[0129] Wherein, PacketDelay=t2(t)-t1(t), t1(t) is the master clock timestamp of the master node, and t2(t) is the reference timestamp of the slave node.
[0130] Furthermore, when comparing the PacketDelays of two points, the influence of frequency offset can be further eliminated as much as possible.
[0131] For example, it is assumed that the mapping relationship between T1(t) and T2(t) last time is output according to the statistical algorithm as: T1(t)=a+b*T2(t), T1(t) is the master clock timestamp of the master node, T2(t) is the reference time stamp of the slave node, a is the time deviation parameter between the master node and the slave node, and b is the frequency offset parameter between the master node and the slave node;
[0132] From time tx to time ty, the effect of frequency offset on time deviation is (T2(ty)-T2(tx))*(b-1). When b=1, frequency offset has no effect on time deviation.
[0133] If frequency offset is not considered, PacketDelay(ty)–PacketDelay(tx)=(T2(ty)-T1(ty))–(T2(tx)–T1(tx))=(T2(ty)–T2(tx))–(T1(ty)–T1(tx)), that is, △PacketDelay=△T2-△T1;
[0134] If the effect of frequency offset is eliminated, PacketDelay(ty)–PacketDelay(tx)=(T2(ty)–T2(tx))–(T1(ty)–T1(tx))-(T2(ty)-T2(tx))*(b-1)=(T2(ty)–T2(tx))*b-(T1(ty)–T1(tx)), that is, △PacketDelay=△T2*b-△T1.
[0135] By comparing the △PacketDelay between two original points, the statistical module sorts all points in the original point FIFO set and selects the point with the smallest PacketDelay as the output of the minimum point selection algorithm. Of course, a certain preset number or preset proportion of points with the lowest PacketDelay can also be selected as the output of the minimum point selection algorithm. Of course, a preset number or preset proportion of points with the lowest PacketDelay can also be averaged and the average value is used as the output of the minimum point selection algorithm.
[0136] In some embodiments, the minimum point output by the original point FIFO set is compared with the data set in the selected point FIFO set to determine whether the minimum point output by the original point FIFO set is within the deviation range. The determination method includes the following:
[0137] First, the mapping relationship between T1(t) and T2(t) is determined based on the data set in the selected point FIFO set: T1(t) = a + b * T2(t). The minimum point output by the original point FIFO set is (T1m(t), T2m(t)).
[0138] Then, the deviation Diff = a + b * T2m(t) - T1m(t) is determined. If the deviation value exceeds the preset deviation range, the minimum point output by the original point FIFO set is determined to be an outlier, and the outlier is added to the outlier point FIFO set. If the deviation value is within the preset deviation range, the minimum point output by the original point FIFO set is determined to be a selected point, and the minimum point is added to the selected point FIFO set. The mapping relationship between T1(t) and T2(t) is updated based on the statistical algorithm and the updated selected point FIFO set.
[0139] It is easy to understand that during the transmission process of the synchronization message sent by the master node to the slave node, network congestion or route switching in the transmission path will introduce fluctuations in the transmission delay, causing the fluctuation of the minimum point output by the original point FIFO set to exceed the preset jitter range. When determining the selected point FIFO set, if the fluctuation of the minimum point output by the original point FIFO set exceeds the preset jitter range, the abnormal point is usually discarded, resulting in the inability to effectively utilize the minimum point.
[0140] In this embodiment of the present application, when determining the selected point FIFO set, if the minimum point output by the original point FIFO set is an outlier, the statistical module determines whether the outlier is caused by a switch in the transmission path of the synchronization message. If so, the selected point FIFO set is updated based on the outlier FIFO set; if it is caused by other reasons, the outlier FIFO set is discarded. In this way, outliers caused by route switching can be used as new selected points, increasing the number of selected points in the selected point FIFO set and improving the accuracy of mapping relationships determined based on the selected point FIFO set.
[0141] Please refer to Figure 4, which shows the transmission delay of a synchronization message. Transmission delay consists of intrinsic delay and PDV. Intrinsic delay is the minimum delay during the transmission of a synchronization message from a master node to a slave node. For example, it can be composed of intrinsic delay in internal processing and propagation delay. PDV refers to the variable portion of the synchronization message transmission delay, such as the variable queuing delay caused by store-and-forwarding in network nodes. The transmission time of a synchronization message between a master node and a slave node can be between ta and tb, where ta is the fixed delay and the difference between tb and ta is the PDV that may be generated during the transmission of the synchronization message.
[0142] PDV can be determined by filtering and denoising using the aforementioned minimum point selection method, minimum point jitter determination method, and selected point FIFO set mapping relationship regression method. If a route switch occurs during synchronization message transmission, it may cause the inherent delay between the master clock of the master node and the grouped slave clock of the slave node to change, which will have a significant adverse impact on the accuracy of the grouped slave clock of the slave node.
[0143] When the minimum point in the original point FIFO set is determined according to the above method and it is determined that the jitter of the minimum point exceeds the preset jitter range, the minimum point is added to the abnormal point FIFO set, and then it is determined in the following way whether the abnormal point in the abnormal point FIFO set is caused by route switching, that is, whether the jitter of the minimum point exceeds the preset jitter range due to route switching of the path between the master node and the slave node.
[0144] Specifically, if the outlier in the outlier FIFO set meets the following routing switching conditions, it is determined that routing switching occurs on the path between the master node and the slave node:
[0145] Route switching condition 1: the number of outliers in the outlier FIFO set is greater than the preset threshold;
[0146] Route switching condition two: the jitter between the abnormal points in the abnormal point FIFO set is within a preset jitter range.
[0147] Figure 5 is a schematic diagram of a route switching scenario provided by an embodiment of the present application. As shown in Figure 5, the horizontal axis in Figure 5 is the clock time t2 of the slave node, and the vertical axis is PacketDelay, that is, PacketDelay = t2-t1, wherein t1 is the clock time of the master node, and t2 is the clock time of the slave node. It can be seen from Figure 5 that at around 900 microseconds, the transmission path of the synchronization message between the master node and the slave node undergoes route switching. In the range of 900 microseconds to 1700 microseconds, the PDV of the synchronization message becomes larger, and all points in the range jitter within the preset range, that is, the jitter is small, and there are more minimum points in the range of 900 microseconds to 1700 microseconds. It can be determined that in the range of 900 microseconds to 1700 microseconds, route switching has occurred in the transmission of the synchronization message.
[0148] Figure 6 is a schematic diagram of a network congestion scenario provided by an embodiment of the present application. In Figure 6, the PDV of the synchronization message increases at the 900th microsecond and the 1900th microsecond due to temporary congestion of the cache in the packet network. Since network congestion is mostly short-lived, the number of anomalies affected by network congestion is small and the jitter of adjacent anomalies is large. It can be determined that the anomaly with this characteristic is not caused by routing switching.
[0149] In some embodiments, jitter measurement of the outliers in the outlier FIFO set can be performed based on indicators such as MTIE and TDEV. The statistical module determines a first mapping relationship based on the outlier FIFO set and the regression algorithm: T1(t) = a + b*T2(t). This mapping relationship is strongly correlated with the second mapping relationship obtained based on the selected point FIFO set and the regression algorithm. The judgment can be made based on whether the number of consecutive outliers whose deviation from b1 in the first mapping relationship and b in the first mapping relationship is less than a preset threshold is greater than a preset number threshold.
[0150] In some embodiments, the route switching condition further includes:
[0151] Route switching condition three: The inherent time difference between the time deviation parameter a determined by the outlier FIFO set and the time deviation parameter a determined by the selected point FIFO set is greater than the preset delay range. It is understood that if a route switch occurs during the transmission of a synchronization message, the different paths before and after the switch will cause the fixed delay of the synchronization message transmission to change. In most switching scenarios, the transmission delay of the synchronization message before and after the switch varies significantly. By introducing route switching condition three, we can prevent transmission delay jitter caused by other scenarios from being mistaken for a route switch.
[0152] It is understood that when it is determined that a route switch has occurred in the transmission path of the synchronization message, the statistical module performs corresponding route switch processing, that is, the statistical module needs to calculate the phase offset parameter (difference in inherent delay) deltaOffsetCausedByRouteChange caused by the route switch.
[0153] The statistical module calculates the phase deviation parameters in the following steps:
[0154] Determine the average value of all the most selected points in the selected point FIFO set to obtain the first average point;
[0155] Determine the average value of all the most abnormal points in the abnormal point FIFO set to obtain the second average point;
[0156] Determining frequency deviation calculation parameters based on the selected point in the selected point FIFO set and the abnormal point in the abnormal point FIFO set;
[0157] The difference in intrinsic delay is determined according to the following formula: deltaOffsetCausedByRouteChange = –(T1outlier-T1selected)+b_routechange*(T2outlier-T2selected);
[0158] Among them, deltaOffsetCausedByRouteChange is the difference in inherent delay, T1outlier is the ordinate of the first average point, T2outlier is the abscissa of the first average point, b_routechange is the frequency offset calculation parameter, T1selected is the ordinate of the second average point, and T2selected is the abscissa of the second average point.
[0159] Exemplarily, the statistics module determines the difference in intrinsic delay according to the following steps:
[0160] Step A: Determine the average value of all points in the selected point FIFO set to obtain point A (T1outlier, T2outlier);
[0161] Step B: Determine the average value of all points in the abnormal point FIFO set to obtain point B (T1selected, T2selected);
[0162] Step C: Determine the frequency offset calculation parameter b_routechange.
[0163] The frequency offset calculation parameter b_routechange is determined by the following two methods:
[0164] Method 1: Determine the jitter of the selected points in the selected point FIFO set and the outlier points in the outlier FIFO set, and determine the b value of the set with smaller jitter as the frequency deviation calculation parameter b_routechange;
[0165] Method 2: Determine the average of the b values of the selected point FIFO set and the b values of the abnormal point FIFO set, and use the average as the frequency deviation calculation parameter b_routechange;
[0166] It is understood that in other embodiments, corresponding weights may be allocated according to the size of the selected point FIFO set and the size of the abnormal point FIFO set, and the frequency deviation calculation parameter b_routechange may be determined according to the weights and the corresponding average values.
[0167] For example, if the size of the selected point FIFO set is 100, the average value is 10, and the size of the outlier FIFO set is 50, the average value is 6. Then the weight corresponding to the selected point FIFO set is 2, the weight corresponding to the outlier FIFO set is 1, and the weight corresponding to the outlier FIFO set is 3. The average value is (2*6+1*3) / 2=7.5. Therefore, b_routechange is 7.5.
[0168] Step D: Calculate the difference in intrinsic delay according to the following method: deltaOffsetCausedByRouteChange=–(T1outlier−T1selected)+b_routechange(T2outlier−T2selected).
[0169] When deltaOffsetCausedByRouteChange is a positive value, it indicates that the delay of the outlier FIFO set is greater than the delay of the selected point FIFO set.
[0170] Furthermore, the statistics module can update the selected point FIFO set based on the outlier FIFO set, and then determine a new mapping relationship based on the updated FIFO set. The updated mapping relationship and deltaOffsetCausedByRouteChange are then sent to the compensation calculation module, and the outlier FIFO set is cleared.
[0171] It can be understood that the sets in the above embodiments are all FIFO sets. It can be understood that in other embodiments, other types of sets can also be used, as long as the points that meet the requirements, such as the points with the longest storage time or the largest PacketDelay in the set, can be selected.
[0172] Please refer to Figure 7, which is a flow chart of a clock synchronization method provided by an embodiment of the present application. The clock synchronization method is applied to the slave node shown in Figure 1.
[0173] S701. Receive a synchronization message sent by a master node, where the synchronization message carries a master clock timestamp of the master node.
[0174] S702: Establish a mapping relationship between the master clock timestamp of the master node and the reference time stamp of the slave node based on the master clock timestamp and the timestamp corresponding to the reference time stamp of the slave node when the slave node receives the synchronization message;
[0175] S703: Obtain a time combination of a timestamp corresponding to a reference time stamp of the slave node and a slave clock time of the slave node, where the reference time stamp of the slave node and the corresponding slave clock time are collected at the same time;
[0176] S704: Determine a compensation parameter according to the mapping relationship and the time combination, and synchronize the clocks of the slave node and the master node according to the compensation parameter.
[0177] The association between the master clock of the master node and the slave clock time of the slave node is achieved through the reference time scale of the slave node. The compensation parameters are determined by the mapping relationship between the master clock of the master node and the reference time scale of the slave node and the time combination of the timestamp corresponding to the reference time scale of the slave node and the slave clock time of the slave node. The reference slave clock of the slave node is compensated according to the compensation parameters to achieve clock synchronization between the slave node and the master node.
[0178] In some embodiments, the compensation parameters include time compensation parameters, and determining the compensation parameters based on the mapping relationship and the time combination includes: determining the initial time offset between the master node and the slave node corresponding to the specific moment based on the mapping relationship and the time combination corresponding to the specific moment; determining the time compensation parameters based on the mapping relationship, the time combination and the initial time offset.
[0179] In some embodiments, an initial time offset is determined to lock the initial time offset between the master node and the slave node, and after locking the initial time offset, the time offset between the master node and the slave node, i.e., the time compensation parameter, is determined to ensure that the time deviation when the slave node and the master node perform clock synchronization is bounded.
[0180] In some embodiments, the compensation parameters further include frequency offset compensation parameters, and the clock synchronization method further includes: determining the frequency compensation parameters between the master node and the slave node within a preset frequency compensation period interval based on the mapping relationship and the time combination.
[0181] After time compensation is performed on the slave node, frequency compensation is periodically performed on the slave node to achieve clock synchronization between the slave node and the master node.
[0182] In some embodiments, the mapping relationship is: T1(t)=a+b*T2(t), where T1(t) is the timestamp of the master node at time t carried by the synchronization message, T2(t) is the timestamp corresponding to the reference time mark of the slave node at time t, a is the time deviation parameter, and b is the frequency offset parameter; based on the mapping relationship and the time combination corresponding to the specific moment, the initial time offset between the master node and the slave node corresponding to the specific moment is determined as: initialOffset=a(0)+b(0)*T2n(0)–Tb(0);
[0183] Where initialOffset is the initial time offset between the master node and the slave node at the initial moment, T2n(0) is the timestamp corresponding to the reference time of the slave node at the initial moment, and Tb(0) is the slave clock time of the slave node at the initial moment. The initial moment is the moment when the slave node locks the frequency offset between the master node and the slave node.
[0184] The time compensation parameters are determined based on the mapping relationship, time combination and initial time offset: Offset = T1(t) – Tb(t) – initialOffset; T1(t) = a + * T2n(t);
[0185] Where Offset is the time compensation parameter, Tb(t) is the slave clock time of the slave node at time t, and T2n(t) is the timestamp corresponding to the reference time scale of the slave node at time t.
[0186] The mapping relationship between the master clock of the master node and the reference time scale of the slave node is a linear regression function. The time compensation parameter is calculated based on the mapping relationship, which can improve the clock synchronization performance between the slave node and the master node.
[0187] In some embodiments, a frequency compensation parameter between the master node and the slave node corresponding to a compensation period interval is determined based on a mapping relationship and a time combination as follows: freqComp = (b-1) * C, where freqComp is the frequency compensation parameter and C is the compensation period interval. Frequency compensation within the compensation period interval is determined based on the mapping relationship.
[0188] It can be understood that the sets in the following embodiments are all FIFO sets. It can be understood that in other embodiments, other types of sets can also be used, as long as the points that meet the requirements, such as the points with the longest storage time or the largest PacketDelay time in the set, can be selected.
[0189] In some embodiments, establishing a mapping relationship between a master clock of a master node and a reference time stamp of a slave node includes: constructing an original point FIFO set based on timestamps of the master clocks of multiple master nodes and the reference time stamps of the slave nodes; determining a minimum point in the original point FIFO set; determining a selected point in a selected point FIFO set based on the minimum point; and determining a mapping relationship between the master clock of the master node and the reference time stamp of the slave node based on the selected point FIFO set. The selected point is determined using a minimum point algorithm, and the mapping relationship is determined based on the selected point, where the minimum point may be a point with a minimum PacketDelay.
[0190] In some embodiments, the clock synchronization method further includes: determining an outlier FIFO set based on a minimum point, wherein the jitter between the master clock timestamp of the master node and the timestamp corresponding to the reference time scale of the slave node in the outlier FIFO set exceeds a preset jitter range; determining, based on the outlier FIFO set, that a route switch has occurred in the path between the master node and the slave node, and updating the selected point FIFO set based on the outlier FIFO set. If it is determined that the outlier point is caused by a route switch, the outlier point can be used as a new selected point to increase the number of selected points and improve the accuracy of the mapping relationship.
[0191] In some embodiments, determining that a route switch occurs in a path between a master node and a slave node based on an outlier FIFO set includes: determining that a route switch occurs in a path between a master node and a slave node if the minimum point in the outlier FIFO set satisfies the following route switching conditions: route switching condition one: the number of minimum points in the outlier FIFO set is greater than a preset number threshold; route switching condition two: the jitter between the minimum points in the outlier FIFO set is within a preset jitter range.
[0192] The above judgment conditions are used to determine whether the minimum point in the outlier FIFO set meets the switching conditions. If the switching conditions are met, the minimum point in the outlier FIFO set is used as the new selected point. By increasing the number of selected points, the accuracy of the mapping relationship is improved.
[0193] In some embodiments, the route switching condition further includes: route switching condition three: the difference in inherent delay between a selected point in the selected point FIFO set and an outlier in the outlier FIFO set is greater than a preset distance range. The route switching condition three is used to prevent an outlier from being mistakenly selected as a selected point due to network congestion, etc.
[0194] In some embodiments, a method for determining the difference in intrinsic delay includes: determining an average value of all selected points in a selected point FIFO set to obtain a first average point; determining an average value of all outliers in an outlier FIFO set to obtain a second average point; determining a frequency offset calculation parameter based on the selected points in the selected point FIFO set and the outliers in the outlier FIFO set; and determining the difference in intrinsic delay based on the following formula: deltaOffsetCausedByRouteChange=–(T1outlier-T1selected)+b_routechange*(T2outlier-T2selected).
[0195] Where deltaOffsetCausedByRouteChange is the difference in inherent delay, T1outlier is the ordinate of the first average point, T2outlier is the abscissa of the first average point, b_routechange is the frequency offset calculation parameter, T1selected is the ordinate of the second average point, and T2selected is the abscissa of the second average point. This ensures that a route switch occurs during synchronization message transmission and then determines the delay compensation caused by the route switch. The difference in inherent delay is used to compensate for the increased transmission delay caused by the route switch, ensuring bounded clock synchronization between the slave and master nodes.
[0196] In some embodiments, determining the frequency offset parameter based on determining the selected points in the selected point FIFO set and the outliers in the outlier FIFO set includes: obtaining a first mapping relationship corresponding to all selected points in the selected point FIFO set and a second mapping relationship corresponding to all outliers in the outlier FIFO set; and determining the frequency offset calculation parameter based on the first mapping relationship and the second mapping relationship.
[0197] The frequency offset calculation parameters are determined by selecting the mapping relationship corresponding to the FIFO set with smaller jitter, so as to improve the accuracy of the inherent delay difference calculation.
[0198] In some embodiments, determining a frequency offset calculation parameter based on determining a selected point in a selected point FIFO set and an outlier in an outlier FIFO set includes: obtaining a first jitter range for the selected point in the selected point FIFO set and a second jitter range for the outlier in the outlier FIFO set; and determining a mapping relationship between the FIFO sets with smaller jitter between the first jitter range and the second jitter range to determine the frequency offset calculation parameter. Using the above technical solution, the frequency offset calculation parameter is determined by averaging the mapping relationships corresponding to the selected FIFO sets, thereby improving the accuracy of the inherent delay difference calculation.
[0199] In some embodiments, the synchronization message sent by the master node is received via a packet switching network.
[0200] Please refer to Figure 8, which shows a schematic diagram of the structure of a slave node provided by an exemplary embodiment of the present application. The slave node can implement the functions of the slave nodes in Figures 1 to 6 above.
[0201] The slave node 120 includes a processor 121 , a bus 122 , and a memory 123 .
[0202] The processor 121 may include one or more central processing units (CPUs), such as CPU0 and CPU1. The processor 121 executes various functional applications and business processes by running software programs and modules.
[0203] The memory 123 is connected to the processor 121 via the bus 122 .
[0204] The memory 123 may be used to store software programs and modules, which are executed by the processor 121. In addition, the memory 123 may also store various types of business data. In an embodiment of the present application, the software programs and modules stored in the memory 123 may include an application module 126 required for at least one function executed by the processor 121.
[0205] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the application can adopt the form of hardware embodiments, software embodiments, or embodiments in combination with software and hardware. Moreover, the application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program codes. These computer program codes can be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in an ad hoc manner.
[0206] This embodiment further provides a computer storage medium storing computer instructions. When the computer instructions are executed on an entry device, the entry device executes the above-mentioned related method steps to implement the clock synchronization method in the above-mentioned embodiment.
[0207] This embodiment further provides a computer program product. When the computer program product is run on a portal device, the portal device is caused to execute the above-mentioned related steps to implement the clock synchronization method in the above-mentioned embodiment.
[0208] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer execution instructions, and when the device is running, the processor can execute the computer execution instructions stored in the memory to enable the chip to execute the clock synchronization method in the above-mentioned method embodiments.
[0209] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0210] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the module or module division is only a logical function division. In actual implementation, there may be other division methods, such as multiple modules or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0211] Modules described as separate components may or may not be physically separate, and components shown as modules may be one physical module or multiple physical modules, that is, they may be located in one place or distributed in multiple places. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0212] In addition, the functional modules in the various embodiments of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The above-mentioned integrated modules may be implemented in the form of hardware or software functional modules.
[0213] If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0214] The above is only a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A clock synchronization method, characterized in that: Applied to a slave node, the clock synchronization method comprises: Receive a synchronization message sent by a master node, wherein the synchronization message carries a master clock timestamp of the master node; Establishing a mapping relationship between the master clock of the master node and the reference time stamp of the slave node according to the timestamp of the master clock and the timestamp corresponding to the reference time stamp of the slave node when the slave node receives the synchronization message; Acquire a time combination of a timestamp corresponding to a reference time mark of the slave node and a slave clock time of the slave node, wherein the acquisition time of the timestamp corresponding to the reference time mark of the slave node and the slave clock time corresponding to the reference time mark are the same; A compensation parameter is determined according to the mapping relationship and the time combination, so as to perform clock synchronization between the slave node and the master node according to the compensation parameter.
2. The clock synchronization method according to claim 1, characterized in that: The compensation parameter includes a time compensation parameter, and determining the compensation parameter according to the mapping relationship and the time combination includes: Determine an initial time offset between the master node and the slave node corresponding to the specific moment according to the mapping relationship and the time combination corresponding to the specific moment; The time compensation parameter is determined according to the mapping relationship, the time combination and the initial time offset.
3. The clock synchronization method according to claim 2, characterized in that: The compensation parameter also includes a frequency offset compensation parameter, and the clock synchronization method also includes: A frequency compensation parameter between the master node and the slave node within a preset frequency compensation period interval is determined according to the mapping relationship and the time combination.
4. The clock synchronization method according to claim 3, characterized in that: The mapping relationship between the master clock of the master node and the reference time scale of the slave node is: T1(t)=a+b*T2(t), where T1(t) is the timestamp of the master node at time t carried by the synchronization message, T2(t) is the timestamp corresponding to the reference time stamp of the slave node at time t, a is the time deviation parameter, and b is the frequency offset parameter; The initial time offset between the master node and the slave node corresponding to the specific moment is determined according to the mapping relationship and the time combination corresponding to the specific moment as follows: initialOffset=a(0)+b(0)*T2n(0)–Tb(0); Wherein, initialOffset is the initial time offset between the master node and the slave node at the initial moment, T2n(0) is the timestamp corresponding to the reference time mark of the slave node at the initial moment, Tb(0) is the slave clock time of the slave node at the initial moment, a(0) is the time deviation parameter at the initial moment, and b(0) is the frequency offset parameter at the initial moment; The time compensation parameter is determined according to the mapping relationship, the time combination and the initial time offset as follows: Offset=T1(t)–Tb(t)–initialOffset; T1(t)=a+b*T2n(t); Wherein, Offset is the time compensation parameter, Tb(t) is the slave clock time of the slave node at time t, and T2n(t) is the timestamp corresponding to the reference time stamp of the slave node at time t.
5. The clock synchronization method according to claim 4, characterized in that: The frequency compensation parameter between the master node and the slave node corresponding to the compensation period interval determined according to the mapping relationship and the time combination is: freqComp=(b-1)*C; Wherein, freqComp is the frequency compensation parameter, and C is the compensation cycle interval.
6. The clock synchronization method according to any one of claims 1 to 5, characterized in that: The establishing of a mapping relationship between the master clock of the master node and the reference time stamp of the slave node according to the timestamp of the master clock and the timestamp corresponding to the reference time stamp of the slave node when the slave node receives the synchronization message comprises: Constructing an original point set according to the timestamps of the master clocks of the plurality of master nodes and the timestamps corresponding to the reference time scales of the slave nodes; Determine the minimum point in the original point set; Determine a selected point in the selected point set according to the minimum point; A mapping relationship between the master clock of the master node and the reference time scale of the slave node is determined according to the selected point set.
7. The clock synchronization method according to claim 6, characterized in that: The clock synchronization method further comprises: Determine an abnormal point set based on the minimum point, the master clock timestamp of the master node and the reference time stamp of the slave node in the abnormal point set The jitter between the corresponding timestamps exceeds the preset jitter range; Determining, based on the abnormal point set, that a route switching occurs between the master node and the slave node; Based on the route switching between the master node and the slave node, the selected point set is updated according to the abnormal point set.
8. The clock synchronization method according to claim 7, characterized in that: Determining, based on the abnormal point set, that a route switching occurs between the master node and the slave node includes: If the minimum point in the abnormal point set meets the routing switching condition, it is determined that the path between the master node and the slave node undergoes routing switching, and the routing switching condition includes: Route switching condition 1: the number of outliers in the outlier set is greater than a preset number threshold; Route switching condition two: the jitter between the abnormal points in the abnormal point set is within a preset jitter range.
9. The clock synchronization method according to claim 8, characterized in that: The routing switching condition also includes: Route switching condition three: the difference in inherent delay between a selected point in the selected point set and a corresponding abnormal point in the abnormal point set is greater than a preset delay range.
10. The clock synchronization method according to claim 9, characterized in that: Method for determining the difference of the inherent delay: Determine the average value of all selected points in the selected point set to obtain a first average point; Determine the average value of all abnormal points in the abnormal point set to obtain a second average point; Determining frequency deviation calculation parameters according to the selected points in the selected point set and the outlier points in the outlier point set; The difference in inherent delay is determined according to the following formula: deltaOffsetCausedByRouteChange=–(T1outlier-T1selected)+b_routechange*(T2outlier-T2selected); Among them, deltaOffsetCausedByRouteChange is the difference of the inherent delay, T1outlier is the ordinate of the first average point, T2outlier is the abscissa of the first average point, b_routechange is the frequency offset calculation parameter, T1selected is the ordinate of the second average point, and T2selected is the abscissa of the second average point.
11. The clock synchronization method according to claim 10, characterized in that: The determining of the frequency deviation calculation relationship based on the selected points in the selected point set and the outlier points in the outlier point set comprises: Obtaining a first mapping relationship corresponding to all selected points in the selected point set and a second mapping relationship corresponding to all outliers in the outlier point set; The frequency offset calculation parameter is determined according to the first mapping relationship and the second mapping relationship.
12. The clock synchronization method according to claim 10, characterized in that: The determining of the frequency deviation calculation parameters according to the selected points in the selected point set and the outlier points in the outlier point set comprises: Acquire a first jitter range of a selected point in the selected point set and a second jitter range of an outlier point in the outlier point set; A mapping relationship between a corresponding set of smaller jitters in the first jitter range and the second jitter range is determined to determine a frequency deviation calculation parameter.
13. The clock synchronization method according to any one of claims 1 to 12, characterized in that: The synchronization message sent by the master node is received through the packet switching network.
14. A slave node, characterized in that: The slave node includes a reference time stamp module, a packet message time stamp module, a statistics module, a packet slave clock correction module and a compensation calculation module; The packet message timestamp module is used to receive a synchronization message sent by a master node, wherein the synchronization message carries a master clock timestamp of the master node; Also used for receiving the timestamp corresponding to the reference time stamp of the slave node when the slave node receives the synchronization message sent by the reference time stamp module, and sending the timestamp of the master clock of the master node and the timestamp corresponding to the reference time stamp of the slave node to the statistical module; The statistical module is used to receive the master clock timestamp of the master node and the timestamp corresponding to the reference time stamp of the slave node and establish a mapping relationship between the master clock of the master node and the reference time stamp of the slave node, and then send the mapping relationship to the compensation calculation module; The compensation calculation module is used to receive the mapping relationship, and is also used to receive a notification message sent by the grouped slave clock correction module, the notification message carries a time combination of a timestamp corresponding to the reference time mark of the slave node and a slave clock time of the slave node, and the timestamp corresponding to the reference time mark of the slave node and the corresponding collection time of the slave clock time are the same; The compensation calculation module is also used to determine compensation parameters according to the mapping relationship and the time combination, and send the compensation parameters to the group slave clock correction module, so that the group slave clock correction module synchronizes the clock of the slave node according to the compensation parameters.
15. The slave node according to claim 14, characterized in that: The compensation parameters include time compensation parameters, and the compensation calculation module is further used for: Determine an initial time offset between the master node and the slave node corresponding to the specific moment according to the mapping relationship and the time combination corresponding to the specific moment; The time compensation parameter is determined according to the mapping relationship, the time combination and the initial time offset.
16. The slave node according to claim 15, characterized in that: The compensation parameters also include frequency offset compensation parameters, and the compensation calculation module is further used for: A frequency compensation parameter between the master node and the slave node within a preset frequency compensation period interval is determined according to the mapping relationship and the time combination.
17. The slave node according to claim 16, characterized in that: The mapping relationship between the master clock timestamp of the master node and the reference time stamp of the slave node is: T1(t)=a+b*T2(t), where T1(t) is the timestamp of the master node at time t carried by the synchronization message, T2(t) is the timestamp corresponding to the reference time stamp of the slave node at time t, a is the time deviation parameter, and b is the frequency offset parameter; The compensation calculation module is further used for: According to the mapping relationship and the time combination corresponding to the specific moment, the initial time offset between the master node and the slave node corresponding to the specific moment is determined as: initialOffset=a(0)+b(0)*T2n(0)–Tb(0); Wherein, initialOffset is the initial time offset between the master node and the slave node at the initial moment, T2n(0) is the reference time scale of the slave node at the initial moment, Tb(0) is the slave clock time of the slave node at the initial moment, a(0) is the time deviation parameter at the initial moment, and b(0) is the frequency offset parameter at the initial moment; The time compensation parameter is determined according to the mapping relationship, the time combination and the initial time offset: Offset=T1(t)–Tb(t)–initialOffset; T1(t)=a+b*T2n(t); Wherein, Offset is the time compensation parameter, Tb(t) is the slave clock time of the slave node at time t, and T2n(t) is the timestamp corresponding to the reference time stamp of the slave node at time t.
18. The slave node according to claim 17, characterized in that: The compensation calculation module is further used for: The frequency compensation parameter between the master node and the slave node corresponding to the compensation period interval is determined according to the mapping relationship and the time combination as follows: freqComp=(b-1)*C; Wherein, freqComp is the frequency compensation parameter, and C is the compensation cycle interval.
19. The slave node according to any one of claims 14 to 18, characterized in that: The statistics module is further used for: Constructing an original point set according to the timestamps of the master clocks of the plurality of master nodes and the timestamps corresponding to the reference time scales of the slave nodes; Determine the minimum point in the original point set; Determine a selected point in the selected point set according to the minimum point; A mapping relationship between the master clock timestamp of the master node and the reference time stamp of the slave node is determined according to the selected point set.
20. The slave node according to claim 19, characterized in that: The statistics module is also used for: Determine an abnormal point set according to the minimum point, wherein the jitter between the master clock timestamp of the master node and the timestamp corresponding to the reference time stamp of the slave node in the abnormal point set exceeds a preset jitter range; A route switch occurs on the path between the master node and the slave node according to the abnormal point set, and the selected point set is updated according to the abnormal point set.
21. The slave node according to claim 20, characterized in that: The statistics module is also used for: If the minimum point in the abnormal point set meets the routing switching condition, it is determined that the path between the master node and the slave node undergoes routing switching, and the routing switching condition includes: Route switching condition 1: the number of outliers in the outlier set is greater than a preset number threshold; Route switching condition two: the jitter between the abnormal points in the abnormal point set is within a preset jitter range.
22. The slave node according to claim 21, characterized in that The routing switching condition also includes: Route switching condition three: the difference in inherent delay between the selected point in the selected point set and the abnormal point in the abnormal point set is greater than a preset delay range.
23. The slave node according to claim 22, characterized in that The statistics module is also used for: Determine the average value of all selected points in the selected point set to obtain a first average point; Determine the average value of all abnormal points in the abnormal point set to obtain a second average point; Determining frequency deviation calculation parameters according to determining selected points in the selected point set and outliers in the outlier point set; The difference in inherent delay is determined according to the following formula: deltaOffsetCausedByRouteChange=–(T1outlier-T1selected)+b_routechange*(T2outlier-T2selected); Among them, deltaOffsetCausedByRouteChange is the difference of the inherent delay, T1outlier is the ordinate of the first average point, T2outlier is the abscissa of the first average point, b_routechange is the frequency offset calculation parameter, T1selected is the ordinate of the second average point, and T2selected is the abscissa of the second average point.
24. The slave node according to claim 23, characterized in that The frequency deviation calculation parameter is determined based on the selected point in the selected point set and the outlier point in the outlier point set, including: Obtaining a first mapping relationship corresponding to all selected points in the selected point set and a second mapping relationship corresponding to all outliers in the outlier point set; The frequency offset calculation parameter is determined according to the first mapping relationship and the second mapping relationship.
25. The slave node according to claim 23, characterized in that The frequency deviation calculation parameter is determined based on the selected point in the selected point set and the outlier point in the outlier point set, including: Acquire a first jitter range of a selected point in the selected point set and a second jitter range of an outlier point in the outlier point set; A mapping relationship between a corresponding set of smaller jitters in the first jitter range and the second jitter range is determined to determine a frequency deviation calculation parameter.
26. The slave node according to any one of claims 14 to 25, characterized in that: The packet message timestamp module is used to receive the synchronization message sent by the master node through the packet switching network.
27. A slave node, characterized in that: The slave node comprises: one or more processors; A storage device for storing one or more programs; The one or more programs are executed by the one or more processors, so that the one or more processors implement the clock synchronization method according to any one of claims 1 to 13.
28. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the clock synchronization method according to any one of claims 1 to 13 is implemented.
Citation Information
Patent Citations
Clock synchronization method and device
CN118573313A
NTP network time service evaluation system and method and time service evaluation device
CN112187560A
Clock synchronization system and method of industrial wireless network
CN114374462A
Time synchronization system
US20180062780A1
Nanosecond accuracy under precision time protocol for ethernet by using high accuracy timestamp assist device
US20180191802A1
Cited By
Time-sensitive network end-to-end time synchronization method, device and storage medium
CN119788232A
Digital clock remote metering method based on network delay suppression
CN120320891A
Hybrid time service method based on Beidou satellite navigation and TSN
CN120639232A
Positioning method, communication system and communication apparatus
WO2026148561A1
