WO2021190051A1 - Synchronization method and apparatus, device, and storage medium - Google Patents

Synchronization method and apparatus, device, and storage medium Download PDF

Info

Publication number
WO2021190051A1
WO2021190051A1 PCT/CN2020/141380 CN2020141380W WO2021190051A1 WO 2021190051 A1 WO2021190051 A1 WO 2021190051A1 CN 2020141380 W CN2020141380 W CN 2020141380W WO 2021190051 A1 WO2021190051 A1 WO 2021190051A1
Authority
WO
WIPO (PCT)
Prior art keywords
synchronization
node
synchronized
time
nodes
Prior art date
Application number
PCT/CN2020/141380
Other languages
French (fr)
Chinese (zh)
Inventor
罗彬�
王琳琳
何力
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2021190051A1 publication Critical patent/WO2021190051A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation

Definitions

  • This application relates to communication, for example, to a synchronization method, device, device, and storage medium.
  • the time synchronization network largely relies on Global Navigation Satellite System (GNSS) satellites, including time sources (for example, time servers) for timing, and end application nodes (for example, base stations) of the synchronization network, and so on.
  • time sources for example, time servers
  • end application nodes for example, base stations
  • the nodes based on its timing will use their respective frequency sources for timing.
  • the time server is based on internal atomic clocks, etc., and the synchronization transmission node equipment and base station can be based on the frequency of the frequency synchronization network.
  • the source also an atomic clock
  • performs time service However, atomic clocks have frequency accuracy errors, and time deviations occur between synchronization nodes after a period of time.
  • the time synchronization network adopts a master-slave time synchronization method that is passed down step by step.
  • One drawback of this method is that the upstream error is passed to the downstream, which leads to the deterioration of the performance of the communication network or even the unavailability.
  • the embodiments of the present application provide a synchronization method, device, equipment, and storage medium, which realize synchronization between various synchronization nodes.
  • the embodiment of the present application provides a synchronization method, including:
  • An embodiment of the present application provides a synchronization device, including:
  • a receiver configured to receive trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized
  • the adjustment module is configured to adjust the local time of each node to be synchronized according to a preset weighting algorithm and the trusted synchronization information.
  • An embodiment of the present application provides a device, including: a communication module, a memory, and one or more processors;
  • the communication module is configured to perform communication interaction between the first communication node and the second communication node;
  • the memory is configured to store one or more programs
  • the one or more processors When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of the foregoing embodiments.
  • An embodiment of the present application provides a storage medium that stores a computer program, and when the computer program is executed by a processor, the method described in any of the foregoing embodiments is implemented.
  • FIG. 1 is a flowchart of a synchronization method provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of establishing a time source synchronization network in a direct connection scenario according to an embodiment of the present application
  • FIG. 3 is a schematic diagram of establishing a time source synchronization network in a cross-node scenario according to an embodiment of the present application
  • FIG. 4 is a schematic diagram of establishing a synchronization network of synchronization transmission nodes according to an embodiment of the present application
  • FIG. 5 is a structural block diagram of a synchronization device provided by an embodiment of the present application.
  • Fig. 6 is a schematic structural diagram of a device provided by an embodiment of the present application.
  • the synchronization network one of the supporting systems for the operation of the communication network, provides a synchronization control signal for the clock (or carrier) of the communication equipment in the communication network to synchronize its working rate.
  • the synchronization network is one of the basic networks of the communication network, and it is the key to ensuring the timing performance of the network and thus ensuring the smooth development of the business.
  • synchronous digital hierarchy Synchronous Digital Hierarchy, SDH
  • asynchronous transmission mode Asynchronous Transmission Mode, ATM
  • CDMA Code Division Multiple Access
  • IP Internet Protocol
  • IP Internet Protocol
  • Ethernet synchronous Ethernet
  • various new services/applications such as positioning, Internet of Things, industrial automation, etc.
  • various new services/applications have increasingly higher requirements for synchronization. 1.5 microseconds, 260 nanoseconds for 5G to 30 nanoseconds and 3 nanoseconds for positioning.
  • corresponding synchronization accuracy levels have been formulated for synchronization devices with different functions, such as the time source PRTC-A (Primary Reference Time Clock (PRTC) Class A) accuracy of 100ns, enhanced The accuracy of the Enhanced Primary Reference Time Clock (ePRTC) is 30ns; the Telecom Boundary Clock (T-BC) Class B accuracy of the synchronous transmission equipment is 70ns, the T-BC Class C accuracy is 30ns, and the T-BC Class D accuracy is 5ns and so on.
  • PRTC-A Primary Reference Time Clock
  • ePRTC Enhanced Primary Reference Time Clock
  • T-BC Telecom Boundary Clock
  • PTP Institute of Electrical and Electronics Engineers 1588 (2008)
  • PTP messages that are more commonly used for synchronization include announcement messages (Announce messages), synchronization messages (Sync messages), delay request messages (Delay_Req messages) and delayed reply messages (Delay_Resp messages): Announce messages It is mainly used for the calculation of the Best Master Clock Algorithm (BMCA) to determine the reference time source and PTP port status (Master/Slave/Passive); Sync messages and Delay_Req messages mainly exchange time stamp information for Calculate the time difference between nodes.
  • BMCA Best Master Clock Algorithm
  • Sync messages and Delay_Req messages mainly exchange time stamp information for Calculate the time difference between nodes.
  • a follow-up message (Follow_Up message) is also required.
  • the embodiment of the present application provides a synchronization method, which not only realizes the rapid synchronization of each synchronization node, but also avoids the defect of error transmission.
  • the application of this solution to the time source can largely avoid the performance degradation and unavailability of the synchronization network caused by the GNSS satellite problem.
  • a synchronization method is provided to achieve synchronization between synchronization nodes.
  • Fig. 1 is a flowchart of a synchronization method provided by an embodiment of the present application. As shown in Figure 1, this embodiment includes S110-S120.
  • both the node to be synchronized and the synchronization node may be one of a time source node, a synchronization transmission node, and an end application node.
  • the number of synchronization nodes is at least one.
  • the trusted synchronization information refers to synchronization information of other synchronization nodes that can be received by the node to be synchronized.
  • S120 Adjust the local time of each node to be synchronized according to the preset weighting algorithm and the trusted synchronization information.
  • each node to be synchronized receives trusted synchronization information of other synchronization nodes adjacent to or across the node, and performs weighted synchronization according to the information of the node to be synchronized and other received trusted synchronization information.
  • a synchronization network is formed.
  • the node to be synchronized and the synchronization node are both time source nodes, after both the node to be synchronized and the synchronization node perform weighted synchronization, a time source synchronization network is formed.
  • each node to be synchronized combines its own synchronization information and the received trusted synchronization information, and adjusts the local time of the node to be synchronized according to a preset weighting algorithm, thereby realizing the communication between each synchronization node. Time synchronization.
  • all synchronization nodes corresponding to each node to be synchronized are adjacent nodes of the node to be synchronized; in the cross-node scenario, all synchronization nodes corresponding to each node to be synchronized can be It is the neighboring node of the node to be synchronized, or it may be the non-adjacent node of the node to be synchronized.
  • the synchronization node corresponding to the trusted synchronization information is included in the trusted master list configured by the weighted slave of the node to be synchronized; wherein the weighted master in the trusted master list is used to participate in the node to be synchronized
  • the time-weighted calculation of the trusted master terminal; the list of trusted master terminals includes at least one of the following: manually configure a specific master terminal, and set the trusted master terminal filtered by the trusted conditions.
  • the node to be synchronized when the node to be synchronized receives the trusted synchronization information of other synchronization nodes, it means that the attribute of the port on which the node to be synchronized receives the trusted synchronization information can be a weighted slave mode, or a weighted master sum Weighted slave mode, that is, the node to be synchronized can receive trusted synchronization information from other synchronization nodes (ie, peer devices).
  • the weighted master in the list of trusted masters refers to other synchronization nodes that can participate in the time weighting calculation of the node to be synchronized, that is, the weighted master is used to send its own trusted synchronization information to the node to be synchronized (ie, the peer equipment).
  • the synchronization node included in the trusted master list may be a specific synchronization node manually configured, or may be a synchronization node obtained by screening after setting a trusted condition.
  • the method further includes: configuring a synchronization mechanism for each node to be synchronized and all corresponding synchronization nodes.
  • configuring the synchronization mechanism of each node to be synchronized and all corresponding synchronization nodes includes: configuring each port attribute of each node to be synchronized and all corresponding synchronization nodes;
  • Port attributes include at least one of the following: weighted master mode, weighted slave mode, weighted master and weighted slave mode; weighted master mode is that the node to be synchronized sends its own synchronization information to the peer synchronization node; weighted slave mode is that the node to be synchronized receives The trusted synchronization information of the peer synchronization node is calculated and weighted; the weighted master and weighted slave modes not only receive the trusted synchronization information of the peer synchronization node, but also send its own synchronization information to the peer synchronization node.
  • the synchronization mechanism refers to the confirmation of the attributes of each port of each synchronization node.
  • Each node to be synchronized may include one or two ports in the direction of each corresponding synchronization node, and the attributes of the ports are determined in the case of exchanging trusted synchronization information.
  • the attribute of the port that sends its trusted synchronization information is the weighted master mode
  • the attribute of the port that receives the trusted synchronization information of the peer node is the weighted slave. model.
  • the method before receiving the trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized, the method further includes: determining the port enabling function of each node to be synchronized and all corresponding synchronization nodes. In the embodiment, after the port enabling function of each node to be synchronized and all synchronization nodes is activated, the node to be synchronized and the synchronization node can perform operations of sending or receiving synchronization information.
  • adjusting the local time of each node to be synchronized according to a preset weighting algorithm and trusted synchronization information includes: determining the time difference between each node to be synchronized and all synchronization nodes corresponding to the node to be synchronized; Set the weighting algorithm and the time difference to determine the time difference value of each node to be synchronized; adjust the local time of the corresponding node to be synchronized according to the time difference value.
  • the determined time difference value is used to adjust the local time of the corresponding node to be synchronized, which means that the time difference value corresponding to each node to be synchronized is different.
  • the method when the local time of each node to be synchronized is adjusted by using the PTP protocol, the method further includes: receiving PTP packets of all synchronization nodes corresponding to each node to be synchronized, and the PTP packet One or two bits in the message header are used as indicator bits to indicate whether to weight synchronization, and the two-bit indicator bits are used to indicate whether to perform BMCA.
  • the synchronization method when the synchronization method is applied to the direct connection scenario, 1 bit in the header of the PTP message is used as an indicator bit for indicating whether to weight synchronization. In an embodiment, when the synchronization method is applied to a cross-node scenario, 2 bits in the header of the PTP message are used to indicate whether to perform weighted synchronization and whether to perform BMCA. In the embodiment, when the PTP protocol is used to realize the time synchronization of the node to be synchronized, the extended Type-Length-Value (Type-Length-Value, TLV) carries synchronization accuracy information, and the PTP port attribute is configured as a weighted main mode , Weighted slave mode.
  • Table 1 is a schematic table of bits of a PTP general header provided in an embodiment of the present application. As shown in Table 1, multiple reserved bits are included in the PTP general header.
  • Table 1 A schematic table of the bits of a PTP general header
  • 1-2 bits of reserved bits in the PTP header may be used as an indicator bit for indicating whether to weight synchronization or whether to perform BMCA.
  • the indicator bits used to indicate whether weighted synchronization or whether to perform BMCA may be: the 4th and 5th bits of the 2nd byte; the 1st and 2nd bits of the 5th byte; in flagField The reserved bits of the 8th byte; the first and second bits of the 8th byte, etc.
  • 1 bit is used to indicate whether weighted synchronization; the PTP header is a general header, and messages such as Announce, Sync, and Delay_Req are distinguished in the header "messageType".
  • Table 2 is a description comparison table provided by an embodiment of the present application in which the indicator bit is 1 bit. As shown in Table 2, when 1 bit is 0, it indicates the non-weighted synchronization mode and BMCA is performed; when the 1 bit is 1, it indicates the weighted synchronization mode and BMCA is not performed.
  • Table 3 is a description comparison table provided by an embodiment of the present application in which the indicator bit is 2 bits. As shown in Table 3, when the 2 bits are 00, it indicates the unweighted synchronization mode, and BMCA is performed; when the 2 bits are 01, it indicates the time source weighted mode, and BMCA is not performed; when the 2 bits are 10, Below, it means the synchronization node weighting mode, and BMCA is not performed.
  • Table 2 A description comparison table with 1 bit indicating bit
  • Table 3 A description comparison table for indicating the bit is 2 bits
  • the same calculation method as the PTP time difference is used to calculate the time difference value between the two synchronization nodes.
  • the PTP protocol is used to transmit synchronization accuracy information, and the extended TLV of the Announce message is used.
  • the tlvType is "Weighting_Synchronization TLV", and the tlvType value can be any reserved value.
  • Table 4 is a schematic table of an extended TLV provided in an embodiment of the present application. As shown in Table 4, tlvType, lengthField, synchronization accuracy value, and synchronization accuracy level are all represented by 8 bits.
  • adjusting the local time of each node to be synchronized according to a preset weighting algorithm and trusted synchronization information includes: according to synchronization messages and delay requests between each node to be synchronized and all synchronization nodes corresponding to itself Message, calculate the time difference between each node to be synchronized and all synchronization nodes corresponding to itself; determine the time difference value of each node to be synchronized according to the preset weighting algorithm and time difference; adjust the time difference of the node to be synchronized according to the time difference value local time.
  • determining the time difference value of each node to be synchronized according to the preset weighting algorithm and the time difference includes: determining the weight of each node to be synchronized and corresponding to all synchronization nodes according to the preset weighting algorithm; all synchronization nodes include One of the following: all synchronization nodes corresponding to the trusted synchronization information, all synchronization nodes filtered by a preset threshold; each node to be synchronized is determined according to the time difference between each node to be synchronized and all the corresponding synchronization nodes, and the weight The time difference value.
  • both the node to be synchronized and the synchronization node include one of the following: a time source node, a synchronization transfer node, and an end application node.
  • the trusted synchronization information includes: synchronization accuracy information; the synchronization accuracy information includes at least one of the following: a synchronization accuracy value and a synchronization accuracy level.
  • the preset weighting algorithm includes one of the following: an average weighting algorithm, a level weighting algorithm, a level and an average weighting algorithm;
  • the average weighting algorithm is that the weights of the node to be synchronized and all the corresponding synchronization nodes are the same; the level weighting algorithm is to determine the weight according to the synchronization accuracy information of each synchronization node; the level and the average weighting algorithm are to first perform the accuracy according to the synchronization accuracy information After sorting, the weights with the highest accuracy are calculated according to the weighted weighting algorithm; or, all synchronization nodes are filtered according to a preset threshold, and the synchronization nodes that meet the preset threshold are weighted according to the preset weighting algorithm.
  • the weight of each synchronization node when the level weighting algorithm is used, includes: the ratio of the synchronization accuracy ranking of each synchronization node to the sum of the synchronization accuracy rankings of all synchronization nodes; or, the synchronization accuracy information Divide the categories according to the level, and set a corresponding weight for each level.
  • each synchronization node (including the node to be synchronized) can be divided into different levels according to the synchronization accuracy value or synchronization accuracy level, for example, divided into four levels of A, B, C, and D, and then each Set an application weight for each level.
  • the time difference of each node to be synchronized is
  • the application scenario of the synchronization method includes one of the following: establishing a time source synchronization network; all time sources or frequency sources are lost or fail, and the node to be synchronized is weighted synchronization with all adjacent synchronization nodes, so A relatively synchronous network established; a synchronous network without a time source or frequency source.
  • FIG. 2 is a schematic diagram of establishing a time source synchronization network in a direct connection scenario provided by an embodiment of the present application.
  • the time source referred to as the time source for short
  • the synchronization nodes corresponding to the node to be synchronized are also time source nodes as an example, the process of establishing a time source synchronization network is described.
  • the synchronization between time sources does not affect the timing and synchronization mechanism of each time source and its connected synchronization network.
  • the bearer equipment connected to each time source forms a network, and the clock sources form an independent network. Only through the time source synchronization network, the timing time output by each time source is no longer the time of a separate time source, but the time weighted by the time source synchronization network.
  • time sources 1, 3, 4, and 6 are the main time sources, and time sources 2 and 5 are backup time sources.
  • Table 5 is a time source synchronization accuracy information table provided in an embodiment of the present application. As shown in Table 5, each time source corresponds to the time source number, synchronization accuracy value, and synchronization accuracy level.
  • Table 5 A time source synchronization accuracy information table
  • time source 2 as the node to be synchronized as an example.
  • adjacent time sources of time source 2 include time sources 1, 3, 4, and 5, that is, all synchronization nodes corresponding to time source 2 are time sources 1, 3, 4, and 5.
  • Each port attribute of each synchronization node can be set to one of the following three modes: weighted master mode, weighted slave mode, weighted master + weighted slave mode.
  • weighted master + weighted slave requires a physical port to support the master-slave mode at the same time.
  • the two ports of the time source 2 in the direction of the time source 1 are respectively set to the "weighted master” mode and the "weighted slave” mode, or one port is set to the "weighted master” and the "weighted slave” mode at the same time.
  • Time source 2 is set in the same way in time sources 3, 4, and 5.
  • Time source 2 receives the synchronization accuracy information of these 4 adjacent time sources from the weighted slave port in 4 directions, and sorts the synchronization accuracy according to the synchronization accuracy value and/or synchronization accuracy level (including the synchronization information of time source 2 itself) .
  • Table 6 is a sorting table of synchronization accuracy of all synchronization nodes corresponding to the nodes to be synchronized provided in an embodiment of the present application. As shown in Table 6, the lower the synchronization accuracy value, the higher the accuracy and the higher the synchronization accuracy sort. Among them, the synchronization accuracy level in this embodiment can also be considered as a time source type.
  • Table 6 A sorting table of synchronization accuracy of all synchronization nodes corresponding to the nodes to be synchronized
  • Synchronization accuracy value (ns) Synchronization accuracy level Synchronization accuracy sort 1 30 ePRTC 3 2 40 PRTC-B 2 3 30 ePRTC 3 4 30 ePRTC 3 5 100 PRTC-A 1
  • a preset threshold can be set, and time sources that meet the preset threshold requirements are included in the weighting calculation process. At the same time, only time sources that meet the preset threshold requirements are included in the accuracy rank sorting/classification, thereby improving Time synchronization accuracy.
  • Time source 2 combines its own time synchronization accuracy information and the received time synchronization accuracy information of four adjacent time sources (as shown in Table 6) to perform synchronization weight calculation.
  • the following four preset weighting algorithms are used: average weighting algorithm, level weighting algorithm, level and average weighting algorithm, preset threshold and level weighting algorithm, to sort the synchronization accuracy information of the synchronization node and the synchronization node .
  • the weight of each synchronization node is calculated.
  • Table 7 is a schematic table of the weight of each synchronization node obtained by a weighted weighting algorithm provided by an embodiment of the present application. As shown in Table 7, the node to be synchronized (time source 2) and all synchronization nodes (time source 1, The weights of 3, 4, and 5) are all the same.
  • Table 7 A schematic table of the weight of each synchronization node obtained by a weighted weighting algorithm
  • the weight of each synchronization node is calculated.
  • the synchronization accuracy information of the synchronization node is divided into several categories according to the level, for example, A, B, C, D, and E. Each level is assigned or set a weight, for example, A-5, B-4, C-3, D-2, E-1.
  • Table 8 is a schematic table of the weight of each synchronization node obtained by a level weighting algorithm provided in the embodiment of the present application.
  • Table 8 A schematic table of the weight of each synchronization node obtained by a level weighting algorithm
  • the weight of each synchronization node is calculated. First, the synchronization node with the highest level is selected according to the synchronization accuracy level, and then the weighting algorithm is performed on the synchronization node with the highest level. If all the levels are equal, it will be processed according to the weighted average algorithm to calculate the corresponding weight.
  • time sources 1, 3, and 4 have the highest levels. Since the synchronization accuracy level of time source 2 itself is not the highest, it is not included in the weight calculation.
  • Table 9 is a schematic table of the weight of each synchronization node obtained by a rank and weighted weighting algorithm provided in an embodiment of the present application. As shown in Table 9, the synchronization nodes with the highest accuracy levels are time source 1, time source 3, and time source 4. The weights of these three time sources are calculated according to the average weighting algorithm, and the weight of each time source is 33.33%.
  • Table 9 A schematic table of the weight of each synchronization node obtained by a rank and weighted weighting algorithm
  • Time source number Synchronization accuracy value (ns) Synchronization accuracy level Accuracy ranking Weights 1 30 ePRTC 1 33.33% 2 40 PRTC-B To To 3 30 ePRTC 1 33.33% 4 30 ePRTC 1 33.33% 5 100 PRTC-A To To
  • the preset weighting algorithm is the preset threshold and level weighting algorithm
  • the weight of each synchronization node is calculated.
  • the level weighting algorithm plus the preset threshold value as an example, other algorithms can also increase the threshold value, which will not be repeated here.
  • the preset threshold is 70ns, that is, the time source whose synchronization accuracy value exceeds 70ns (or the accuracy ranking is lower than the ranking 2) cannot be included in the synchronization weighting, that is, the time source 5 is not included in the synchronization weighting calculation, and the accuracy is not added at the same time.
  • the preset threshold is 70ns
  • Table 10 is a schematic table of the weight of each synchronization node obtained by a preset threshold and level weighting algorithm provided in an embodiment of the present application. The weight of each synchronization node that meets the preset threshold is shown in Table 10.
  • Table 10 A schematic table of the weight of each synchronization node obtained by a preset threshold and level weighting algorithm
  • the time source 2 calculates the time difference value T that needs to be adjusted according to the following formula:
  • T is the time to be adjusted for time source 2
  • t i is the time difference between time source 2 and time source 2 other than time source 2 (because the time difference between time source 2 and itself is 0);
  • w i is the weight of other time sources participating in the weight calculation except time source 2 (because the time difference between time source 2 and itself is 0), that is, the weight calculated according to the above-mentioned preset weighting algorithm.
  • each time source adjusts its own local time according to the determined above-mentioned preset weighting algorithm, so that the time of each time source gradually approaches each other and finally reaches the same time, so as to realize the relationship between each time source.
  • Time synchronization forms a time source synchronization network.
  • FIG. 3 is a schematic diagram of establishing a time source synchronization network in a cross-node scenario provided by an embodiment of the present application.
  • the process of establishing a time source synchronization network in a cross-node scenario will be described.
  • the synchronization accuracy value and the path synchronization accuracy value of the synchronization transmission node are added to the synchronization accuracy value of the interaction between the time sources to represent more accurate The precision value.
  • the PTP protocol is used to implement weighted synchronization.
  • Table 11 is a schematic table of synchronization accuracy values of a time source node provided in an embodiment of the present application.
  • Table 12 is a schematic table of synchronization accuracy values of a synchronization transfer node provided in an embodiment of the present application. As shown in Table 11 and Table 12, this embodiment uses 6 time sources and 3 synchronous transmission nodes as an example to describe the process of establishing a time source synchronization network.
  • Table 11 A schematic table of synchronization accuracy values of time source nodes
  • Table 12 A schematic table of synchronization accuracy values of a synchronous transmission node
  • Time source 2 exchanges PTP messages with time sources 1, 3, 4, and 5, and the message transmission and processing are the same.
  • this embodiment takes time source 2 as an example for description.
  • the adjacent time sources of time source 2 are time sources 1, 3, 4, and 5.
  • the time source 2 and the time source 3 have passed two synchronous transmission nodes B1 and B2, and the time source 2 and the time source 4 have passed the B3 synchronous transmission node.
  • the two ports of the time source 2 in the direction of the time source 1 are respectively set to the "weighted master” mode and the "weighted slave” mode. The same is true for time sources 3, 4, and 5.
  • Time source 2 receives corresponding synchronization accuracy information from these four adjacent time sources.
  • time source 2 and time source 3 have passed two synchronous transmission nodes B1 and B2, and between time source 4 and time source 4 have passed B3 synchronous transmission node, the synchronization accuracy value in these two directions Both increase the synchronization accuracy value introduced by the synchronization transfer node.
  • time source 2 receives the PTP Announce message of time source 1, and the 2bits indicator in the header of the Announce message is 01 (see Table 3),
  • Table 13 is a schematic table of an extended TLV of an Announce message provided in an embodiment of the present application.
  • Time source 2 and time source 1 exchange Sync messages and Delay_Req messages (the 2 bits in the header are all 01) to calculate the time difference between time source 2 and time source 1. This time difference is calculated according to the weight obtained by the above-mentioned preset weighting algorithm into the time that time source 2 needs to adjust.
  • the interaction between the weighted slave end of the time source 2 and the weighted master end of the time source 5 is the same as the interaction between the time source 2 and the time source 1 described above.
  • Table 14 is a schematic table of another extended TLV of an Announce message provided in an embodiment of the present application. As shown in Table 14, the extended TLV of the Announce message is as follows.
  • B3 is not a time source, it only adds its own synchronization accuracy value to the message, and then sends it downstream.
  • the 2bits indicator in the header of the Announce message is still 01, and the extended TLV of the Announce message is changed as shown in Table 15.
  • Table 15 is a schematic table of another extended TLV of an Announce message provided in an embodiment of the present application, and Table 15 is a TLV sent by the synchronous transfer node B3 to the source 2.
  • the synchronization accuracy value is 60ns
  • Time source 2 receives the PTP Announce message of time source 4, and the 2bits indicator in the header of the Announce message is 01.
  • Table 16 is a schematic table of another extended TLV of an Announce message provided in an embodiment of the present application, and Table 16 is a TLV received by time source 2.
  • the synchronization accuracy value received by time source 2 is the sum of the synchronization accuracy value of B3 and the synchronization accuracy value of time source 4, which is 60ns.
  • the time source 2 and the time source 4 interact with the Sync message and the Delay_Req message (the 2 bits indicator in the header are all 01) to calculate the time difference between the time source 2 and the time source 4. Calculate this time difference according to the weight obtained by the unified weighting algorithm into the time that time source 2 needs to adjust.
  • the interaction between the weighted slave end of the time source 2 and the weighted master end of the time source 3 is the same as the interaction between the time source 2 and the time source 4 described above.
  • the synchronization accuracy value of the synchronization transfer nodes B1 and B2 is 5 ns
  • the synchronization accuracy value of the time source 3 received by the time source 2 is one of the synchronization accuracy values of the three nodes of the time source 3, B1 and B2 Sum, that is, add 10ns (5ns+5ns) to the synchronization accuracy value of time source 3.
  • the time source 2 receives the time synchronization accuracy information of these 4 adjacent time sources from the weighted slave port in 4 directions, and sorts the accuracy levels according to the synchronization accuracy value (including the synchronization information of the time source 2 itself).
  • Table 17 is another synchronization accuracy ranking table of all synchronization nodes corresponding to another synchronization node provided in an embodiment of the present application. The synchronization accuracy ranking of 5 time sources is shown in Table 17.
  • time source 2 combines its own time synchronization accuracy information and the received time synchronization accuracy information of four adjacent time sources (see Table 17) to perform synchronization weight calculation.
  • Table 18 A schematic table of the weight of each synchronization node obtained by another level weighting algorithm
  • time source 2 calculates the time difference value T that needs to be adjusted according to the following formula:
  • T is the time that time source 2 needs to adjust
  • t 1 ⁇ t 4 are the time differences between time source 1, 3, 4, 5 and time source 2 respectively;
  • w 1 to w 4 are the weights of time sources 1, 3, 4, and 5, which are 30.77%, 23.08%, 15.38%, and 7.69%, respectively.
  • each time source adjusts its own local time according to the determined above-mentioned preset weighting algorithm, so that the time of each time source gradually approaches each other and finally reaches the same time, so as to realize the relationship between each time source.
  • Time synchronization forms a time source synchronization network.
  • FIG. 4 is a schematic diagram of establishing a synchronization network of a synchronization transmission node according to an embodiment of the present application. As shown in Fig. 4, a synchronous network of synchronous transmission nodes is established by using adjacent synchronous transmission nodes.
  • This embodiment is applicable to, including but not limited to, the following synchronization scenarios: all time sources are lost or fail, the synchronization node and all adjacent synchronization nodes perform weighted synchronization to establish a relatively synchronized network; synchronization is performed on a network without a time source The establishment of the net.
  • Table 19 is a synchronization accuracy information table of a synchronization transfer node provided by an embodiment of the present application, and the synchronization accuracy level of each synchronization transfer node is shown in Table 19.
  • Table 19 A synchronization accuracy information table of a synchronous transmission node
  • B2 Take the synchronous transfer node B2 as an example. As shown in Figure 4, B2 has B1 and B3 adjacent to synchronous transfer nodes.
  • a physical port of B2 in the direction of B1 is in "weighted master” mode and "weighted slave” mode at the same time. The same setting is applied in the B3 direction.
  • B2 weighted slave and B1 weighted master B2 receives the PTP Announce message of B1, and the 1bits indicator in the header of the Announce message is 1 (described in Table 3).
  • Table 20 is a schematic table of an extended TLV of an Announce message provided in an embodiment of the present application.
  • B2 and B1 exchange Sync messages and Delay_Req messages (the 1bits indicator in the header are all 1) to calculate the time difference between B2 and B1. Calculate this time difference according to the weight obtained by the unified weighting algorithm into the time B2 needs to be adjusted.
  • the interaction between the B2 weighted slave and the B3 weighted master is the same as the interaction between B2 and B1 described above.
  • B2 receives corresponding time synchronization accuracy information from these two adjacent synchronization transfer nodes, and sorts the accuracy levels according to the synchronization accuracy value and/or time synchronization accuracy level (including B2's own synchronization information).
  • Table 21 is a sorting table of synchronization accuracy of synchronization transfer nodes provided in an embodiment of the present application. As shown in Table 21, B1 and B3 have the highest synchronization accuracy level.
  • Table 21 A sorting table of synchronization accuracy of synchronization transfer nodes
  • B2 combines its own synchronization accuracy information and the received synchronization accuracy information of two adjacent synchronization transfer nodes (as shown in Table 21) to perform synchronization weight calculation.
  • This embodiment takes the ranking and weighting algorithm as an example. First, select the highest level according to the synchronization accuracy level, and then perform the weighting algorithm.
  • the highest grades are B1 and B3. That is, the synchronization accuracy level of B2 itself is not the highest, and it is not included in the weight calculation.
  • Table 22 is a synchronization accuracy information table of the synchronization transmission node included in the weight calculation provided by the embodiment of the present application. As shown in Table 22, if the synchronization accuracy level of B2 itself is not the highest, it is not included in the weight calculation.
  • Table 22 A synchronization accuracy information table of the synchronization transfer node included in the weight calculation
  • B2 will calculate the adjusted time difference value T according to the following formula:
  • T is the time that the synchronous transmission node B2 needs to adjust; t i , except B2 (because the time difference between B2 and itself is 0), the time difference between the other synchronous transmission nodes and B2 included in the weight calculation; w i , except B2 Outside (because the time difference between B2 and itself is 0), the weights of other synchronous transmission nodes participating in the weight calculation are the weights calculated according to the above-mentioned preset weighting algorithm.
  • each synchronous transmission node adjusts its own local time according to the determined preset weighting algorithm, so that the time of each synchronous transmission node gradually approaches each other and finally reaches the same time, so as to realize the difference between each synchronous transmission node.
  • the time synchronization between the two forms a synchronization network of synchronous transmission nodes.
  • Fig. 5 is a structural block diagram of a synchronization device provided by an embodiment of the present application. As shown in FIG. 5, the synchronization device in this embodiment includes: a receiver 210 and an adjustment module 220.
  • the receiver 210 is configured to receive trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized;
  • the adjustment module 220 is configured to adjust the local time of each node to be synchronized according to a preset weighting algorithm and trusted synchronization information.
  • the synchronization device provided in this embodiment is configured to implement the synchronization method of the embodiment shown in FIG.
  • the synchronization node corresponding to the trusted synchronization information is included in the trusted master list configured by the weighted slave of the node to be synchronized; wherein the weighted master in the trusted master list is used to participate in the node to be synchronized
  • the time-weighted calculation of the trusted master terminal; the list of trusted master terminals includes at least one of the following: manually configure a specific master terminal, and set the trusted master terminal filtered by the trusted conditions.
  • the method further includes: configuring a synchronization mechanism for each node to be synchronized and all corresponding synchronization nodes.
  • configuring the synchronization mechanism of each node to be synchronized and all corresponding synchronization nodes includes:
  • Port attributes include at least one of the following: weighted master mode, weighted slave mode, weighted master and weighted slave mode; weighted master mode is that the node to be synchronized sends its own synchronization information to the peer synchronization node; weighted slave mode is that the node to be synchronized receives The trusted synchronization information of the peer synchronization node is calculated and weighted; the weighted master and weighted slave modes not only receive the trusted synchronization information of the peer synchronization node, but also send its own synchronization information to the peer synchronization node.
  • the method before receiving trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized, the method further includes:
  • adjusting the local time of each node to be synchronized according to a preset weighting algorithm and trusted synchronization information includes:
  • the synchronization method further includes:
  • PTP messages of all synchronization nodes corresponding to each node to be synchronized are received, 1 or 2 bits in the PTP message header are used as indicator bits to indicate whether weighted synchronization, and the 2-bit indicator bits are used to indicate whether to perform BMCA.
  • adjusting the local time of each node to be synchronized according to a preset weighting algorithm and trusted synchronization information includes:
  • the time difference between each node to be synchronized and all synchronization nodes corresponding to itself is calculated;
  • determining the time difference value of each node to be synchronized according to the preset weighting algorithm and the time difference includes:
  • all synchronization nodes include one of the following: all synchronization nodes corresponding to trusted synchronization information, and all synchronization nodes filtered by a preset threshold;
  • the time difference value of each node to be synchronized is determined according to the time difference between each node to be synchronized and all corresponding synchronization nodes, and the weight.
  • both the node to be synchronized and the synchronization node include one of the following: a time source node, a synchronization transfer node, and an end application node.
  • the trusted synchronization information includes: synchronization accuracy information
  • the synchronization accuracy information includes at least one of the following: a synchronization accuracy value, and a synchronization accuracy level.
  • the preset weighting algorithm includes one of the following: an average weighting algorithm, a level weighting algorithm, a level and an average weighting algorithm;
  • the average weighting algorithm is that the weights of the node to be synchronized and all the corresponding synchronization nodes are the same; the level weighting algorithm is to determine the weight according to the synchronization accuracy information of each synchronization node; the level and the average weighting algorithm are to first perform the accuracy according to the synchronization accuracy information After sorting, the weight with the highest accuracy is calculated according to the weighted average algorithm;
  • the weight of each synchronization node when the level weighting algorithm is used, includes: the ratio of the synchronization accuracy ranking of each synchronization node to the sum of the synchronization accuracy rankings of all synchronization nodes; or, the synchronization accuracy information Divide the categories according to the level, and set a corresponding weight for each level.
  • the time difference of each node to be synchronized is
  • the application scenario of the synchronization method includes one of the following: establishing a time source synchronization network; all time sources or frequency sources are lost or fail, and the node to be synchronized is weighted synchronization with all adjacent synchronization nodes, so A relatively synchronous network established; a synchronous network without a time source or frequency source.
  • Fig. 6 is a schematic structural diagram of a device provided by an embodiment of the present application.
  • the device provided by the present application includes: a processor 310, a memory 320, and a communication module 330.
  • the number of processors 310 in the device may be one or more, and one processor 310 is taken as an example in FIG. 6.
  • the number of memories 320 in the terminal device may be one or more, and one memory 320 is taken as an example in FIG. 6.
  • the processor 310, the memory 320, and the communication module 330 of the terminal device may be connected through a bus or in other ways. In FIG. 6, the connection through a bus is taken as an example.
  • the device is a time source (that is, a time server) used for time service, and may also be an end application of a synchronization network (such as a base station).
  • the memory 320 can be configured to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the device of any embodiment of the present application (for example, the receiver and adjustment module in the synchronization device). Module).
  • the memory 320 may include a program storage area and a data storage area.
  • the program storage area may store an operating system and an application program required by at least one function; the data storage area may store data created according to the use of the device, and the like.
  • the memory 320 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
  • the memory 320 may further include a memory remotely provided with respect to the processor 310, and these remote memories may be connected to the device through a network.
  • networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
  • the communication module 330 is configured to communicate and interact with other synchronization nodes.
  • the above-provided device can be configured to execute the synchronization method provided in any of the above-mentioned embodiments, and has corresponding functions and effects.
  • the embodiment of the present application also provides a storage medium containing computer-executable instructions.
  • the computer-executable instructions are used to perform a synchronization method when executed by a computer processor.
  • the method includes: receiving all synchronizations corresponding to each node to be synchronized.
  • the trusted synchronization information of the node adjust the local time of each node to be synchronized according to the preset weighting algorithm and the trusted synchronization information.
  • Computer program instructions can be assembly instructions, Instruction Set Architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or written in any combination of one or more programming languages Source code or object code.
  • ISA Instruction Set Architecture
  • the block diagram of any logic flow in the drawings of the present application may represent program steps, or may represent interconnected logic circuits, modules, and functions, or may represent a combination of program steps and logic circuits, modules, and functions.
  • the computer program can be stored on the memory.
  • the memory can be of any type suitable for the local technical environment and can be implemented using any suitable data storage technology, such as but not limited to read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), optical Memory devices and systems (Digital Video Disc (DVD) or Compact Disk (CD)), etc.
  • Computer-readable media may include non-transitory storage media.
  • the data processor can be any type suitable for the local technical environment, such as but not limited to general-purpose computers, special-purpose computers, microprocessors, digital signal processors (Digital Signal Processors, DSP), application specific integrated circuits (ASICs) ), programmable logic devices (Field-Programmable Gate Array, FPGA), and processors based on multi-core processor architecture.
  • DSP Digital Signal Processors
  • ASICs application specific integrated circuits
  • FPGA Field-Programmable Gate Array
  • processors based on multi-core processor architecture such as but not limited to general-purpose computers, special-purpose computers, microprocessors, digital signal processors (Digital Signal Processors, DSP), application specific integrated circuits (ASICs) ), programmable logic devices (Field-Programmable Gate Array, FPGA), and processors based on multi-core processor architecture.

