Time synchronization method and time synchronization device
By synchronizing the frequency of the local precise time protocol clock and the local clock in the time synchronization device, the time error and inability to pass the inspection in the time synchronization domain across different PTP configuration files are solved, and time synchronization with higher accuracy is achieved.
Patent Information
- Application Number
- CN202311448803.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-10-19
- Filing Date
- 2023-11-02
- Publication Date
- 2025-04-22
AI Technical Summary
When the prior art performs time synchronization across time synchronization domains of different PTP configuration files, there are time errors and problems of inaccurate time synchronization, resulting in inaccurate time synchronization.
By determining whether the frequency of the local precise time protocol clock has changed in the time synchronization device, and updating the frequency of the local clock in response to the frequency change, in order to synchronize the frequency of the local precise time protocol clock and the frequency of the local clock.
It realizes the accuracy of time synchronization when cross-domain time synchronization is performed in multiple time synchronization domains using different precise time protocol configuration files, and solves the problems of time error and inability to pass the inspection in the prior art.
Smart Images

Figure CN119865269A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a time synchronization method and device, and in particular to a time synchronization method and device for improving the accuracy of time synchronization when performing time synchronization in multiple time synchronization domains. Background Art
[0002] Precision Time Protocol (PTP) is the basic standard for time synchronization established by IEEE 1588, which is used to achieve high-precision clock synchronization. However, with the evolution of the market, applications in various networks have their own different requirements. Therefore, the prior art proposes many different PTP profiles according to different applications, such as Power Profile (IEEE Std C37.238) for power networks, Telecom Profile (ITU-TG.8265.1) for telecommunications networks, and Generalized Precision Time Protocol (IEEE Std 802.1AS: Generalized Precision Time Protocol, gPTP) profiles. Profiles allow applications in different fields to set different operating parameters, properties, and default values to meet requirements, resulting in the inability of devices and networks using various different profiles to communicate effectively. Generally speaking, in order to ensure time synchronization, devices or equipment in the same environment are required to use corresponding profiles, making cross-domain time integration relatively difficult.
[0003] The prior art integrates multiple different types of PTP configuration files through a time gateway, so that different time synchronization domains or devices using different types of PTP configuration files can be synchronized according to one of the Grandmaster (GM) clocks. Therefore, different time synchronization domains using different types of PTP configuration files can achieve time synchronization.
[0004] However, in actual operation, the synchronization mechanisms between IEEE 1588 and gPTP following IEEE Std 802.1AS are not exactly the same. The frequency difference between the local PTP clock and the local clock of the time gateway will cause time errors when performing time synchronization across time synchronization domains using different PTP profiles. In addition, when performing time synchronization, various PTP profiles or machines from different manufacturers may have different verification mechanisms. Frequency differences may also cause time synchronization across PTP profiles through the time gateway to fail to pass the verification and fail to operate as expected. Therefore, the existing technology needs to be improved. Summary of the invention
[0005] Therefore, the main purpose of the present invention is to provide a time synchronization method and device for improving the accuracy of time synchronization when integrating multiple devices or networks using different types of precision time protocol configuration files for time synchronization, so as to improve the shortcomings of the prior art.
[0006] An embodiment of the present invention discloses a time synchronization method for a time synchronization device, wherein the time synchronization device runs a plurality of precision time protocol instances to be respectively connected to a plurality of time synchronization domains. The time synchronization method comprises determining whether a frequency of a local precision time protocol clock of the time synchronization device has changed; and in response to the frequency of the local precision time protocol clock changing, updating a frequency of a local clock of the time synchronization device with the frequency of the local precision time protocol clock.
[0007] An embodiment of the present invention also discloses a time synchronization device, which runs a plurality of precision time protocol instances to be respectively connected to a plurality of time synchronization domains. The time synchronization device includes a processing unit and a storage unit. The processing unit is used to execute a program code. The storage unit is coupled to the processing unit and is used to store the program code to instruct the processing unit to execute a time synchronization method. The time synchronization method includes determining whether a frequency of a local precision time protocol clock (local PTP clock) of the time synchronization device has changed; and in response to the change in the frequency of the local precision time protocol clock, updating a frequency of a local clock of the time synchronization device with the frequency of the local precision time protocol clock. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] Figure 1 Schematic diagram of a time synchronization network system including multiple time synchronization domains according to an embodiment of the present invention. Figure 2 FIG. 4 is a schematic diagram of a time synchronization network system according to an embodiment of the present invention. Figure 3 The diagram is a schematic diagram of a time synchronization process according to an embodiment of the present invention. Figure 4 FIG. 4 is a schematic diagram of a time synchronization network system according to an embodiment of the present invention. Figure 5 FIG. 1 is a schematic diagram of a network device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0009] Certain words are used in the specification and subsequent claims to refer to specific components. Those skilled in the art should understand that hardware manufacturers may use different terms to refer to the same component. This specification and subsequent claims do not distinguish components by name, but by functional differences. The term "including" mentioned throughout the specification and subsequent claims is an open term and should be interpreted as "including but not limited to".
[0010] Please refer to Figure 1 , Figure 1 Schematic diagram of a time synchronization network system 1 according to an embodiment of the present invention. The time synchronization network system 1 includes time synchronization domains 12_1 to 12_3 and a time synchronization device 10. The time synchronization domains 12_1 to 12_3 may be time synchronization domains that operate according to the specifications of different types of Precision Time Protocol Profiles (PTP Profiles), wherein each time synchronization domain may be a wired network, a wireless network, or a domain formed by a combination of the two, and may be a domain composed of multiple devices and multiple network switches (including multiple clocks), or may be a domain composed of only a single device (only one clock). The time synchronization domains 12_1 to 12_3 are time synchronization domains that operate according to the specifications of different types of Precision Time Protocol Profiles (PTP Profiles) A to C, respectively.
[0011] The time synchronization device 10 may be a network device such as a gateway, a switch, a router, and a bridge running in a time synchronization domain, but is not limited thereto. Figure 1 ) are connected to the time synchronization domains 12_1 to 12_3 respectively. The time synchronization domains 12_1 to 12_3 are time synchronized by the time synchronization device 10, so that all devices and apparatuses in the time synchronization network system 1 can be synchronized according to the time of the same GrandMaster (GM) clock.
[0012] It should be noted that, in the absence of the time synchronization device 10, since the time synchronization domains 12_1 to 12_3 are running time synchronization mechanisms according to different precision time protocol profiles A to C, generally speaking, cross-domain time synchronization integration cannot be performed. In this case, each time synchronization domain has an optimal clock (e.g. Figure 1The best clocks 14_1 to 14_3 in the time synchronization domain are used as the master clocks of each time synchronization domain. That is, in the absence of the time synchronization device 10, the devices belonging to the same time synchronization domain perform time synchronization according to the master clock of the domain to which they belong. The best clock refers to the most ideal clock (for a specific time synchronization domain) evaluated based on factors such as time source, time accuracy, and oscillator stability, and can also be the most suitable clock (for a specific time synchronization domain) determined by humans.
[0013] In the embodiment of the present invention, the time synchronization domains 12_1 to 12_3 are time synchronized through the time synchronization device 10, thereby achieving that all devices and equipment in the time synchronization network system 1 are synchronized according to the time of a master clock 14_1 of one of the time synchronization domains. It should be noted that in the time synchronization network system 1, the number of the time synchronization domains 12_1 to 12_3 is 3, which is only used for illustration. The time synchronization device 10 of the embodiment of the present invention can be applied to time synchronization between any number of time synchronization domains, and is not limited thereto. In addition, in the specification, the time synchronization device 10 uses the best clock 14_1 of the time synchronization domain 12_1 as the master clock of the time synchronization network system 1 for time synchronization, but the time synchronization network system 1 can also perform time synchronization according to one of the best clocks 14_2 or 14_3 of the time synchronization domains 12_2 or 12_3. The master clock of the time synchronization network system 1 can be manually designated, or determined by the time synchronization device 10 by comparing the capability information of each clock in the clock announcement message (Announce message) received from each time synchronization domain 12_1~12_3, such as timePropertiesDS (Time Properties Parameter Data Set), parentDS (Parent Parameter Data Set) and the corresponding priority vector (Time-synchronization Spanning Tree Priority Vector), etc., but not limited thereto. In this embodiment, when the best clock 14_1 as the master clock fails or fails, it can be immediately replaced by other better clocks or the best clocks 14_2, 14_3 in the time synchronization domain 12_1 to continue time synchronization.
[0014] Specifically, in the embodiment of the present invention, the time synchronization device 10 establishes corresponding precision time protocol instances (PTP instances) 16_1 to 16_3 for the time synchronization domains 12_1 to 12_3. The precision time protocol instances 16_1 to 16_3 use the same type of precision time protocol profiles corresponding to the connected time synchronization domains 12_1 to 12_3. Therefore, PTP messages can be exchanged with the connected time synchronization domains and serve as a communication medium between the time synchronization device 10 and the time synchronization domains 12_1 to 12_3. In other words, the time synchronization domains 12_1 to 12_3 can operate according to various types of precision time protocol profiles such as but not limited to Telecom Profile, Power Profile, gPTP, etc., and the precision time protocol instances 16_1 to 16_3 operate according to the time protocol profiles corresponding to the time synchronization domains 12_1 to 12_3 and operate as one of the nodes.
[0015] Taking the best clock 14_1 as the master clock of the time synchronization network system 1 for time synchronization as an example, all devices and apparatuses in the time synchronization network system 1 are synchronized according to the time of the master clock 14_1. In the embodiment of the present invention, the port corresponding to the precision time protocol instance 16_1 is a time receiving port, which is used to receive information related to clock and time, or according to the specification of the precision time protocol, the port state (portState) is set to SlavePort; the ports corresponding to the precision time protocol instances 16_2 and 16_3 are time transmission ports, which are used to transmit information related to clock and time, or according to the specification of the precision time protocol, the port state is set to MasterPort. The time synchronization device 10 receives the PTP message of the master clock 14_1 from the time receiving port through the precision time protocol instance 16_1, and transmits the clock and time information of the master clock 14_1 to the time synchronization domains 12_2 and 12_3 through the time transmission port through the precision time protocol instances 16_2 and 16_3. During this process, the PT instances 16_2 and 16_3 convert the information of the master clock 14_1 according to the PT profiles B and C respectively to generate clock information that can be interpreted by the time synchronization domains 12_2 and 12_3. Accordingly, the time synchronization device 10 can achieve time synchronization across the time synchronization domains 12_1 to 12_3.
[0016] However, the mechanisms for time synchronization of various precision time protocol profiles are not the same. For example, the time synchronization mechanism of gPTP calculates the time based on a rate ratio between the master clock and the local clock (localclock, generally a free running clock), while this rate ratio is not used by the synchronization methods of other IEEE 1588 precision time protocol profiles. In addition, in the time synchronization mechanism of gPTP, the timestamp of the packet is stamped according to the time of the local clock when sending the PTP message. In contrast, the synchronization methods of other IEEE 1588 precision time protocol profiles stamp the timestamp of the packet according to the time of the local precision time protocol clock (localPTP clock) when sending the PTP message. Under this difference, when the synchronization time domain connected to the time synchronization device 10 includes both the precision time protocol profile using IEEE 1588 and gPTP, it will cause errors in measuring the path delay and the PTP message residence time. When multiple time synchronization domains using different precision time protocol profiles are connected in series through multiple time synchronization devices, the errors will gradually accumulate, causing serious problems.
[0017] For the convenience of explanation, it is assumed that the precision time protocol profile A used by the time synchronization domain 12_1 in the time synchronization network system 1 is a precision time protocol profile using IEEE 1588, and the precision time protocol profile C used by the time synchronization domain 12_3 is gPTP, and Figure 2 The time synchronization network system 1 is simplified as shown. In detail, the PT instance 16_1 operates according to the IEEE 1588 protocol. After receiving the Sync message from the master clock 14_1, the frequency is calculated and the local PT clock of the PT instance 16_1 is updated. The local PT clock of the PT instance 16_3 is updated synchronously based on the information. However, the master clock 14_1 and the PT instance 16_1 operate according to the IEEE 1588 protocol, while the PT instance 16_3 and the devices in the time synchronization domain 12_3 operate according to the IEEE 802.1AS. In this case, the PT instance 16_3 timestamps the packet with the time of the local clock and sends the Sync message according to the IEEE 802.1AS. Therefore, the devices in the time synchronization domain 12_3 will not be able to obtain the accurate frequency ratio from the master clock 14_1 to the device itself, resulting in errors.
[0018] In order to mitigate the impact of time synchronization across domains using different time protocol profiles, an embodiment of the present invention is to implement a time synchronization method in the time synchronization device 10 to achieve cross-domain time synchronization with higher accuracy. The time synchronization method can be summarized as a time synchronization process 30, such as Figure 3 As shown, the time synchronization process 3 includes the following steps:
[0019] Step 300: Start.
[0020] Step 302: Check the frequency of the local precision time protocol clock.
[0021] Step 304: Determine whether the frequency of the local precision time protocol clock has changed. If yes, execute step 304; otherwise, execute step 302.
[0022] Step 306: Update the frequency of the local clock of the time synchronization device with the frequency of the local precision time protocol clock, and continue to execute step 302.
[0023] According to the time synchronization process 30, the time synchronization device 10 checks the frequency of the local precision time protocol clock (step 302). When the frequency of the local precision time protocol clock changes (step 304), the frequency of the local clock of the time synchronization device 10 is updated with the frequency of the local precision time protocol clock (step 306). In this way, the local precision time protocol clock of the time synchronization device 10 can be synchronized with the frequency of the local clock, thereby smoothing out the impact caused by crossing time synchronization domains using different time protocol profiles.
[0024] In detail, the time synchronization device 10 continuously receives PTP messages from the master clock 14_1, calculates the time according to the protocol of the precision time protocol profile A used in the network domain where the master clock 14_1 is located, and updates the local precision time protocol clock. It should be noted that the master clock of the time synchronization network system 1 may change, or be updated to a clock from a different time synchronization network domain 12_1. Therefore, the time synchronization process 30 of the embodiment of the present invention needs to continuously operate and monitor to respond to changes. Once the time synchronization device 10 detects a change in the frequency of the local precision time protocol clock, the new frequency needs to be synchronized to the local clock of the time synchronization device 10 so that the local precision time protocol clock can be synchronized with the local clock.
[0025] In the case where the local precision time protocol clock of the time synchronization device 10 has a synchronized frequency with the local clock, when the precision time protocol instances 16_1 to 16_3 send PTP messages, the precision time protocol instances operating according to the IEEE 1588 protocol or the IEEE 802.1AS protocol can mark the timestamps of the packets with consistent times, thereby calculating a frequency ratio with higher accuracy, thereby improving the time accuracy of time synchronization across time synchronization domains using different time protocol profiles.
[0026] Please refer to Figure 4 , Figure 4 FIG. 1 is another schematic diagram of another use scenario of the time synchronization network system 1 according to an embodiment of the present invention. Figure 4 As shown, in the time synchronization network system 1, the time synchronization domain 12_1 uses the IEEE 1588 precision time protocol profile A, and the time synchronization domain 12_2 uses another IEEE 1588 precision time protocol profile B that is different from the IEEE 1588 precision time protocol profile A. It should be noted that, without the time synchronization device 10, even if the time synchronization domains 12_1 and 12_2 both use the IEEE 1588 precision time protocol profile, the time synchronization domains 12_1 and 12_2 still cannot perform cross-domain time synchronization due to the difference between the precision time protocol profiles A and B. Through the time synchronization device 10, the devices in the time synchronization domain 12_1 and the precision time protocol instance 16_1 can operate and communicate according to the IEEE 1588 precision time protocol profile A, and the precision time protocol instance 16_2 and the devices in the time synchronization domain 12_2 can operate and communicate according to the IEEE 1588 precision time protocol profile B. Accordingly, in the embodiment of the present invention, in addition to enabling the time synchronization domains 12_1 and 12_2 to perform cross-domain time synchronization through the time synchronization device 10, according to the time synchronization process 3, the time synchronization accuracy across domains using different precision time protocol configuration files can be further improved.
[0027] For further information, please refer to Figure 5 , which is a schematic diagram of a network device 5 according to an embodiment of the present invention. The network device 5 may be a network device such as a gateway, a switch, a router, and a bridge running in a time-sensitive network, but is not limited thereto. Any network device 5 having multiple ports may be used to implement the time synchronization device 10 according to an embodiment of the present invention. Figure 4As shown, the network device 5 may include a processing unit 50 and a storage unit 52. The processing unit 50 may be a general purpose processor, a microprocessor, an application specific integrated circuit (ASIC), etc. or a combination thereof. The storage unit 52 is coupled to the processing unit 50 and may be any data storage device for storing a program code 520, and reading and executing the program code 520 through the processing unit 50. For example, the storage unit 52 may be a read-only memory (ROM), a flash memory, a random access memory (RAM), a hard disk, an optical data storage device, and a non-volatile storage unit, etc., but is not limited thereto.
[0028] The network device 5 is used to represent the necessary elements required to implement the embodiment of the present invention, and those skilled in the art can make different modifications and adjustments accordingly, but are not limited to this. For example, when the time synchronization device is implemented by the network device 5, the time synchronization process 30 can be compiled into a program code 520 and stored in the storage unit 52, and the processing unit 50 runs the time synchronization method. In addition, the storage unit 52 is also used to store data required when the time synchronization method is running, but is not limited to this.
[0029] In summary, the present invention provides a time synchronization method and device, which can improve the accuracy of time synchronization when performing cross-domain time synchronization in multiple time synchronization domains using different precision time protocol configuration files, and improve the shortcomings of the prior art.
[0030] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made within the scope of the claims of the present invention should fall within the scope of the present invention. Description of Reference Numerals
[0031] 1: Time synchronization network system 10: Time synchronization device 12_1~12_3: Time synchronization domain 14_1~14_3: Best local clock 16_1~16_3: Precision Time Protocol Example A, B, C: Precision Time Protocol Profiles 3: Time synchronization process 300~306: Steps 5: Network Devices 50: Processing unit 52: Storage unit 520: Program code.
Claims
1. A time synchronization method, used in a time synchronization device, characterized in that: The time synchronization device runs a plurality of precision time protocol instances to be respectively connected to a plurality of time synchronization domains, and the time synchronization method comprises: Determining whether a frequency of a local precision time protocol clock of the time synchronization device changes; as well as In response to the frequency of the local PT clock changing, a frequency of a local clock of the time synchronization device is updated with the frequency of the local PT clock.
2. The time synchronization method according to claim 1, characterized in that: A precision time protocol instance of the plurality of precision time protocol instances is connected to a time synchronization domain using the generalized precision time synchronization protocol.
3. The time synchronization method according to claim 2, characterized in that: The precision time protocol instance calculates a frequency ratio based on the frequency of the updated local clock.
4. The time synchronization method according to claim 2, characterized in that: Also included is sending a precision time protocol message with a timestamp of the updated local clock.
5. The time synchronization method according to claim 1, characterized in that: The plurality of time synchronization domains use a plurality of precision time protocol profiles, and the plurality of precision time protocol profiles are different.
6. A time synchronization device, characterized in that: A plurality of precision time protocol instances are run to be respectively connected to a plurality of time synchronization domains, wherein the time synchronization device comprises: a processing unit for executing a program code; and a storage unit, coupled to the processing unit, for storing the program code to instruct the processing unit to execute a time synchronization method, the time synchronization method comprising: Determining whether a frequency of a local precision time protocol clock of the time synchronization device changes; as well as In response to the frequency of the local PT clock changing, a frequency of a local clock of the time synchronization device is updated with the frequency of the local PT clock.
7. The time synchronization device according to claim 6, characterized in that: A precision time protocol instance of the plurality of precision time protocol instances is connected to a time synchronization domain using the generalized precision time synchronization protocol.
8. The time synchronization device according to claim 7, characterized in that: The precision time protocol instance calculates a frequency ratio based on the frequency of the updated local clock.
9. The time synchronization device according to claim 7, characterized in that: The time synchronization method also includes sending a precision time protocol message with a timestamp of the updated local clock.
10. The time synchronization device according to claim 6, characterized in that: The plurality of time synchronization domains use a plurality of precision time protocol profiles, and the plurality of precision time protocol profiles are different.