Landscapes

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

Abstract

The present application provides a synchronization method and apparatus, a device, and a storage medium. The synchronization method comprises: for each node to be synchronized, receiving trusted synchronization information of every synchronization node to which the node corresponds; and adjusting, according to a preset weighted algorithm and the trusted synchronization information, the local time of each node to be synchronized.

Description

同步方法、装置、设备和存储介质Synchronization method, device, equipment and storage medium
本申请要求在2020年03月23日提交中国专利局、申请号为202010209774.0的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office with an application number of 202010209774.0 on March 23, 2020, and the entire content of the application is incorporated into this application by reference.
技术领域Technical field
本申请涉及通信,例如涉及一种同步方法、装置、设备和存储介质。This application relates to communication, for example, to a synchronization method, device, device, and storage medium.
背景技术Background technique
时间同步网很大程度依赖于全球导航卫星系统(Global Navigation Satellite System,GNSS)卫星,包括用于授时的时间源(比如,时间服务器)、同步网的端应用节点(比如,基站)等。在GNSS卫星时间信号源丢失或出现故障的情况下,基于其授时的节点通过各自的频率源进行授时,例如时间服务器基于内部原子钟等进行授时,同步传送节点设备、基站可基于频率同步网的频率源(亦为原子钟)进行授时。但是原子钟存在频率准确度误差,在一段时间之后同步节点之间出现时间偏差。同时,时间同步网采用的是逐级向下传递的主从式时间同步方式,这种方式的一个缺陷是将上游的误差向下游传递,从而导致通信网性能恶化甚至不可用。The time synchronization network largely relies on Global Navigation Satellite System (GNSS) satellites, including time sources (for example, time servers) for timing, and end application nodes (for example, base stations) of the synchronization network, and so on. In the event that the GNSS satellite time signal source is lost or malfunctions, the nodes based on its timing will use their respective frequency sources for timing. For example, the time server is based on internal atomic clocks, etc., and the synchronization transmission node equipment and base station can be based on the frequency of the frequency synchronization network. The source (also an atomic clock) performs time service. However, atomic clocks have frequency accuracy errors, and time deviations occur between synchronization nodes after a period of time. At the same time, the time synchronization network adopts a master-slave time synchronization method that is passed down step by step. One drawback of this method is that the upstream error is passed to the downstream, which leads to the deterioration of the performance of the communication network or even the unavailability.
发明内容Summary of the invention
本申请实施例提供一种同步方法、装置、设备和存储介质,实现了各个同步节点之间的同步。The embodiments of the present application provide a synchronization method, device, equipment, and storage medium, which realize synchronization between various synchronization nodes.
本申请实施例提供一种同步方法,包括:The embodiment of the present application provides a synchronization method, including:
接收每个待同步节点对应的所有同步节点的可信同步信息;Receive trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized;
根据预设加权算法和所述可信同步信息调整每个待同步节点的本地时间。Adjust the local time of each node to be synchronized according to a preset weighting algorithm and the trusted synchronization information.
本申请实施例提供一种同步装置,包括:An embodiment of the present application provides a synchronization device, including:
接收器,配置为接收每个待同步节点对应的所有同步节点的可信同步信息;A receiver, configured to receive trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized;
调整模块,配置为根据预设加权算法和所述可信同步信息调整每个待同步节点的本地时间。The adjustment module is configured to adjust the local time of each node to be synchronized according to a preset weighting algorithm and the trusted synchronization information.
本申请实施例提供一种设备,包括:通信模块,存储器,以及一个或多个 处理器;An embodiment of the present application provides a device, including: a communication module, a memory, and one or more processors;
所述通信模块,配置为在第一通信节点和第二通信节点之间进行通信交互;The communication module is configured to perform communication interaction between the first communication node and the second communication node;
所述存储器,配置为存储一个或多个程序;The memory is configured to store 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 method described in any one of the foregoing embodiments.
本申请实施例提供了一种存储介质,所述存储介质存储有计算机程序,所述计算机程序被处理器执行时实现上述任一实施例所述的方法。An embodiment of the present application provides a storage medium that stores a computer program, and when the computer program is executed by a processor, the method described in any of the foregoing embodiments is implemented.
附图说明Description of the drawings
图1是本申请实施例提供的一种同步方法的流程图;FIG. 1 is a flowchart of a synchronization method provided by an embodiment of the present application;
图2是本申请实施例提供的一种直连场景下时间源同步网络的建立示意图;2 is a schematic diagram of establishing a time source synchronization network in a direct connection scenario according to an embodiment of the present application;
图3是本申请实施例提供的一种跨节点场景下时间源同步网络的建立示意图;FIG. 3 is a schematic diagram of establishing a time source synchronization network in a cross-node scenario according to an embodiment of the present application;
图4是本申请实施例提供的一种同步传送节点同步网络的建立示意图;FIG. 4 is a schematic diagram of establishing a synchronization network of synchronization transmission nodes according to an embodiment of the present application;
图5是本申请实施例提供的一种同步装置的结构框图;FIG. 5 is a structural block diagram of a synchronization device provided by an embodiment of the present application;
图6是本申请实施例提供的一种设备的结构示意图。Fig. 6 is a schematic structural diagram of a device provided by an embodiment of the present application.
具体实施方式Detailed ways
下文中将结合附图对本申请的实施例进行说明。Hereinafter, the embodiments of the present application will be described with reference to the drawings.
同步网,通信网运行的支持系统之一,为通信网内通信设备时钟(或载波)提供同步控制信号,使其工作速率同步。同步网是通信网的基础网之一,它是保证网络定时性能进而确保业务顺利展开的关键。随着同步数字体系(Synchronous Digital Hierarchy,SDH)、异步传输模式(Asynchronous Transmission Mode,ATM)、码分多址(Code Division Multiple Access,CDMA)、网际互连协议(Internet Protocol,IP)、同步以太网、精确时间协议(Precision Time Protocol,PTP)、卫星授时等技术的发展和应用,各种新业务/应用(如定位、物联网、工业自动化等)对同步的要求越来越高,从4G的1.5微妙、5G的260 纳秒到定位的30纳秒和3纳秒。The synchronization network, one of the supporting systems for the operation of the communication network, provides a synchronization control signal for the clock (or carrier) of the communication equipment in the communication network to synchronize its working rate. The synchronization network is one of the basic networks of the communication network, and it is the key to ensuring the timing performance of the network and thus ensuring the smooth development of the business. With synchronous digital hierarchy (Synchronous Digital Hierarchy, SDH), asynchronous transmission mode (Asynchronous Transmission Mode, ATM), Code Division Multiple Access (CDMA), Internet Protocol (IP), synchronous Ethernet With the development and application of technologies such as the Internet, Precision Time Protocol (PTP), and satellite timing, various new services/applications (such as positioning, Internet of Things, industrial automation, etc.) have increasingly higher requirements for synchronization. 1.5 microseconds, 260 nanoseconds for 5G to 30 nanoseconds and 3 nanoseconds for positioning.
为了对应不同的需求和应用,针对不同功能的同步设备制定了相应的同步精度等级,如时间源的PRTC-A(基准时频时钟(Primary Reference Time Clock,PRTC)Class A)精度为100ns、增强基准主时钟(Enhanced Primary Reference Time Clock,ePRTC)精度为30ns;同步传送设备的电信边界时钟Telecom Boundary Clock(T-BC)Class B精度为70ns、T-BC Class C精度为30ns、T-BC Class D精度为5ns等。In order to correspond to different needs and applications, corresponding synchronization accuracy levels have been formulated for synchronization devices with different functions, such as the time source PRTC-A (Primary Reference Time Clock (PRTC) Class A) accuracy of 100ns, enhanced The accuracy of the Enhanced Primary Reference Time Clock (ePRTC) is 30ns; the Telecom Boundary Clock (T-BC) Class B accuracy of the synchronous transmission equipment is 70ns, the T-BC Class C accuracy is 30ns, and the T-BC Class D accuracy is 5ns and so on.
而各节点间主要用的时间同步协议为电气与电子工程师协会(Institute of Electrical and Electronics Engineers,IEEE)1588(2008)(即PTP),其采用主从跟踪的形式进行同步。较常用于同步的PTP报文有声明报文(Announce报文)、同步报文(Sync报文)、延迟请求报文(Delay_Req报文)和延迟回复报文(Delay_Resp报文):Announce报文主要用于最优主时钟算法(Best Master Clock Algorithm,BMCA)计算,确定基准参考时间源和PTP端口状态(Master/Slave/Passive);Sync报文和Delay_Req报文主要交互时间戳信息,用于计算节点间的时间差。当采用两步法计算时间差时,还需要跟进报文(Follow_Up报文)。The main time synchronization protocol used between nodes is Institute of Electrical and Electronics Engineers (IEEE) 1588 (2008) (namely PTP), which uses the form of master-slave tracking for synchronization. PTP messages that are more commonly used for synchronization include announcement messages (Announce messages), synchronization messages (Sync messages), delay request messages (Delay_Req messages) and delayed reply messages (Delay_Resp messages): Announce messages It is mainly used for the calculation of the Best Master Clock Algorithm (BMCA) to determine the reference time source and PTP port status (Master/Slave/Passive); Sync messages and Delay_Req messages mainly exchange time stamp information for Calculate the time difference between nodes. When the two-step method is used to calculate the time difference, a follow-up message (Follow_Up message) is also required.
为了减少GNSS卫星的影响,本申请实施例提供了一种同步方法,不仅实现了每个同步节点的快速同步,并能避免误差传递的缺陷。同时,本方案在时间源上的应用可以大程度上规避由GNSS卫星问题导致的同步网性能恶化和不可用情况。In order to reduce the influence of GNSS satellites, the embodiment of the present application provides a synchronization method, which not only realizes the rapid synchronization of each synchronization node, but also avoids the defect of error transmission. At the same time, the application of this solution to the time source can largely avoid the performance degradation and unavailability of the synchronization network caused by the GNSS satellite problem.
在一实施例中,提供一种同步方法,以实现各同步节点之间的同步。图1是本申请实施例提供的一种同步方法的流程图。如图1所示,本实施例包括S110-S120。In an embodiment, a synchronization method is provided to achieve synchronization between synchronization nodes. Fig. 1 is a flowchart of a synchronization method provided by an embodiment of the present application. As shown in Figure 1, this embodiment includes S110-S120.
S110、接收每个待同步节点对应的所有同步节点的可信同步信息。S110. Receive trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized.
在实施例中,待同步节点和同步节点均可以为时间源节点、同步传送节点、端应用节点中的其中一个。其中,同步节点的个数至少为一个。在实施例中,可信同步信息指的是待同步节点能够接收到的其它同步节点的同步信息。In the embodiment, both the node to be synchronized and the synchronization node may be one of a time source node, a synchronization transmission node, and an end application node. Among them, the number of synchronization nodes is at least one. In the embodiment, the trusted synchronization information refers to synchronization information of other synchronization nodes that can be received by the node to be synchronized.
S120、根据预设加权算法和可信同步信息调整每个待同步节点的本地时间。S120: Adjust the local time of each node to be synchronized according to the preset weighting algorithm and the trusted synchronization information.
在实施例中,每个待同步节点接收到与其相邻或跨节点的其它同步节点的可信同步信息,根据待同步节点自身的信息以及接收到的其它可信同步信息进行加权同步。在待同步节点和其它同步节点都进行加权同步之后,形成了同步网。示例性地,在待同步节点和同步节点均为时间源节点的情况下,待同步节点和同步节点都进行加权同步之后,形成一个时间源同步网。在实施例中,每个待同步节点结合自身的同步信息,以及接收到的可信同步信息,并根据预设加权算法对待同步节点的本地时间进行调整,从而实现了每个同步节点之间的时间同步。In the embodiment, each node to be synchronized receives trusted synchronization information of other synchronization nodes adjacent to or across the node, and performs weighted synchronization according to the information of the node to be synchronized and other received trusted synchronization information. After the nodes to be synchronized and other synchronization nodes are weighted and synchronized, a synchronization network is formed. Exemplarily, in the case where the node to be synchronized and the synchronization node are both time source nodes, after both the node to be synchronized and the synchronization node perform weighted synchronization, a time source synchronization network is formed. In the embodiment, each node to be synchronized combines its own synchronization information and the received trusted synchronization information, and adjusts the local time of the node to be synchronized according to a preset weighting algorithm, thereby realizing the communication between each synchronization node. Time synchronization.
在实施例中,在直连的场景下,每个待同步节点对应的所有同步节点均为待同步节点的相邻节点;在跨节点的场景下,每个待同步节点对应的所有同步节点可以为待同步节点的相邻节点,也可以为待同步节点的非相邻节点。In the embodiment, in the direct connection scenario, all synchronization nodes corresponding to each node to be synchronized are adjacent nodes of the node to be synchronized; in the cross-node scenario, all synchronization nodes corresponding to each node to be synchronized can be It is the neighboring node of the node to be synchronized, or it may be the non-adjacent node of the node to be synchronized.
在一实施例中,可信同步信息对应的同步节点包含在待同步节点的加权从端配置的可信主端列表中;其中,可信主端列表中的加权主端用于参与待同步节点的时间加权计算;可信主端列表至少包括下述之一:人工配置特定的主端,设置可信条件筛选得到的主端。In an embodiment, the synchronization node corresponding to the trusted synchronization information is included in the trusted master list configured by the weighted slave of the node to be synchronized; wherein the weighted master in the trusted master list is used to participate in the node to be synchronized The time-weighted calculation of the trusted master terminal; the list of trusted master terminals includes at least one of the following: manually configure a specific master terminal, and set the trusted master terminal filtered by the trusted conditions.
在实施例中,在待同步节点接收其它同步节点的可信同步信息的情况下,指的是,待同步节点接收到可信同步信息的端口的属性可以为加权从模式,或者,加权主和加权从模式,即待同步节点可以接收其它同步节点(即对端设备)的可信同步信息。在可信主端列表中的加权主端,指的是可以参与待同步节点的时间加权计算的其它同步节点,即加权主端用于发送自身的可信同步信息至待同步节点(即对端设备)。在实施例中,可信主端列表中所包含的同步节点,可以为人工配置的特定同步节点,也可以为设置可信条件之后筛选得到的同步节点。In the embodiment, when the node to be synchronized receives the trusted synchronization information of other synchronization nodes, it means that the attribute of the port on which the node to be synchronized receives the trusted synchronization information can be a weighted slave mode, or a weighted master sum Weighted slave mode, that is, the node to be synchronized can receive trusted synchronization information from other synchronization nodes (ie, peer devices). The weighted master in the list of trusted masters refers to other synchronization nodes that can participate in the time weighting calculation of the node to be synchronized, that is, the weighted master is used to send its own trusted synchronization information to the node to be synchronized (ie, the peer equipment). In the embodiment, the synchronization node included in the trusted master list may be a specific synchronization node manually configured, or may be a synchronization node obtained by screening after setting a trusted condition.
在一实施例中,在接收每个待同步节点对应的所有同步节点的可信同步信息的情况下,还包括:配置每个待同步节点和对应的所有同步节点的同步机制。In an embodiment, in the case of receiving trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized, the method further includes: configuring a synchronization mechanism for each node to be synchronized and all corresponding synchronization nodes.
在一实施例中,配置每个待同步节点和对应的所有同步节点的同步机制,包括:配置每个待同步节点和对应的所有同步节点的每个端口属性;In an embodiment, configuring the synchronization mechanism of each node to be synchronized and all corresponding synchronization nodes includes: configuring each port attribute of each node to be synchronized and all corresponding synchronization nodes;
端口属性至少包括下述之一:加权主模式,加权从模式,加权主和加权从 模式;加权主模式为待同步节点发送自身的同步信息至对端同步节点;加权从模式为待同步节点接收对端同步节点的可信同步信息,并进行加权计算;加权主和加权从模式为既接收对端同步节点的可信同步信息,又发送自身的同步信息至对端同步节点。Port attributes include at least one of the following: weighted master mode, weighted slave mode, weighted master and weighted slave mode; weighted master mode is that the node to be synchronized sends its own synchronization information to the peer synchronization node; weighted slave mode is that the node to be synchronized receives The trusted synchronization information of the peer synchronization node is calculated and weighted; the weighted master and weighted slave modes not only receive the trusted synchronization information of the peer synchronization node, but also send its own synchronization information to the peer synchronization node.
在实施例中,同步机制,指的是对每个同步节点的每个端口属性的确认。每个待同步节点在与每个对应同步节点的方向上均可以包括一个或两个端口,在交互可信同步信息的情况下,确定端口的属性。示例性地,一个同步节点与一个对应同步节点直连的两个端口,发送其可信同步信息的端口的属性为加权主模式,接收对端节点的可信同步信息的端口的属性为加权从模式。In the embodiment, the synchronization mechanism refers to the confirmation of the attributes of each port of each synchronization node. Each node to be synchronized may include one or two ports in the direction of each corresponding synchronization node, and the attributes of the ports are determined in the case of exchanging trusted synchronization information. Exemplarily, for two ports directly connected to a synchronization node and a corresponding synchronization node, the attribute of the port that sends its trusted synchronization information is the weighted master mode, and the attribute of the port that receives the trusted synchronization information of the peer node is the weighted slave. model.
在一实施例中,在接收每个待同步节点对应的所有同步节点的可信同步信息之前,还包括:确定每个待同步节点和对应的所有同步节点的端口使能功能。在实施例中,在启动每个待同步节点和所有同步节点的端口使能功能之后,待同步节点和同步节点就可以执行发送或接收同步信息的操作。In an embodiment, before receiving the trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized, the method further includes: determining the port enabling function of each node to be synchronized and all corresponding synchronization nodes. In the embodiment, after the port enabling function of each node to be synchronized and all synchronization nodes is activated, the node to be synchronized and the synchronization node can perform operations of sending or receiving synchronization information.
在一实施例中,根据预设加权算法和可信同步信息调整每个待同步节点的本地时间,包括:确定每个待同步节点与待同步节点对应的所有同步节点之间的时间差;根据预设加权算法和所述时间差,确定每个所述待同步节点的时差值;按照时差值调整对应的待同步节点的本地时间。在实施例中,利用确定的时差值对对应的待同步节点的本地时间进行调整,指的是,每个待同步节点对应的时差值是不同的。In an embodiment, adjusting the local time of each node to be synchronized according to a preset weighting algorithm and trusted synchronization information includes: determining the time difference between each node to be synchronized and all synchronization nodes corresponding to the node to be synchronized; Set the weighting algorithm and the time difference to determine the time difference value of each node to be synchronized; adjust the local time of the corresponding node to be synchronized according to the time difference value. In the embodiment, the determined time difference value is used to adjust the local time of the corresponding node to be synchronized, which means that the time difference value corresponding to each node to be synchronized is different.
在一实施例中,在采用PTP协议对每个待同步节点的本地时间进行调整的情况下,所述方法,还包括:接收每个待同步节点对应的所有同步节点的PTP报文,PTP报文报头中的1比特或2比特作为指示位用于指示是否加权同步,2比特指示位用于指示是否执行BMCA。In one embodiment, when the local time of each node to be synchronized is adjusted by using the PTP protocol, the method further includes: receiving PTP packets of all synchronization nodes corresponding to each node to be synchronized, and the PTP packet One or two bits in the message header are used as indicator bits to indicate whether to weight synchronization, and the two-bit indicator bits are used to indicate whether to perform BMCA.
在实施例中,在同步方法应用于直连场景下,PTP报文的报头中1比特作为用于指示是否加权同步的指示位。在一实施例中,在同步方法应用于跨节点场景下,PTP报文的报头中2比特用于指示是否加权同步,以及是否执行BMCA。在实施例中,在采用PTP协议实现待同步节点的时间同步的情况下,扩展类型-长度-值(Type-Length-Value,TLV)携带同步精度信息,并将PTP端口属性配 置为加权主模式、加权从模式。表1是本申请实施例提供的一种PTP通用报头的比特示意表。如表1所示,在PTP通用报头中包含多个保留比特。In the embodiment, when the synchronization method is applied to the direct connection scenario, 1 bit in the header of the PTP message is used as an indicator bit for indicating whether to weight synchronization. In an embodiment, when the synchronization method is applied to a cross-node scenario, 2 bits in the header of the PTP message are used to indicate whether to perform weighted synchronization and whether to perform BMCA. In the embodiment, when the PTP protocol is used to realize the time synchronization of the node to be synchronized, the extended Type-Length-Value (Type-Length-Value, TLV) carries synchronization accuracy information, and the PTP port attribute is configured as a weighted main mode , Weighted slave mode. Table 1 is a schematic table of bits of a PTP general header provided in an embodiment of the present application. As shown in Table 1, multiple reserved bits are included in the PTP general header.
表1一种PTP通用报头的比特示意表Table 1 A schematic table of the bits of a PTP general header
Figure PCTCN2020141380-appb-000001
Figure PCTCN2020141380-appb-000001
在实施例中,可采用PTP报头中的1-2比特的保留比特作为用于指示是否加权同步,或者是否执行BMCA的指示位。示例性地,用于指示是否加权同步,或者是否执行BMCA的指示位,可以为:第2字节的第4比特和第5比特;第5字节的第1比特和第2比特;flagField中的保留比特;第8字节的第1比特和第2比特等。在只用于同步节点直连的场景下,采用1比特指示是否加权同步;PTP报头为通用报头,Announce、Sync、Delay_Req等报文在报头“messageType”中进行区别。In an embodiment, 1-2 bits of reserved bits in the PTP header may be used as an indicator bit for indicating whether to weight synchronization or whether to perform BMCA. Exemplarily, the indicator bits used to indicate whether weighted synchronization or whether to perform BMCA may be: the 4th and 5th bits of the 2nd byte; the 1st and 2nd bits of the 5th byte; in flagField The reserved bits of the 8th byte; the first and second bits of the 8th byte, etc. In the scenario where the synchronization node is only used for direct connection, 1 bit is used to indicate whether weighted synchronization; the PTP header is a general header, and messages such as Announce, Sync, and Delay_Req are distinguished in the header "messageType".
表2是本申请实施例提供的一种指示比特为1比特的描述对照表。如表2所示,在1比特为0的情况下,表示非加权同步模式,执行BMCA;在1比特为1的情况下,表示加权同步模式,不执行BMCA。表3是本申请实施例提供的一种指示比特为2比特的描述对照表。如表3所示,在2比特为00的情况下,表示非加权同步模式,执行BMCA;在2比特为01的情况下,表示时间源加权模式,不执行BMCA;在2比特为10的情况下,表示同步节点加权模式,不执行BMCA。Table 2 is a description comparison table provided by an embodiment of the present application in which the indicator bit is 1 bit. As shown in Table 2, when 1 bit is 0, it indicates the non-weighted synchronization mode and BMCA is performed; when the 1 bit is 1, it indicates the weighted synchronization mode and BMCA is not performed. Table 3 is a description comparison table provided by an embodiment of the present application in which the indicator bit is 2 bits. As shown in Table 3, when the 2 bits are 00, it indicates the unweighted synchronization mode, and BMCA is performed; when the 2 bits are 01, it indicates the time source weighted mode, and BMCA is not performed; when the 2 bits are 10, Below, it means the synchronization node weighting mode, and BMCA is not performed.
表2一种指示比特为1比特的描述对照表Table 2 A description comparison table with 1 bit indicating bit
1 Bit1 Bit 描述describe
00 非加权同步模式,执行BMCANon-weighted synchronization mode, perform BMCA
11 加权同步模式,不执行BMCAWeighted synchronization mode, without BMCA
表3一种指示比特为2比特的描述对照表Table 3 A description comparison table for indicating the bit is 2 bits
Figure PCTCN2020141380-appb-000002
Figure PCTCN2020141380-appb-000002
在通过预先配置的指示位确定PTP用于加权同步之后,采用与PTP时差相同的计算方式来计算两个同步节点之间的时差值。采用PTP协议传送同步精度信息,采用Announce报文的扩展TLV,tlvType为“Weighting_Synchronization TLV”,tlvType值可为任何保留值。表4是本申请实施例提供的一种扩展TLV的示意表。如表4所示,tlvType、lengthField、同步精度值和同步精度等级均采用8比特来表示。After the PTP is determined to be used for weighted synchronization through the pre-configured indicator bits, the same calculation method as the PTP time difference is used to calculate the time difference value between the two synchronization nodes. The PTP protocol is used to transmit synchronization accuracy information, and the extended TLV of the Announce message is used. The tlvType is "Weighting_Synchronization TLV", and the tlvType value can be any reserved value. Table 4 is a schematic table of an extended TLV provided in an embodiment of the present application. As shown in Table 4, tlvType, lengthField, synchronization accuracy value, and synchronization accuracy level are all represented by 8 bits.
表4一种扩展TLV的示意表Table 4 Schematic table of an extended TLV
Figure PCTCN2020141380-appb-000003
Figure PCTCN2020141380-appb-000003
在一实施例中,根据预设加权算法和可信同步信息调整每个待同步节点的本地时间,包括:根据每个待同步节点与自身对应的所有同步节点之间的同步报文和延迟请求报文,计算得到每个待同步节点与自身对应的所有同步节点之间的时间差;根据预设加权算法和时间差,确定每个待同步节点的时差值;按照时差值调整待同步节点的本地时间。In an embodiment, adjusting the local time of each node to be synchronized according to a preset weighting algorithm and trusted synchronization information includes: according to synchronization messages and delay requests between each node to be synchronized and all synchronization nodes corresponding to itself Message, calculate the time difference between each node to be synchronized and all synchronization nodes corresponding to itself; determine the time difference value of each node to be synchronized according to the preset weighting algorithm and time difference; adjust the time difference of the node to be synchronized according to the time difference value local time.
在一实施例中,根据预设加权算法和时间差,确定每个待同步节点的时差 值,包括:根据预设加权算法确定每个待同步节点和对应所有同步节点的权重;所有同步节点包括下述之一:可信同步信息对应的所有同步节点,预设阈值筛选得到的所有同步节点;根据每个待同步节点与对应所有同步节点之间的时间差,以及权重,确定每个待同步节点的时差值。In an embodiment, determining the time difference value of each node to be synchronized according to the preset weighting algorithm and the time difference includes: determining the weight of each node to be synchronized and corresponding to all synchronization nodes according to the preset weighting algorithm; all synchronization nodes include One of the following: all synchronization nodes corresponding to the trusted synchronization information, all synchronization nodes filtered by a preset threshold; each node to be synchronized is determined according to the time difference between each node to be synchronized and all the corresponding synchronization nodes, and the weight The time difference value.
在一实施例中,待同步节点和同步节点均包括下述之一:时间源节点,同步传送节点,端应用节点。In an embodiment, both the node to be synchronized and the synchronization node include one of the following: a time source node, a synchronization transfer node, and an end application node.
在一实施例中,可信同步信息包括:同步精度信息;同步精度信息至少包括下述之一:同步精度值,同步精度等级。In an embodiment, the trusted synchronization information includes: synchronization accuracy information; the synchronization accuracy information includes at least one of the following: a synchronization accuracy value and a synchronization accuracy level.
在一实施例中,预设加权算法,包括下述之一:均权加权算法,等级加权算法,等级和均权加权算法;In an embodiment, the preset weighting algorithm includes one of the following: an average weighting algorithm, a level weighting algorithm, a level and an average weighting algorithm;
均权加权算法为待同步节点和对应的所有同步节点的权重是相同的;等级加权算法为按照每个同步节点的同步精度信息确定权重;等级和均权加权算法为先按照同步精度信息进行精度排序后,再将精度最高的按照均权加权算法计算权重;或者,按照预设阈值筛选所有同步节点,并将满足预设阈值的同步节点按照预设加权算法计算权重。The average weighting algorithm is that the weights of the node to be synchronized and all the corresponding synchronization nodes are the same; the level weighting algorithm is to determine the weight according to the synchronization accuracy information of each synchronization node; the level and the average weighting algorithm are to first perform the accuracy according to the synchronization accuracy information After sorting, the weights with the highest accuracy are calculated according to the weighted weighting algorithm; or, all synchronization nodes are filtered according to a preset threshold, and the synchronization nodes that meet the preset threshold are weighted according to the preset weighting algorithm.
在一实施例中,在采用等级加权算法的情况下,每个同步节点的权重包括:每个同步节点的同步精度排序与所有同步节点的同步精度排序之和的比值;或者,将同步精度信息根据等级划分类别,并对每个等级设置一个对应的权重。在实施例中,可根据每个同步节点(包括待同步节点)的同步精度值或同步精度等级划分为不同的等级,比如,划分为A、B、C、D这四个等级,然后对每个等级设置一个应用权重。In one embodiment, when the level weighting algorithm is used, the weight of each synchronization node includes: the ratio of the synchronization accuracy ranking of each synchronization node to the sum of the synchronization accuracy rankings of all synchronization nodes; or, the synchronization accuracy information Divide the categories according to the level, and set a corresponding weight for each level. In the embodiment, each synchronization node (including the node to be synchronized) can be divided into different levels according to the synchronization accuracy value or synchronization accuracy level, for example, divided into four levels of A, B, C, and D, and then each Set an application weight for each level.
在一实施例中,每个待同步节点的时差值为
Figure PCTCN2020141380-appb-000004
In one embodiment, the time difference of each node to be synchronized is
Figure PCTCN2020141380-appb-000004
其中,T为每个待同步节点所需调整的时间;t 1~t n,为每个同步节点与待同步节点之间的时间差;w 1~w n为每个同步节点的权重。 Among them, T is the time required to adjust each node to be synchronized; t 1 ~t n are the time difference between each synchronization node and the node to be synchronized; w 1 ~w n are the weights of each synchronization node.
在一实施例中,同步方法的应用场景包括下述之一:建立时间源同步网络;所有时间源或频率源丢失或出现故障,待同步节点与所有相邻同步节点之间进行加权同步,所建立的相对同步网络;未配置时间源或频率源的同步网络。In an embodiment, the application scenario of the synchronization method includes one of the following: establishing a time source synchronization network; all time sources or frequency sources are lost or fail, and the node to be synchronized is weighted synchronization with all adjacent synchronization nodes, so A relatively synchronous network established; a synchronous network without a time source or frequency source.
在一实现方式中,图2是本申请实施例提供的一种直连场景下时间源同步网络的建立示意图。在实施例中,以待同步节点为时间源节点(简称为时间源),并且,待同步节点对应的同步节点也均为时间源节点为例,对建立时间源同步网络的过程进行说明。In an implementation manner, FIG. 2 is a schematic diagram of establishing a time source synchronization network in a direct connection scenario provided by an embodiment of the present application. In the embodiment, taking the node to be synchronized as the time source node (referred to as the time source for short), and the synchronization nodes corresponding to the node to be synchronized are also time source nodes as an example, the process of establishing a time source synchronization network is described.
在实施例中,时间源之间的同步(时间源同步网络)不会影响每个时间源与其下挂同步网的授时和同步机制。每个时间源下挂的承载设备构成一个网络,时钟源之间构成一个独立网络。只是通过时间源同步网络,每个时间源输出的授时时间不再是单独时间源的时间,而是经过时间源同步网络加权后的时间。In the embodiment, the synchronization between time sources (time source synchronization network) does not affect the timing and synchronization mechanism of each time source and its connected synchronization network. The bearer equipment connected to each time source forms a network, and the clock sources form an independent network. Only through the time source synchronization network, the timing time output by each time source is no longer the time of a separate time source, but the time weighted by the time source synchronization network.
如图2所示,时间源1、3、4和6为主时间源,时间源2和5是备用时间源。表5是本申请实施例提供的一种时间源同步精度信息表。如表5所示,每个时间源对应时间源号、同步精度值和同步精度等级。As shown in Figure 2, time sources 1, 3, 4, and 6 are the main time sources, and time sources 2 and 5 are backup time sources. Table 5 is a time source synchronization accuracy information table provided in an embodiment of the present application. As shown in Table 5, each time source corresponds to the time source number, synchronization accuracy value, and synchronization accuracy level.
表5一种时间源同步精度信息表Table 5 A time source synchronization accuracy information table
时间源号Time source number 同步精度值(ns)Synchronization accuracy value (ns) 同步精度等级Synchronization accuracy level
11 3030 ePRTCePRTC
22 4040 PRTC-BPRTC-B
33 3030 ePRTCePRTC
44 3030 ePRTCePRTC
55 100100 PRTC-APRTC-A
66 4040 ePRTCePRTC
示例性地,以时间源2作为待同步节点为例。如图2所示,时间源2的相邻时间源有时间源1、3、4和5,即时间源2对应的所有同步节点为时间源1、3、4和5。Exemplarily, take the time source 2 as the node to be synchronized as an example. As shown in Figure 2, adjacent time sources of time source 2 include time sources 1, 3, 4, and 5, that is, all synchronization nodes corresponding to time source 2 are time sources 1, 3, 4, and 5.
本实施例的同步流程如下:The synchronization process of this embodiment is as follows:
每个同步节点的每个端口属性可以设置为如下三种模式之一:加权主模式、加权从模式、加权主+加权从模式。其中,“加权主+加权从”模式需要一个物理端口同时支持主从模式。Each port attribute of each synchronization node can be set to one of the following three modes: weighted master mode, weighted slave mode, weighted master + weighted slave mode. Among them, the "weighted master + weighted slave" mode requires a physical port to support the master-slave mode at the same time.
示例性地,时间源2在时间源1方向的两个端口分别设置为“加权主”模式和“加权从”模式,或者一个端口同时为“加权主”和“加权从”模式。时间源2在时间源3、4和5方向也是同样的设置。Exemplarily, the two ports of the time source 2 in the direction of the time source 1 are respectively set to the "weighted master" mode and the "weighted slave" mode, or one port is set to the "weighted master" and the "weighted slave" mode at the same time. Time source 2 is set in the same way in time sources 3, 4, and 5.
时间源2从4个方向的加权从端口接收到这4个相邻时间源的同步精度信息,并根据同步精度值和/或同步精度等级(包括时间源2自身的同步信息)进行同步精度排序。表6是本申请实施例提供的一种待同步节点对应的所有同步节点的同步精度排序表。如表6所示,同步精度值越低表示精度越高,同步精度排序越高。其中,此实施例中同步精度等级也可认为是时间源类型。Time source 2 receives the synchronization accuracy information of these 4 adjacent time sources from the weighted slave port in 4 directions, and sorts the synchronization accuracy according to the synchronization accuracy value and/or synchronization accuracy level (including the synchronization information of time source 2 itself) . Table 6 is a sorting table of synchronization accuracy of all synchronization nodes corresponding to the nodes to be synchronized provided in an embodiment of the present application. As shown in Table 6, the lower the synchronization accuracy value, the higher the accuracy and the higher the synchronization accuracy sort. Among them, the synchronization accuracy level in this embodiment can also be considered as a time source type.
表6一种待同步节点对应的所有同步节点的同步精度排序表Table 6 A sorting table of synchronization accuracy of all synchronization nodes corresponding to the nodes to be synchronized
时间源号Time source number 同步精度值(ns)Synchronization accuracy value (ns) 同步精度等级Synchronization accuracy level 同步精度排序Synchronization accuracy sort
11 3030 ePRTCePRTC 33
22 4040 PRTC-BPRTC-B 22
33 3030 ePRTCePRTC 33
44 3030 ePRTCePRTC 33
55 100100 PRTC-APRTC-A 11
在实施例中,可以设置预设阈值,并将满足预设阈值要求的时间源纳入加权计算的过程中,同时只有满足预设阈值要求的时间源才列入精度等级排序/分类,从而提高了时间同步精度。In an embodiment, a preset threshold can be set, and time sources that meet the preset threshold requirements are included in the weighting calculation process. At the same time, only time sources that meet the preset threshold requirements are included in the accuracy rank sorting/classification, thereby improving Time synchronization accuracy.
时间源2结合自身的时间同步精度信息和接收到的4个相邻时间源的时间同步精度信息(如表6)进行同步加权计算。Time source 2 combines its own time synchronization accuracy information and the received time synchronization accuracy information of four adjacent time sources (as shown in Table 6) to perform synchronization weight calculation.
在实施例中,利用如下四种预设加权算法:均权加权算法、等级加权算法、等级和均权加权算法、预设阈值和等级加权算法,对待同步节点和同步节点的同步精度信息进行排序。In the embodiment, the following four preset weighting algorithms are used: average weighting algorithm, level weighting algorithm, level and average weighting algorithm, preset threshold and level weighting algorithm, to sort the synchronization accuracy information of the synchronization node and the synchronization node .
在预设加权算法为均权加权算法的情况下,计算每个同步节点的权重。在实施例中,时间源2有5个时间同步精度信息(包括时间源2本身的时间),权重为1/5=20%;即不管时间源的时间精度如何,计算得到的权重都是一样的。表7是本申请实施例提供的一种均权加权算法得到的每个同步节点的权重示意表,如表7所示,待同步节点(时间源2)和对应所有同步节点(时间源1、3、4和5)的权重都是相同的。In the case where the preset weighting algorithm is an average weighting algorithm, the weight of each synchronization node is calculated. In the embodiment, the time source 2 has 5 time synchronization accuracy information (including the time of the time source 2 itself), and the weight is 1/5=20%; that is, the calculated weight is the same regardless of the time accuracy of the time source of. Table 7 is a schematic table of the weight of each synchronization node obtained by a weighted weighting algorithm provided by an embodiment of the present application. As shown in Table 7, the node to be synchronized (time source 2) and all synchronization nodes (time source 1, The weights of 3, 4, and 5) are all the same.
表7一种均权加权算法得到的每个同步节点的权重示意表Table 7 A schematic table of the weight of each synchronization node obtained by a weighted weighting algorithm
时间源号Time source number 同步精度值(ns)Synchronization accuracy value (ns) 同步精度等级Synchronization accuracy level 精度等级排序Accuracy ranking 权重Weights
11 3030 ePRTCePRTC 33 20%20%
22 4040 PRTC-BPRTC-B 22 20%20%
33 3030 ePRTCePRTC 33 20%20%
44 3030 ePRTCePRTC 33 20%20%
55 100100 PRTC-APRTC-A 11 20%20%
在预设加权算法为等级加权算法的情况下,计算每个同步节点的权重。将同步节点的同步精度信息根据等级分为几个类别,例如,A,B,C,D,E。每个等级赋予或设置一个权重,例如,A-5,B-4,C-3,D-2,E-1。In the case where the preset weighting algorithm is a level weighting algorithm, the weight of each synchronization node is calculated. The synchronization accuracy information of the synchronization node is divided into several categories according to the level, for example, A, B, C, D, and E. Each level is assigned or set a weight, for example, A-5, B-4, C-3, D-2, E-1.
在实施例中,表8是本申请实施例提供的一种等级加权算法得到的每个同步节点的权重示意表,时间源2以排序号为基础来计算权重:1/(3+2+3+3+1)=8.33%(即1份的权重是8.33%),则待同步节点和每个同步节点的权重如表8所示。In the embodiment, Table 8 is a schematic table of the weight of each synchronization node obtained by a level weighting algorithm provided in the embodiment of the present application. Time source 2 calculates the weight based on the ranking number: 1/(3+2+3 +3+1)=8.33% (that is, the weight of one share is 8.33%), then the weight of the node to be synchronized and each synchronization node is shown in Table 8.
表8一种等级加权算法得到的每个同步节点的权重示意表Table 8 A schematic table of the weight of each synchronization node obtained by a level weighting algorithm
时间源号Time source number 同步精度值(ns)Synchronization accuracy value (ns) 同步精度等级Synchronization accuracy level 精度等级排序Accuracy ranking 权重Weights
11 3030 ePRTCePRTC 33 3*8.33%=25%3*8.33%=25%
22 4040 PRTC-BPRTC-B 22 2*8.33%=16.67%2*8.33%=16.67%
33 3030 ePRTCePRTC 33 3*8.33%=25%3*8.33%=25%
44 3030 ePRTCePRTC 33 3*8.33%=25%3*8.33%=25%
55 100100 PRTC-APRTC-A 11 1*8.33%=8.33%1*8.33%=8.33%
在预设加权算法为等级和均权加权算法的情况下,计算每个同步节点的权重。首先,按照同步精度等级选择等级最高的同步节点,然后再对等级最高的同步节点进行均权算法。如果所有等级都相等,则按照均权加权算法进行处理,以计算得到对应权重。In the case that the preset weighting algorithm is a level and an average weighting algorithm, the weight of each synchronization node is calculated. First, the synchronization node with the highest level is selected according to the synchronization accuracy level, and then the weighting algorithm is performed on the synchronization node with the highest level. If all the levels are equal, it will be processed according to the weighted average algorithm to calculate the corresponding weight.
在实施例中,时间源2接收到的可信同步精度信息中,等级最高的是时间源1、3和4。由于时间源2自身的同步精度等级不是最高的,则也不纳入权重计算。表9是本申请实施例提供的一种等级和均权加权算法得到的每个同步节点的权重示意表。如表9所示,精度等级最高的同步节点为时间源1、时间源3和时间源4,则按照均权加权算法对这三个时间源的权重进行计算,则每个时间源的权重为33.33%。In the embodiment, among the trusted synchronization accuracy information received by time source 2, time sources 1, 3, and 4 have the highest levels. Since the synchronization accuracy level of time source 2 itself is not the highest, it is not included in the weight calculation. Table 9 is a schematic table of the weight of each synchronization node obtained by a rank and weighted weighting algorithm provided in an embodiment of the present application. As shown in Table 9, the synchronization nodes with the highest accuracy levels are time source 1, time source 3, and time source 4. The weights of these three time sources are calculated according to the average weighting algorithm, and the weight of each time source is 33.33%.
表9一种等级和均权加权算法得到的每个同步节点的权重示意表Table 9 A schematic table of the weight of each synchronization node obtained by a rank and weighted weighting algorithm
时间源号Time source number 同步精度值(ns)Synchronization accuracy value (ns) 同步精度等级Synchronization accuracy level 精度等级排序Accuracy ranking 权重Weights
11 3030 ePRTCePRTC 11 33.33%33.33%
22 4040 PRTC-BPRTC-B  To  To
33 3030 ePRTCePRTC 11 33.33%33.33%
44 3030 ePRTCePRTC 11 33.33%33.33%
55 100100 PRTC-APRTC-A  To  To
在预设加权算法为预设阈值和等级加权算法的情况下,计算每个同步节点的权重。在实施例中,以等级加权算法加上预设阈值为例,其他的算法也可以增加阈值,在此不再一一赘述。In the case where the preset weighting algorithm is the preset threshold and level weighting algorithm, the weight of each synchronization node is calculated. In the embodiment, taking the level weighting algorithm plus the preset threshold value as an example, other algorithms can also increase the threshold value, which will not be repeated here.
在实施例中,首先,按照预设阈值对待同步节点和每个同步节点的同步精度值进行筛选,然后将同步精度值满足预设阈值的同步节点纳入同步加权权重计算中。示例性地,假设预设阈值为70ns,即同步精度值超过70ns(或精度排序低于排序2)的时间源不能纳入同步加权,即时间源5不纳入同步加权权重计算,同时也不加入精度等级排序。时间源2直接以排序号为基础来计算权重:w=1/(2+1+2+2)=14.29%(即1份的权重四舍五入约是14.29%)。表10是本申请实施例提供的一种预设阈值和等级加权算法得到的每个同步节点的权重示意表。满足预设阈值的每个同步节点的权重如表10所示。In the embodiment, first, the synchronization accuracy value of the synchronization node and each synchronization node to be filtered according to a preset threshold value, and then synchronization nodes whose synchronization accuracy value meets the preset threshold value are included in the synchronization weight calculation. Exemplarily, assuming that the preset threshold is 70ns, that is, the time source whose synchronization accuracy value exceeds 70ns (or the accuracy ranking is lower than the ranking 2) cannot be included in the synchronization weighting, that is, the time source 5 is not included in the synchronization weighting calculation, and the accuracy is not added at the same time. Rank order. Time source 2 directly calculates the weight based on the ranking number: w=1/(2+1+2+2)=14.29% (that is, the weight of 1 part is rounded to approximately 14.29%). Table 10 is a schematic table of the weight of each synchronization node obtained by a preset threshold and level weighting algorithm provided in an embodiment of the present application. The weight of each synchronization node that meets the preset threshold is shown in Table 10.
表10一种预设阈值和等级加权算法得到的每个同步节点的权重示意表Table 10 A schematic table of the weight of each synchronization node obtained by a preset threshold and level weighting algorithm
时间源号Time source number 同步精度值(ns)Synchronization accuracy value (ns) 同步精度等级Synchronization accuracy level 精度等级排序Accuracy ranking 权重Weights
11 3030 ePRTCePRTC 22 2*w=28.57%2*w=28.57%
22 4040 PRTC-BPRTC-B 11 1*w=14.29%1*w=14.29%
33 3030 ePRTCePRTC 22 2*w=28.57%2*w=28.57%
44 3030 ePRTCePRTC 22 2*w=28.57%2*w=28.57%
55 100100 PRTC-APRTC-A  To  To
在实施例中,时间源2根据以下公式计算出需要调整的时差值T:In the embodiment, the time source 2 calculates the time difference value T that needs to be adjusted according to the following formula:
Figure PCTCN2020141380-appb-000005
Figure PCTCN2020141380-appb-000005
其中,T为时间源2需调整的时间;t i,为除时间源2外(因为时间源2与自身的时差是0),其他纳入权重计算的时间源与时间源2的时间差; Among them, T is the time to be adjusted for time source 2; t i is the time difference between time source 2 and time source 2 other than time source 2 (because the time difference between time source 2 and itself is 0);
w i,为除时间源2外(因为时间源2与自身的时差是0),其他参与权重计算的时间源的权重,即根据上述预设加权算法算出的权重。 w i is the weight of other time sources participating in the weight calculation except time source 2 (because the time difference between time source 2 and itself is 0), that is, the weight calculated according to the above-mentioned preset weighting algorithm.
在实施例中,每个时间源均根据确定的上述预设加权算法调整自身的本地时间,如此每个时间源的时间逐渐相互趋近并最终达到同一时间,从而实现每个时间源之间的时间同步,形成时间源同步网。In the embodiment, each time source adjusts its own local time according to the determined above-mentioned preset weighting algorithm, so that the time of each time source gradually approaches each other and finally reaches the same time, so as to realize the relationship between each time source. Time synchronization forms a time source synchronization network.
在一实现方式中,图3是本申请实施例提供的一种跨节点场景下时间源同步网络的建立示意图。在实施例中,以待同步节点为时间源节点,并且,待同步节点对应的同步节点也为时间源节点为例,对跨节点场景下建立时间源同步网络的过程进行说明。In an implementation manner, FIG. 3 is a schematic diagram of establishing a time source synchronization network in a cross-node scenario provided by an embodiment of the present application. In the embodiment, taking the node to be synchronized as the time source node, and the synchronization node corresponding to the node to be synchronized is also the time source node as an example, the process of establishing a time source synchronization network in a cross-node scenario will be described.
在实施例中,在相邻时间源之间跨同步传送节点的场景下,将同步传送节点的同步精度值和路径同步精度值加入到时间源之间交互的同步精度值中,以表示更准确的精度值。为了简明描述,本实施例中仅以加入同步传送节点的同步精度值为例。在实施例中,采用PTP协议实现加权同步。表11是本申请实施例提供的一种时间源节点的同步精度值示意表。表12是本申请实施例提供的一种同步传送节点的同步精度值示意表。如表11和表12所示,本实施例以6个时间源和3个同步传送节点为例,对建立时间源同步网络的过程进行说明。In the embodiment, in the scenario where the synchronization transmission node is cross-synchronized between adjacent time sources, the synchronization accuracy value and the path synchronization accuracy value of the synchronization transmission node are added to the synchronization accuracy value of the interaction between the time sources to represent more accurate The precision value. For the sake of concise description, in this embodiment, only the synchronization accuracy of the added synchronization transfer node is taken as an example. In the embodiment, the PTP protocol is used to implement weighted synchronization. Table 11 is a schematic table of synchronization accuracy values of a time source node provided in an embodiment of the present application. Table 12 is a schematic table of synchronization accuracy values of a synchronization transfer node provided in an embodiment of the present application. As shown in Table 11 and Table 12, this embodiment uses 6 time sources and 3 synchronous transmission nodes as an example to describe the process of establishing a time source synchronization network.
表11一种时间源节点的同步精度值示意表Table 11 A schematic table of synchronization accuracy values of time source nodes
时间源号Time source number 同步精度值(ns)Synchronization accuracy value (ns)
11 3030
22 4040
33 3030
44 3030
55 100100
66 4040
表12一种同步传送节点的同步精度值示意表Table 12 A schematic table of synchronization accuracy values of a synchronous transmission node
时间传送节点号Time transfer node number 同步精度值(ns)Synchronization accuracy value (ns)
B1B1 55
B2B2 55
B3B3 3030
时间源2与时间源1、3、4和5互发PTP报文,报文发送和处理均一样。示例性地,本实施例以时间源2为例进行说明。时间源2的相邻时间源为时间源1、3、4和5。其中,时间源2与时间源3之间经过了B1和B2两个同步传送节点,而时间源2与时间源4之间经过了B3同步传送节点。Time source 2 exchanges PTP messages with time sources 1, 3, 4, and 5, and the message transmission and processing are the same. Illustratively, this embodiment takes time source 2 as an example for description. The adjacent time sources of time source 2 are time sources 1, 3, 4, and 5. Among them, the time source 2 and the time source 3 have passed two synchronous transmission nodes B1 and B2, and the time source 2 and the time source 4 have passed the B3 synchronous transmission node.
本实施例的同步流程如下:The synchronization process of this embodiment is as follows:
示例性地,时间源2在时间源1方向的两个端口分别设置为“加权主”模式和“加权从”模式。在时间源3、4和5方向也是同样的设置。Exemplarily, the two ports of the time source 2 in the direction of the time source 1 are respectively set to the "weighted master" mode and the "weighted slave" mode. The same is true for time sources 3, 4, and 5.
时间源2从这4个相邻时间源接收到对应的同步精度信息。在实际通信过程中,时间源2与时间源3之间经过了B1和B2两个同步传送节点,而与时间源4之间经过了B3同步传送节点,则这两个方向上的同步精度值均增加同步传送节点引入的同步精度值。Time source 2 receives corresponding synchronization accuracy information from these four adjacent time sources. In the actual communication process, time source 2 and time source 3 have passed two synchronous transmission nodes B1 and B2, and between time source 4 and time source 4 have passed B3 synchronous transmission node, the synchronization accuracy value in these two directions Both increase the synchronization accuracy value introduced by the synchronization transfer node.
在实施例中,时间源2加权从端与时间源1加权主端:时间源2接收到时间源1的PTP Announce报文,Announce报文报头中的2bits指示位为01(如表3),表13是本申请实施例提供的一种Announce报文的扩展TLV示意表。In the embodiment, the weighted slave end of time source 2 and the weighted master end of time source 1: time source 2 receives the PTP Announce message of time source 1, and the 2bits indicator in the header of the Announce message is 01 (see Table 3), Table 13 is a schematic table of an extended TLV of an Announce message provided in an embodiment of the present application.
表13一种Announce报文的扩展TLV示意表Table 13 Schematic table of an extended TLV of an Announce message
Figure PCTCN2020141380-appb-000006
Figure PCTCN2020141380-appb-000006
时间源2与时间源1之间通过交互Sync报文和Delay_Req报文(报头中的2bits指示位均为01),计算出时间源2与时间源1之间的时间差。将此时间差按照上述预设加权算法得出的权重,算入时间源2需调整的时间中。Time source 2 and time source 1 exchange Sync messages and Delay_Req messages (the 2 bits in the header are all 01) to calculate the time difference between time source 2 and time source 1. This time difference is calculated according to the weight obtained by the above-mentioned preset weighting algorithm into the time that time source 2 needs to adjust.
同样地,时间源2加权从端与时间源5加权主端的交互与上述时间源2与时间源1之间的交互相同。Similarly, the interaction between the weighted slave end of the time source 2 and the weighted master end of the time source 5 is the same as the interaction between the time source 2 and the time source 1 described above.
时间源2加权从端与时间源4加权主端:B3收到时间源4发往时间源2的PTP Announce报文,Announce报文报头中的2bits指示位为01(描述如表3)。表14是本申请实施例提供的另一种Announce报文的扩展TLV示意表。如表14所示,Announce报文的扩展TLV如下所示。Time source 2 weighted slave end and time source 4 weighted master end: B3 receives the PTP Announce message sent from time source 4 to time source 2, and the 2bits indicator in the header of the Announce message is 01 (described in Table 3). Table 14 is a schematic table of another extended TLV of an Announce message provided in an embodiment of the present application. As shown in Table 14, the extended TLV of the Announce message is as follows.
表14另一种Announce报文的扩展TLV示意表Table 14 Schematic table of another extended TLV of the Announce message
Figure PCTCN2020141380-appb-000007
Figure PCTCN2020141380-appb-000007
因B3不是时间源,其只将自身的同步精度值加入报文中,再往下游发。此时,Announce报文报头中的2bits指示位仍为01,Announce报文的扩展TLV更改为表15所示。表15是本申请实施例提供的又一种Announce报文的扩展TLV示意表,表15为同步传送节点B3发送至源2的TLV。如表15所示,同步精度值为60ns,该同步精度值为B3的同步精度值和时间源4的同步精度值之和,即30ns+30ns=60ns。Because B3 is not a time source, it only adds its own synchronization accuracy value to the message, and then sends it downstream. At this time, the 2bits indicator in the header of the Announce message is still 01, and the extended TLV of the Announce message is changed as shown in Table 15. Table 15 is a schematic table of another extended TLV of an Announce message provided in an embodiment of the present application, and Table 15 is a TLV sent by the synchronous transfer node B3 to the source 2. As shown in Table 15, the synchronization accuracy value is 60ns, and the synchronization accuracy value is the sum of the synchronization accuracy value of B3 and the synchronization accuracy value of time source 4, that is, 30ns+30ns=60ns.
表15又一种Announce报文的扩展TLV示意表Table 15 Schematic table of another extended TLV of the Announce message
Figure PCTCN2020141380-appb-000008
Figure PCTCN2020141380-appb-000008
时间源2接收到时间源4的PTP Announce报文,Announce报文报头中的2bits指示位为01。表16是本申请实施例提供的再一种Announce报文的扩展TLV示意表,表16为时间源2接收到的TLV。如表16所示,时间源2接收到的同步精度值为B3的同步精度值和时间源4的同步精度值之和,即为60ns。Time source 2 receives the PTP Announce message of time source 4, and the 2bits indicator in the header of the Announce message is 01. Table 16 is a schematic table of another extended TLV of an Announce message provided in an embodiment of the present application, and Table 16 is a TLV received by time source 2. As shown in Table 16, the synchronization accuracy value received by time source 2 is the sum of the synchronization accuracy value of B3 and the synchronization accuracy value of time source 4, which is 60ns.
表16再一种Announce报文的扩展TLV示意表Table 16 Schematic table of another extended TLV of the Announce message
Figure PCTCN2020141380-appb-000009
Figure PCTCN2020141380-appb-000009
时间源2与时间源4之间通过交互Sync报文和Delay_Req报文(报头中的2bits指示位均为01),计算出时间源2与时间源4之间的时间差。将此时间差,按照统一的加权算法得出的权重,算入时间源2需调整的时间中。The time source 2 and the time source 4 interact with the Sync message and the Delay_Req message (the 2 bits indicator in the header are all 01) to calculate the time difference between the time source 2 and the time source 4. Calculate this time difference according to the weight obtained by the unified weighting algorithm into the time that time source 2 needs to adjust.
时间源2加权从端与时间源3加权主端的交互,与上述时间源2和时间源4之间的交互相同。示例性地,假设同步传送节点B1和B2的同步精度值为5ns,则时间源2接收到的时间源3的同步精度值,为时间源3、B1和B2这三个节点 的同步精度值之和,即在时间源3的同步精度值的基础上增加10ns(5ns+5ns)。The interaction between the weighted slave end of the time source 2 and the weighted master end of the time source 3 is the same as the interaction between the time source 2 and the time source 4 described above. Illustratively, assuming that the synchronization accuracy value of the synchronization transfer nodes B1 and B2 is 5 ns, the synchronization accuracy value of the time source 3 received by the time source 2 is one of the synchronization accuracy values of the three nodes of the time source 3, B1 and B2 Sum, that is, add 10ns (5ns+5ns) to the synchronization accuracy value of time source 3.
时间源2从4个方向的加权从端口接收到这4个相邻时间源的时间同步精度信息,并根据同步精度值(包括时间源2自身的同步信息)进行精度等级排序。表17是本申请实施例提供的另一种同步节点对应的所有同步节点的同步精度排序表,5个时间源的同步精度排序如表17所示。The time source 2 receives the time synchronization accuracy information of these 4 adjacent time sources from the weighted slave port in 4 directions, and sorts the accuracy levels according to the synchronization accuracy value (including the synchronization information of the time source 2 itself). Table 17 is another synchronization accuracy ranking table of all synchronization nodes corresponding to another synchronization node provided in an embodiment of the present application. The synchronization accuracy ranking of 5 time sources is shown in Table 17.
表17另一种同步节点对应的所有同步节点的同步精度排序表Table 17 Synchronization accuracy sorting table of all synchronization nodes corresponding to another synchronization node
时间源号Time source number 同步精度值(ns)Synchronization accuracy value (ns) 同步精度排序Synchronization accuracy sort
11 3030 44
22 4040 33
33 40(30+5+5)40(30+5+5) 33
44 60(30+30)60(30+30) 22
55 100100 11
同样的,时间源2结合自身的时间同步精度信息和接收到的4个相邻时间源的时间同步精度信息(如表17)进行同步加权计算。Similarly, time source 2 combines its own time synchronization accuracy information and the received time synchronization accuracy information of four adjacent time sources (see Table 17) to perform synchronization weight calculation.
此实施例,以等级加权算法为例。时间源2直接以排序号为基础来计算权重:w=1/(4+3+3+2+1)=7.69%(即1份的权重四舍五入约是7.69%),则待同步节点和对应每个同步节点的权重如表18所示。In this embodiment, the level weighting algorithm is taken as an example. Time source 2 calculates the weight directly based on the ranking number: w=1/(4+3+3+2+1)=7.69% (that is, the weight of 1 copy is rounded to about 7.69%), then the node to be synchronized and the corresponding The weight of each synchronization node is shown in Table 18.
表18另一种等级加权算法得到的每个同步节点的权重示意表Table 18 A schematic table of the weight of each synchronization node obtained by another level weighting algorithm
时间源号Time source number 同步精度值(ns)Synchronization accuracy value (ns) 同步精度排序Synchronization accuracy sort 权重Weights
11 3030 44 4*w=30.77%4*w=30.77%
22 4040 33 3*w=23.08%3*w=23.08%
33 30+5+5=4030+5+5=40 33 3*w=23.08%3*w=23.08%
44 30+30=6030+30=60 22 2*w=15.38%2*w=15.38%
55 100100 11 1*w=7.69%1*w=7.69%
最终,时间源2根据以下公式计算出需要调整的时差值T:Finally, time source 2 calculates the time difference value T that needs to be adjusted according to the following formula:
Figure PCTCN2020141380-appb-000010
Figure PCTCN2020141380-appb-000010
其中,T为时间源2需调整的时间;Among them, T is the time that time source 2 needs to adjust;
t 1~t 4,分别为时间源1、3、4、5与时间源2的时间差; t 1 ~t 4 are the time differences between time source 1, 3, 4, 5 and time source 2 respectively;
w 1~w 4,分别为时间源1、3、4、5的权重,分别为30.77%、23.08%、15.38%、 7.69%。 w 1 to w 4 are the weights of time sources 1, 3, 4, and 5, which are 30.77%, 23.08%, 15.38%, and 7.69%, respectively.
在实施例中,每个时间源均根据确定的上述预设加权算法调整自身的本地时间,如此每个时间源的时间逐渐相互趋近并最终达到同一时间,从而实现每个时间源之间的时间同步,形成时间源同步网。In the embodiment, each time source adjusts its own local time according to the determined above-mentioned preset weighting algorithm, so that the time of each time source gradually approaches each other and finally reaches the same time, so as to realize the relationship between each time source. Time synchronization forms a time source synchronization network.
在一实现方式中,图4是本申请实施例提供的一种同步传送节点同步网络的建立示意图。如图4所示,利用相邻同步传送节点建立同步传送节点同步网络。In an implementation manner, FIG. 4 is a schematic diagram of establishing a synchronization network of a synchronization transmission node according to an embodiment of the present application. As shown in Fig. 4, a synchronous network of synchronous transmission nodes is established by using adjacent synchronous transmission nodes.
本实施例适用于,包括但不限于以下同步场景:所有时间源丢失或出现故障,同步节点与所有相邻同步节点之间进行加权同步,建立的相对同步网络;在没有时间源的网络进行同步网的建立。表19是本申请实施例提供的一种同步传送节点的同步精度信息表,每个同步传送节点的同步精度等级如表19所示。This embodiment is applicable to, including but not limited to, the following synchronization scenarios: all time sources are lost or fail, the synchronization node and all adjacent synchronization nodes perform weighted synchronization to establish a relatively synchronized network; synchronization is performed on a network without a time source The establishment of the net. Table 19 is a synchronization accuracy information table of a synchronization transfer node provided by an embodiment of the present application, and the synchronization accuracy level of each synchronization transfer node is shown in Table 19.
表19一种同步传送节点的同步精度信息表Table 19 A synchronization accuracy information table of a synchronous transmission node
时间传送节点号Time transfer node number 同步精度等级Synchronization accuracy level
B1B1 T-BC Class DT-BC Class D
B2B2 T-BC Class CT-BC Class C
B3B3 T-BC Class DT-BC Class D
B4B4 T-BC Class BT-BC Class B
以同步传送节点B2为例。如图4所示,B2的相邻同步传送节点有B1和B3。Take the synchronous transfer node B2 as an example. As shown in Figure 4, B2 has B1 and B3 adjacent to synchronous transfer nodes.
本实施例中的同步流程如下:The synchronization process in this embodiment is as follows:
B2在B1方向的一个物理端口同时为“加权主”模式和“加权从”模式。在B3方向也是同样的设置。A physical port of B2 in the direction of B1 is in "weighted master" mode and "weighted slave" mode at the same time. The same setting is applied in the B3 direction.
B2加权从端与B1加权主端:B2收到B1的PTP Announce报文,Announce报文报头中的1bits指示位为1(描述如表3)。表20是本申请实施例提供的一种Announce报文的扩展TLV示意表。B2 weighted slave and B1 weighted master: B2 receives the PTP Announce message of B1, and the 1bits indicator in the header of the Announce message is 1 (described in Table 3). Table 20 is a schematic table of an extended TLV of an Announce message provided in an embodiment of the present application.
表20一种Announce报文的扩展TLV示意表Table 20 Schematic table of an extended TLV of an Announce message
Figure PCTCN2020141380-appb-000011
Figure PCTCN2020141380-appb-000011
Figure PCTCN2020141380-appb-000012
Figure PCTCN2020141380-appb-000012
B2与B1之间通过交互Sync报文和Delay_Req报文(报头中的1bits指示位均为1),计算出B2与B1之间的时间差。将此时间差,按照统一的加权算法得出的权重,算入B2需调整的时间中。B2 and B1 exchange Sync messages and Delay_Req messages (the 1bits indicator in the header are all 1) to calculate the time difference between B2 and B1. Calculate this time difference according to the weight obtained by the unified weighting algorithm into the time B2 needs to be adjusted.
B2加权从端与B3加权主端的交互与上述B2与B1之间的交互相同。The interaction between the B2 weighted slave and the B3 weighted master is the same as the interaction between B2 and B1 described above.
B2从这2个相邻同步传送节点接收到对应的时间同步精度信息,并根据同步精度值和/或时间同步精度等级(包括B2自身的同步信息)进行精度等级排序。表21是本申请实施例提供的一种同步传送节点的同步精度排序表。如表21所示,B1和B3的同步精度等级最高。B2 receives corresponding time synchronization accuracy information from these two adjacent synchronization transfer nodes, and sorts the accuracy levels according to the synchronization accuracy value and/or time synchronization accuracy level (including B2's own synchronization information). Table 21 is a sorting table of synchronization accuracy of synchronization transfer nodes provided in an embodiment of the present application. As shown in Table 21, B1 and B3 have the highest synchronization accuracy level.
表21一种同步传送节点的同步精度排序表Table 21 A sorting table of synchronization accuracy of synchronization transfer nodes
时间传送节点号Time transfer node number 同步精度等级Synchronization accuracy level 同步精度排序Synchronization accuracy sort
11 T-BC Class DT-BC Class D 22
22 T-BC Class CT-BC Class C 11
33 T-BC Class DT-BC Class D 22
B2结合自身的同步精度信息和接收到的2个相邻同步传送节点的同步精度信息(如表21)进行同步加权计算。本实施例以等级和均权加权算法为例。首先按照同步精度等级选择等级最高的,然后进行均权算法。B2 combines its own synchronization accuracy information and the received synchronization accuracy information of two adjacent synchronization transfer nodes (as shown in Table 21) to perform synchronization weight calculation. This embodiment takes the ranking and weighting algorithm as an example. First, select the highest level according to the synchronization accuracy level, and then perform the weighting algorithm.
在实施例中,B2接收到的可信同步精度信息中,等级最高的是B1和B3。即B2自身的同步精度等级不是最高的,不纳入权重计算。表22是本申请实施例提供的一种计入权重计算的同步传送节点的同步精度信息表。如表22所示,B2自身的同步精度等级不是最高的,则不纳入权重计算。In the embodiment, among the trusted synchronization accuracy information received by B2, the highest grades are B1 and B3. That is, the synchronization accuracy level of B2 itself is not the highest, and it is not included in the weight calculation. Table 22 is a synchronization accuracy information table of the synchronization transmission node included in the weight calculation provided by the embodiment of the present application. As shown in Table 22, if the synchronization accuracy level of B2 itself is not the highest, it is not included in the weight calculation.
表22一种计入权重计算的同步传送节点的同步精度信息表Table 22: A synchronization accuracy information table of the synchronization transfer node included in the weight calculation
时间传送节点号Time transfer node number 同步精度等级Synchronization accuracy level 同步精度排序Synchronization accuracy sort 权重Weights
11 T-BC Class DT-BC Class D 11 50%50%
22 T-BC Class CT-BC Class C  To  To
33 T-BC Class DT-BC Class D 11 50%50%
最终,B2将根据以下公式计算出调整的时差值T:Finally, B2 will calculate the adjusted time difference value T according to the following formula:
Figure PCTCN2020141380-appb-000013
Figure PCTCN2020141380-appb-000013
其中,T为同步传送节点B2需调整的时间;t i,为除B2外(因为B2与自 身的时差是0),其他纳入权重计算的同步传送节点与B2的时间差;w i,为除B2外(因为B2与自身的时差是0),其他参与权重计算的同步传送节点的权重,即根据上述的预设加权算法计算得到的权重。 Among them, T is the time that the synchronous transmission node B2 needs to adjust; t i , except B2 (because the time difference between B2 and itself is 0), the time difference between the other synchronous transmission nodes and B2 included in the weight calculation; w i , except B2 Outside (because the time difference between B2 and itself is 0), the weights of other synchronous transmission nodes participating in the weight calculation are the weights calculated according to the above-mentioned preset weighting algorithm.
在实施例中,每个同步传送节点均根据确定的预设加权算法调整自身的本地时间,如此每个同步传送节点的时间逐渐相互趋近并最终达到同一时间,从而实现每个同步传送节点之间的时间同步,形成同步传送节点的同步网。In the embodiment, each synchronous transmission node adjusts its own local time according to the determined preset weighting algorithm, so that the time of each synchronous transmission node gradually approaches each other and finally reaches the same time, so as to realize the difference between each synchronous transmission node. The time synchronization between the two forms a synchronization network of synchronous transmission nodes.
图5是本申请实施例提供的一种同步装置的结构框图。如图5所示,本实施例中的同步装置包括:接收器210和调整模块220。Fig. 5 is a structural block diagram of a synchronization device provided by an embodiment of the present application. As shown in FIG. 5, the synchronization device in this embodiment includes: a receiver 210 and an adjustment module 220.
接收器210,配置为接收每个待同步节点对应的所有同步节点的可信同步信息;The receiver 210 is configured to receive trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized;
调整模块220,配置为根据预设加权算法和可信同步信息调整每个待同步节点的本地时间。The adjustment module 220 is configured to adjust the local time of each node to be synchronized according to a preset weighting algorithm and trusted synchronization information.
本实施例提供的同步装置设置为实现图1所示实施例的同步方法,本实施例提供的同步装置实现原理和技术效果类似,此处不再赘述。The synchronization device provided in this embodiment is configured to implement the synchronization method of the embodiment shown in FIG.
在一实施例中,可信同步信息对应的同步节点包含在待同步节点的加权从端配置的可信主端列表中;其中,可信主端列表中的加权主端用于参与待同步节点的时间加权计算;可信主端列表至少包括下述之一:人工配置特定的主端,设置可信条件筛选得到的主端。In an embodiment, the synchronization node corresponding to the trusted synchronization information is included in the trusted master list configured by the weighted slave of the node to be synchronized; wherein the weighted master in the trusted master list is used to participate in the node to be synchronized The time-weighted calculation of the trusted master terminal; the list of trusted master terminals includes at least one of the following: manually configure a specific master terminal, and set the trusted master terminal filtered by the trusted conditions.
在一实施例中,在接收每个待同步节点对应的所有同步节点的可信同步信息的情况下,还包括:配置每个待同步节点和对应的所有同步节点的同步机制。In an embodiment, in the case of receiving trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized, the method further includes: configuring a synchronization mechanism for each node to be synchronized and all corresponding synchronization nodes.
在一实施例中,配置每个待同步节点和对应的所有同步节点的同步机制,包括:In an embodiment, configuring the synchronization mechanism of each node to be synchronized and all corresponding synchronization nodes includes:
配置每个待同步节点和对应的所有同步节点的每个端口属性;Configure each port attribute of each node to be synchronized and all corresponding synchronization nodes;
端口属性至少包括下述之一:加权主模式,加权从模式,加权主和加权从模式;加权主模式为待同步节点发送自身的同步信息至对端同步节点;加权从模式为待同步节点接收对端同步节点的可信同步信息,并进行加权计算;加权主和加权从模式为既接收对端同步节点的可信同步信息,又发送自身的同步信息至对端同步节点。Port attributes include at least one of the following: weighted master mode, weighted slave mode, weighted master and weighted slave mode; weighted master mode is that the node to be synchronized sends its own synchronization information to the peer synchronization node; weighted slave mode is that the node to be synchronized receives The trusted synchronization information of the peer synchronization node is calculated and weighted; the weighted master and weighted slave modes not only receive the trusted synchronization information of the peer synchronization node, but also send its own synchronization information to the peer synchronization node.
在一实施例中,在接收每个待同步节点对应的所有同步节点的可信同步信息之前,还包括:In an embodiment, before receiving trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized, the method further includes:
确定每个待同步节点和对应的所有同步节点的端口使能功能。Determine the port enabling function of each node to be synchronized and all corresponding synchronization nodes.
在一实施例中,根据预设加权算法和可信同步信息调整每个待同步节点的本地时间,包括:In an embodiment, adjusting the local time of each node to be synchronized according to a preset weighting algorithm and trusted synchronization information includes:
确定每个待同步节点与待同步节点对应的所有同步节点之间的时间差;Determine the time difference between each node to be synchronized and all synchronization nodes corresponding to the node to be synchronized;
根据预设加权算法和所述时间差,确定每个所述待同步节点的时差值;Determine the time difference value of each node to be synchronized according to a preset weighting algorithm and the time difference;
按照时差值调整对应的待同步节点的本地时间。Adjust the local time of the corresponding node to be synchronized according to the time difference value.
在一实施例中,在采用精确时钟同步协议PTP协议对每个待同步节点的本地时间进行调整的情况下,同步方法,还包括:In an embodiment, in the case that the PTP protocol is used to adjust the local time of each node to be synchronized, the synchronization method further includes:
接收每个待同步节点对应的所有同步节点的PTP报文,PTP报文报头中的1比特或2比特作为指示位用于指示是否加权同步,2比特指示位用于指示是否执行BMCA。PTP messages of all synchronization nodes corresponding to each node to be synchronized are received, 1 or 2 bits in the PTP message header are used as indicator bits to indicate whether weighted synchronization, and the 2-bit indicator bits are used to indicate whether to perform BMCA.
在一实施例中,根据预设加权算法和可信同步信息调整每个待同步节点的本地时间,包括:In an embodiment, adjusting the local time of each node to be synchronized according to a preset weighting algorithm and trusted synchronization information includes:
根据每个待同步节点与自身对应的所有同步节点之间的同步报文和延迟请求报文,计算得到每个待同步节点与自身对应的所有同步节点之间的时间差;According to the synchronization messages and delay request messages between each node to be synchronized and all synchronization nodes corresponding to itself, the time difference between each node to be synchronized and all synchronization nodes corresponding to itself is calculated;
根据预设加权算法和时间差,确定每个待同步节点的时差值;Determine the time difference value of each node to be synchronized according to the preset weighting algorithm and time difference;
按照时差值调整待同步节点的本地时间。Adjust the local time of the node to be synchronized according to the time difference value.
在一实施例中,根据预设加权算法和时间差,确定每个待同步节点的时差值,包括:In an embodiment, determining the time difference value of each node to be synchronized according to the preset weighting algorithm and the time difference includes:
根据预设加权算法确定每个待同步节点和对应所有同步节点的权重;所有同步节点包括下述之一:可信同步信息对应的所有同步节点,预设阈值筛选得到的所有同步节点;Determine the weight of each node to be synchronized and corresponding to all synchronization nodes according to a preset weighting algorithm; all synchronization nodes include one of the following: all synchronization nodes corresponding to trusted synchronization information, and all synchronization nodes filtered by a preset threshold;
根据每个待同步节点与对应所有同步节点之间的时间差,以及权重,确定每个待同步节点的时差值。The time difference value of each node to be synchronized is determined according to the time difference between each node to be synchronized and all corresponding synchronization nodes, and the weight.
在一实施例中,待同步节点和同步节点均包括下述之一:时间源节点,同步传送节点,端应用节点。In an embodiment, both the node to be synchronized and the synchronization node include one of the following: a time source node, a synchronization transfer node, and an end application node.
在一实施例中,可信同步信息包括:同步精度信息;In an embodiment, the trusted synchronization information includes: synchronization accuracy information;
同步精度信息至少包括下述之一:同步精度值,同步精度等级。The synchronization accuracy information includes at least one of the following: a synchronization accuracy value, and a synchronization accuracy level.
在一实施例中,预设加权算法,包括下述之一:均权加权算法,等级加权算法,等级和均权加权算法;In an embodiment, the preset weighting algorithm includes one of the following: an average weighting algorithm, a level weighting algorithm, a level and an average weighting algorithm;
均权加权算法为待同步节点和对应的所有同步节点的权重是相同的;等级加权算法为按照每个同步节点的同步精度信息确定权重;等级和均权加权算法为先按照同步精度信息进行精度排序后,再将精度最高的按照均权加权算法计算权重;The average weighting algorithm is that the weights of the node to be synchronized and all the corresponding synchronization nodes are the same; the level weighting algorithm is to determine the weight according to the synchronization accuracy information of each synchronization node; the level and the average weighting algorithm are to first perform the accuracy according to the synchronization accuracy information After sorting, the weight with the highest accuracy is calculated according to the weighted average algorithm;
或者,按照预设阈值筛选所有同步节点,并将满足预设阈值的同步节点按照预设加权算法计算权重。Or, filter all synchronization nodes according to a preset threshold, and calculate weights for synchronization nodes that meet the preset threshold according to a preset weighting algorithm.
在一实施例中,在采用等级加权算法的情况下,每个同步节点的权重包括:每个同步节点的同步精度排序与所有同步节点的同步精度排序之和的比值;或者,将同步精度信息根据等级划分类别,并对每个等级设置一个对应的权重。In one embodiment, when the level weighting algorithm is used, the weight of each synchronization node includes: the ratio of the synchronization accuracy ranking of each synchronization node to the sum of the synchronization accuracy rankings of all synchronization nodes; or, the synchronization accuracy information Divide the categories according to the level, and set a corresponding weight for each level.
在一实施例中,每个待同步节点的时差值为
Figure PCTCN2020141380-appb-000014
In one embodiment, the time difference of each node to be synchronized is
Figure PCTCN2020141380-appb-000014
其中,T为每个待同步节点所需调整的时间;t 1~t n,为每个同步节点与待同步节点之间的时间差;w 1~w n为每个同步节点的权重。 Among them, T is the time required to adjust each node to be synchronized; t 1 ~t n are the time difference between each synchronization node and the node to be synchronized; w 1 ~w n are the weights of each synchronization node.
在一实施例中,同步方法的应用场景包括下述之一:建立时间源同步网络;所有时间源或频率源丢失或出现故障,待同步节点与所有相邻同步节点之间进行加权同步,所建立的相对同步网络;未配置时间源或频率源的同步网络。In an embodiment, the application scenario of the synchronization method includes one of the following: establishing a time source synchronization network; all time sources or frequency sources are lost or fail, and the node to be synchronized is weighted synchronization with all adjacent synchronization nodes, so A relatively synchronous network established; a synchronous network without a time source or frequency source.
图6是本申请实施例提供的一种设备的结构示意图。如图6所示,本申请提供的设备,包括:处理器310、存储器320和通信模块330。该设备中处理器310的数量可以是一个或者多个,图6中以一个处理器310为例。该终端设备中存储器320的数量可以是一个或者多个,图6中以一个存储器320为例。该终端设备的处理器310、存储器320和通信模块330可以通过总线或者其他方式连接,图6中以通过总线连接为例。在该实施例中,该设备为用于授时的时间源(即时间服务器),也可以为同步网的端应用(比如基站)等。Fig. 6 is a schematic structural diagram of a device provided by an embodiment of the present application. As shown in FIG. 6, the device provided by the present application includes: a processor 310, a memory 320, and a communication module 330. The number of processors 310 in the device may be one or more, and one processor 310 is taken as an example in FIG. 6. The number of memories 320 in the terminal device may be one or more, and one memory 320 is taken as an example in FIG. 6. The processor 310, the memory 320, and the communication module 330 of the terminal device may be connected through a bus or in other ways. In FIG. 6, the connection through a bus is taken as an example. In this embodiment, the device is a time source (that is, a time server) used for time service, and may also be an end application of a synchronization network (such as a base station).
存储器320作为一种计算机可读存储介质,可设置为存储软件程序、计算 机可执行程序以及模块,如本申请任意实施例的设备对应的程序指令/模块(例如,同步装置中的接收器和调整模块)。存储器320可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据设备的使用所创建的数据等。此外,存储器320可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实例中,存储器320可进一步包括相对于处理器310远程设置的存储器,这些远程存储器可以通过网络连接至设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 320, as a computer-readable storage medium, can be configured to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the device of any embodiment of the present application (for example, the receiver and adjustment module in the synchronization device). Module). The memory 320 may include a program storage area and a data storage area. The program storage area may store an operating system and an application program required by at least one function; the data storage area may store data created according to the use of the device, and the like. In addition, the memory 320 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some examples, the memory 320 may further include a memory remotely provided with respect to the processor 310, and these remote memories may be connected to the device through a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
通信模块330,配置为用于与其它同步节点进行通信交互。The communication module 330 is configured to communicate and interact with other synchronization nodes.
上述提供的设备可设置为执行上述任意实施例提供的同步方法,具备相应的功能和效果。The above-provided device can be configured to execute the synchronization method provided in any of the above-mentioned embodiments, and has corresponding functions and effects.
本申请实施例还提供一种包含计算机可执行指令的存储介质,计算机可执行指令在由计算机处理器执行时用于执行一种同步方法,该方法包括:接收每个待同步节点对应的所有同步节点的可信同步信息;根据预设加权算法和可信同步信息调整每个待同步节点的本地时间。The embodiment of the present application also provides a storage medium containing computer-executable instructions. The computer-executable instructions are used to perform a synchronization method when executed by a computer processor. The method includes: receiving all synchronizations corresponding to each node to be synchronized. The trusted synchronization information of the node; adjust the local time of each node to be synchronized according to the preset weighting algorithm and the trusted synchronization information.
本领域内的技术人员应明白,本申请的多种实施例可以在硬件或专用电路、软件、逻辑或其任何组合中实现。例如,一些方面可以被实现在硬件中,而其它方面可以被实现在可以被控制器、微处理器或其它计算装置执行的固件或软件中,尽管本申请不限于此。Those skilled in the art should understand that the various embodiments of the present application can be implemented in hardware or special circuits, software, logic or any combination thereof. For example, some aspects may be implemented in hardware, while other aspects may be implemented in firmware or software that may be executed by a controller, microprocessor, or other computing device, although the present application is not limited thereto.
本申请的实施例可以通过移动装置的数据处理器执行计算机程序指令来实现,例如在处理器实体中,或者通过硬件,或者通过软件和硬件的组合。计算机程序指令可以是汇编指令、指令集架构(Instruction Set Architecture,ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码。The embodiments of the present application may be implemented by executing computer program instructions by a data processor of a mobile device, for example, in a processor entity, or by hardware, or by a combination of software and hardware. Computer program instructions can be assembly instructions, Instruction Set Architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or written in any combination of one or more programming languages Source code or object code.
本申请附图中的任何逻辑流程的框图可以表示程序步骤,或者可以表示相互连接的逻辑电路、模块和功能,或者可以表示程序步骤与逻辑电路、模块和功能的组合。计算机程序可以存储在存储器上。存储器可以具有任何适合于本 地技术环境的类型并且可以使用任何适合的数据存储技术实现,例如但不限于只读存储器(Read-Only Memory,ROM)、随机访问存储器(Random Access Memory,RAM)、光存储器装置和系统(数码多功能光碟(Digital Video Disc,DVD)或光盘(Compact Disk,CD))等。计算机可读介质可以包括非瞬时性存储介质。数据处理器可以是任何适合于本地技术环境的类型,例如但不限于通用计算机、专用计算机、微处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑器件(Field-Programmable Gate Array,FPGA)以及基于多核处理器架构的处理器。The block diagram of any logic flow in the drawings of the present application may represent program steps, or may represent interconnected logic circuits, modules, and functions, or may represent a combination of program steps and logic circuits, modules, and functions. The computer program can be stored on the memory. The memory can be of any type suitable for the local technical environment and can be implemented using any suitable data storage technology, such as but not limited to read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), optical Memory devices and systems (Digital Video Disc (DVD) or Compact Disk (CD)), etc. Computer-readable media may include non-transitory storage media. The data processor can be any type suitable for the local technical environment, such as but not limited to general-purpose computers, special-purpose computers, microprocessors, digital signal processors (Digital Signal Processors, DSP), application specific integrated circuits (ASICs) ), programmable logic devices (Field-Programmable Gate Array, FPGA), and processors based on multi-core processor architecture.

Claims (18)

  1. 一种同步方法,包括:A synchronization method including:
    接收每个待同步节点对应的所有同步节点的可信同步信息;Receive trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized;
    根据预设加权算法和所述可信同步信息调整每个待同步节点的本地时间。Adjust the local time of each node to be synchronized according to a preset weighting algorithm and the trusted synchronization information.
  2. 根据权利要求1所述的方法,其中,所述可信同步信息对应的同步节点包括在所述待同步节点的加权从端配置的可信主端列表中;其中,所述可信主端列表中的加权主端用于参与所述待同步节点的时间加权计算;所述可信主端列表包括下述至少之一:人工配置特定的主端,设置可信条件筛选得到的主端。The method according to claim 1, wherein the synchronization node corresponding to the trusted synchronization information is included in the trusted master list configured by the weighted slave of the node to be synchronized; wherein the trusted master list The weighted master terminal in is used to participate in the time weighted calculation of the node to be synchronized; the trusted master terminal list includes at least one of the following: manually configure a specific master terminal, and set a trusted master terminal filtered by a trusted condition.
  3. 根据权利要求1所述的方法,其中,在所述接收每个待同步节点对应的所有同步节点的可信同步信息的情况下,还包括:The method according to claim 1, wherein, in the case of receiving trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized, the method further comprises:
    配置每个待同步节点和对应的所有同步节点的同步机制。Configure the synchronization mechanism for each node to be synchronized and all corresponding synchronization nodes.
  4. 根据权利要求3所述的方法,其中,所述配置每个待同步节点和对应的所有同步节点的同步机制,包括:The method according to claim 3, wherein said configuring the synchronization mechanism of each node to be synchronized and all corresponding synchronization nodes comprises:
    配置每个待同步节点和对应的所有同步节点的每个端口属性;Configure each port attribute of each node to be synchronized and all corresponding synchronization nodes;
    所述端口属性包括下述至少之一:加权主模式,加权从模式,加权主和加权从模式;所述加权主模式为所述待同步节点发送自身的同步信息至对端同步节点;所述加权从模式为所述待同步节点接收对端同步节点的可信同步信息,并进行加权计算;所述加权主和加权从模式为既接收对端同步节点的可信同步信息,又发送自身的同步信息至对端同步节点。The port attributes include at least one of the following: a weighted master mode, a weighted slave mode, a weighted master and a weighted slave mode; the weighted master mode is that the node to be synchronized sends its own synchronization information to the peer synchronization node; The weighted slave mode is that the node to be synchronized receives the trusted synchronization information of the peer synchronization node and performs weight calculation; the weighted master and weighted slave mode both receive the trusted synchronization information of the peer synchronization node and send its own Synchronize information to the peer synchronization node.
  5. 根据权利要求1所述的方法,其中,在所述接收每个待同步节点对应的所有同步节点的可信同步信息之前,还包括:The method according to claim 1, wherein before said receiving trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized, the method further comprises:
    确定每个待同步节点和对应的所有同步节点的端口使能功能。Determine the port enabling function of each node to be synchronized and all corresponding synchronization nodes.
  6. 根据权利要求1所述的方法,其中,所述根据预设加权算法和所述可信同步信息调整每个待同步节点的本地时间,包括:The method according to claim 1, wherein the adjusting the local time of each node to be synchronized according to a preset weighting algorithm and the trusted synchronization information comprises:
    确定每个待同步节点与待同步节点对应的所有同步节点之间的时间差;Determine the time difference between each node to be synchronized and all synchronization nodes corresponding to the node to be synchronized;
    根据所述预设加权算法和所述时间差,确定每个待同步节点的时差值;Determine the time difference value of each node to be synchronized according to the preset weighting algorithm and the time difference;
    按照所述时差值调整对应的所述待同步节点的本地时间。Adjust the corresponding local time of the node to be synchronized according to the time difference value.
  7. 根据权利要求1所述的方法,其中,在采用精确时钟同步协议PTP对每个待同步节点的本地时间进行调整的情况下,所述方法,还包括:The method according to claim 1, wherein, in the case that the local time of each node to be synchronized is adjusted by using the precision clock synchronization protocol (PTP), the method further comprises:
    接收每个待同步节点对应的所有同步节点的PTP报文,所述PTP报文的报头中的1比特或2比特作为指示位用于指示是否加权同步,2比特指示位用于指示是否执行最优主时钟算法BMCA。Receive the PTP messages of all synchronization nodes corresponding to each node to be synchronized. One or two bits in the header of the PTP message are used as indicator bits to indicate whether to perform weighted synchronization, and the two-bit indicator bits are used to indicate whether to perform optimization. Excellent master clock algorithm BMCA.
  8. 根据权利要求7所述的方法,其中,所述根据预设加权算法和所述可信同步信息调整每个待同步节点的本地时间,包括:The method according to claim 7, wherein the adjusting the local time of each node to be synchronized according to a preset weighting algorithm and the trusted synchronization information comprises:
    根据每个待同步节点与自身对应的所有同步节点之间的同步报文和延迟请求报文,计算得到每个待同步节点与自身对应的所有同步节点之间的时间差;According to the synchronization messages and delay request messages between each node to be synchronized and all synchronization nodes corresponding to itself, the time difference between each node to be synchronized and all synchronization nodes corresponding to itself is calculated;
    根据所述预设加权算法和所述时间差,确定每个待同步节点的时差值;Determine the time difference value of each node to be synchronized according to the preset weighting algorithm and the time difference;
    按照所述时差值调整所述待同步节点的本地时间。Adjust the local time of the node to be synchronized according to the time difference value.
  9. 根据权利要求6或8所述的方法,其中,所述根据所述预设加权算法和所述时间差,确定每个待同步节点的时差值,包括:The method according to claim 6 or 8, wherein the determining the time difference value of each node to be synchronized according to the preset weighting algorithm and the time difference comprises:
    根据所述预设加权算法确定每个待同步节点和对应的所有同步节点的权重,所述所有同步节点包括下述至少之一:所述可信同步信息对应的所有同步节点,按照预设阈值筛选得到的所有同步节点;The weights of each node to be synchronized and all corresponding synchronization nodes are determined according to the preset weighting algorithm, where all synchronization nodes include at least one of the following: all synchronization nodes corresponding to the trusted synchronization information, according to a preset threshold All synchronization nodes obtained by screening;
    根据每个待同步节点与对应的所有同步节点之间的时间差,以及所述权重,确定每个待同步节点的时差值。According to the time difference between each node to be synchronized and all corresponding synchronization nodes, and the weight, the time difference value of each node to be synchronized is determined.
  10. 根据权利要求1-9中任一项所述的方法,其中,所述待同步节点和所述同步节点均包括下述之一:时间源节点,同步传送节点,端应用节点。The method according to any one of claims 1-9, wherein the node to be synchronized and the synchronization node both comprise one of the following: a time source node, a synchronization transfer node, and an end application node.
  11. 根据权利要求1-9中任一项所述的方法,其中,所述可信同步信息包括:同步精度信息;The method according to any one of claims 1-9, wherein the trusted synchronization information comprises: synchronization accuracy information;
    所述同步精度信息包括下述至少之一:同步精度值,同步精度等级。The synchronization accuracy information includes at least one of the following: a synchronization accuracy value and a synchronization accuracy level.
  12. 根据权利要求1-9中任一项所述的方法,其中,所述预设加权算法,包括下述之一:均权加权算法,等级加权算法,等级和均权加权算法;The method according to any one of claims 1-9, wherein the preset weighting algorithm comprises one of the following: an average weighting algorithm, a level weighting algorithm, a level and an average weighting algorithm;
    所述均权加权算法为所述待同步节点和对应的所有同步节点的权重是相同的;所述等级加权算法为按照每个同步节点的同步精度信息确定权重;所述等级和均权加权算法为按照同步精度信息进行精度排序后,将在所述同步精度信息中精度最高的按照所述均权加权算法计算权重;The weighted weighting algorithm is that the weights of the node to be synchronized and all the corresponding synchronization nodes are the same; the weighting algorithm of the rank is to determine the weight according to the synchronization accuracy information of each synchronization node; the weighting algorithm of rank and weighting is the same After ordering the accuracy according to the synchronization accuracy information, the weight of the synchronization accuracy information with the highest accuracy is calculated according to the weighted average algorithm;
    或者,按照预设阈值筛选所有同步节点,并将满足所述预设阈值的同步节 点按照所述预设加权算法计算权重。Or, filter all synchronization nodes according to a preset threshold, and calculate weights for synchronization nodes that meet the preset threshold according to the preset weighting algorithm.
  13. 根据权利要求12所述的方法,其中,在采用所述等级加权算法的情况下,每个同步节点的权重包括:每个同步节点的同步精度排序与所有同步节点的同步精度排序之和的比值;The method according to claim 12, wherein, in the case of using the rank weighting algorithm, the weight of each synchronization node comprises: the ratio of the synchronization accuracy ranking of each synchronization node to the sum of the synchronization accuracy rankings of all synchronization nodes ;
    或者,将同步精度信息根据等级划分类别,并对每个等级设置一个对应的权重。Alternatively, the synchronization accuracy information is divided into categories according to levels, and a corresponding weight is set for each level.
  14. 根据权利要求6、8或9所述的方法,其中,每个待同步节点的时差值为
    Figure PCTCN2020141380-appb-100001
    The method according to claim 6, 8 or 9, wherein the time difference of each node to be synchronized is
    Figure PCTCN2020141380-appb-100001
    其中,T为每个待同步节点所需调整的时间;t 1~t n,为每个同步节点与所述待同步节点之间的时间差;w 1~w n为每个同步节点的权重。 Among them, T is the time required for adjustment of each node to be synchronized; t 1 ˜t n are the time difference between each synchronization node and the node to be synchronized; w 1 ˜w n are the weights of each synchronization node.
  15. 根据权利要求1-9中任一项所述的方法,其中,所述同步方法的应用场景包括下述之一:建立时间源同步网络;所有时间源或频率源丢失或出现故障,待同步节点与所有相邻同步节点之间进行加权同步,所建立的相对同步网络;未配置时间源或频率源的同步网络。The method according to any one of claims 1-9, wherein the application scenario of the synchronization method includes one of the following: establishing a time source synchronization network; all time sources or frequency sources are lost or fail, and nodes to be synchronized A relatively synchronous network established by weighted synchronization with all adjacent synchronization nodes; a synchronization network without a time source or a frequency source.
  16. 一种同步装置,包括:A synchronization device includes:
    接收器,配置为接收每个待同步节点对应的所有同步节点的可信同步信息;A receiver, configured to receive trusted synchronization information of all synchronization nodes corresponding to each node to be synchronized;
    调整模块,配置为根据预设加权算法和所述可信同步信息调整每个待同步节点的本地时间。The adjustment module is configured to adjust the local time of each node to be synchronized according to a preset weighting algorithm and the trusted synchronization information.
  17. 一种设备,包括:通信模块,存储器,以及一个或多个处理器;A device including: a communication module, a memory, and one or more processors;
    所述通信模块,配置为用于与其它同步节点进行通信交互;The communication module is configured to communicate and interact with other synchronization nodes;
    所述存储器,配置为存储一个或多个程序;The memory is configured to store one or more programs;
    所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-15中任一项所述的同步方法。The one or more programs are executed by the one or more processors, so that the one or more processors implement the synchronization method according to any one of claims 1-15.
  18. 一种存储介质,所述存储介质存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-15中任一项所述的同步方法。A storage medium storing a computer program, and when the computer program is executed by a processor, the synchronization method according to any one of claims 1-15 is realized.
PCT/CN2020/141380 2020-03-23 2020-12-30 Synchronization method and apparatus, device, and storage medium WO2021190051A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010209774.0 2020-03-23
CN202010209774.0A CN112511253A (en) 2020-03-23 2020-03-23 Synchronization method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2021190051A1 true WO2021190051A1 (en) 2021-09-30

Family

ID=74953240

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/141380 WO2021190051A1 (en) 2020-03-23 2020-12-30 Synchronization method and apparatus, device, and storage medium

Country Status (2)

Country Link
CN (1) CN112511253A (en)
WO (1) WO2021190051A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114629586A (en) * 2022-03-14 2022-06-14 中国船舶重工集团公司第七0七研究所 Network port PTP time service function extension device and extension method

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117063543A (en) * 2021-03-31 2023-11-14 高通股份有限公司 Reducing synchronization accuracy of capacity user equipment in non-terrestrial networks
CN116961808A (en) * 2022-04-12 2023-10-27 华为技术有限公司 Clock synchronization method and related equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130259049A1 (en) * 2012-02-09 2013-10-03 Marvell Israel (M.I.S.L) Ltd. Clock synchronization using multiple network paths
WO2015169921A1 (en) * 2014-05-08 2015-11-12 Nokia Solutions And Networks Oy System and method to dynamically redistribute timing and synchronization in a packet switched network
CN105142211A (en) * 2015-09-02 2015-12-09 上海大学 Neighborhood averaging clock synchronization algorithm of wireless sensor network
CN109982425A (en) * 2019-01-28 2019-07-05 博频云彩(北京)科技有限公司 A kind of time quasi-synchronous method of non-stop layer distributed network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130259049A1 (en) * 2012-02-09 2013-10-03 Marvell Israel (M.I.S.L) Ltd. Clock synchronization using multiple network paths
WO2015169921A1 (en) * 2014-05-08 2015-11-12 Nokia Solutions And Networks Oy System and method to dynamically redistribute timing and synchronization in a packet switched network
CN105142211A (en) * 2015-09-02 2015-12-09 上海大学 Neighborhood averaging clock synchronization algorithm of wireless sensor network
CN109982425A (en) * 2019-01-28 2019-07-05 博频云彩(北京)科技有限公司 A kind of time quasi-synchronous method of non-stop layer distributed network

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114629586A (en) * 2022-03-14 2022-06-14 中国船舶重工集团公司第七0七研究所 Network port PTP time service function extension device and extension method

Also Published As

Publication number Publication date
CN112511253A (en) 2021-03-16

Similar Documents

Publication Publication Date Title
WO2021190051A1 (en) Synchronization method and apparatus, device, and storage medium
US10887037B2 (en) Symmetric path/link over LAG interface using LLDP for time synchronization between two nodes using PTP
KR101749202B1 (en) Method, apparatus, and system for generating timestamp
US10476697B2 (en) Network-on-chip, data transmission method, and first switching node
CN111385048B (en) Time synchronization method and system
US20210328907A1 (en) Blockchain systems, and message transmission methods and apparatuses
CN112367279A (en) Routing method and system based on two-dimensional mesh structure multi-core chipset
US10812209B2 (en) Method and apparatus for provision of timing for a communication network
CN101902291B (en) Method, equipment and system for precise time synchronization
CN113315668B (en) Method, node device and storage medium for adaptively adjusting network configuration
CN113424466A (en) Method and device for clock synchronization
WO2023197835A1 (en) Clock synchronization method and related device
CN112039621A (en) Time synchronization method and system
CN114389733B (en) PTP master clock device, clock synchronization method, and storage medium
WO2020238764A1 (en) Time sequence management method, device and system
CN109347851B (en) Request response method and device
WO2022029755A1 (en) Synchronization in distributed communication systems
CN102332997B (en) Network equipment and method for adjusting link capacity by using network equipment
WO2022000234A1 (en) Communication method and related apparatus
CN116388912B (en) Industrial heterogeneous network hybrid critical time synchronization method
JP7451721B2 (en) Clock port attribute recovery methods, devices, and systems
WO2024011410A1 (en) Method and network device for ptp clock synchronization
WO2022048482A1 (en) Message processing method and apparatus, device, system, and storage medium
US20230246723A1 (en) Time synchronization based on lookup table
US20230208544A1 (en) Method, apparatus, and system for processing time synchronization fault and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20927588

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 28/02/2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20927588

Country of ref document: EP

Kind code of ref document: A1