Time synchronization method and time synchronization device
By running multiple precise time agreement instances in the time synchronization device and connecting multiple time synchronization domains, obtaining the master clock and updating its information, the time synchronization problem between different PTP profile domains is solved, and smooth time synchronization across domains is achieved.
Patent Information
- Application Number
- CN202410393339.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-02-01
- Filing Date
- 2024-04-02
- Publication Date
- 2025-04-18
AI Technical Summary
When time synchronization spans time synchronization domains using different types of PTP profiles, different verification mechanisms cause the time synchronization method to fail to function smoothly.
By running multiple precise time agreement instances in the time synchronization device and connecting multiple time synchronization domains through multiple connection ports, obtaining the master clock, updating its clock information, deciding the role of the connection port, and modifying the clock attributes to achieve time synchronization across domains.
It realizes smooth time synchronization between time synchronization domains of different PTP configuration files, avoiding time synchronization failure caused by differences in verification mechanisms.
Smart Images

Figure CN119853837A_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 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 time synchronization. However, as the market evolves, applications in various networks have their own different requirements. Therefore, according to various different applications, various different PTP profiles have emerged, such as PowerProfile (IEEE Std C37.238) for power networks, TelecomProfile (ITU-T G.8265.1) for telecommunications networks, and Generalized Precision Time Protocol (IEEE Std 802.1AS: Generalized Precision Time Protocol, gPTP) profiles. PTP profiles allow applications in different fields to set different operating parameters, properties, and preset values to meet their respective needs. However, this results 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 synchronize time according to a designated grandmaster (GM) clock. Accordingly, time synchronization of different time synchronization domains using different PTP configuration files can be achieved.
[0004] However, when performing time synchronization, the authentication mechanisms adopted by various PTP profiles or machines are different. Therefore, when performing time synchronization across time synchronization domains using different types of PTP profiles, the time synchronization method may not work smoothly due to the different authentication mechanisms. Summary of the invention
[0005] Therefore, the main purpose of the present invention is to provide a time synchronization method and device that can successfully pass the verification mechanism when performing time synchronization across time synchronization domains using different types of PTP configuration files, thereby improving the shortcomings of the conventional technology.
[0006] The 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 (PTP Instances) to connect a plurality of time synchronization domains through a plurality of ports. The time synchronization method includes obtaining a grandmaster (GM) from the plurality of time synchronization domains; updating a clock information of the grandmaster; determining each of the plurality of ports as a time receiving port or a time transmitting port according to the grandmaster; modifying the clock attribute of each of the plurality of PTP instances according to the corresponding port being the time receiving port or the time transmitting port; and the plurality of PTP instances synchronizing the time of the plurality of time synchronization domains according to the grandmaster.
[0007] The embodiment of the present invention further discloses a time synchronization device for running a plurality of precision time protocol instances to connect a plurality of time synchronization domains through a plurality of connection ports. 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 obtaining a master clock from the plurality of time synchronization domains; updating a clock information of the master clock; determining each of the plurality of connection ports to be a time receiving port or a time transmitting port according to the master clock; modifying the clock attribute of each precision time protocol instance of the plurality of precision time protocol instances according to the corresponding connection port being the time receiving port or the time transmitting port; and the plurality of precision time protocol instances synchronizing the time of the plurality of time synchronization domains according to the master clock. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] Figure 1 A schematic diagram of a network system. Figure 2 FIG. 4 is a schematic diagram of a time synchronization network system according to an embodiment of the present invention. Figure 3 FIG. 4 is a schematic diagram of a time synchronization network system according to an embodiment of the present invention. Figure 4 The diagram is a schematic diagram of a time synchronization process according to an embodiment of the present invention. Figure 5A , Figure 5B FIG. 4 is a schematic diagram of a time synchronization network system including a time synchronization device according to an embodiment of the present invention. Fig. 6A , Figure 6B FIG. 4 is a schematic diagram of a time synchronization network system including two time synchronization devices according to an embodiment of the present invention. Figure 7It is a schematic diagram of a time synchronization network system according to an embodiment of the present invention performing time synchronization according to the time of a time synchronization device. Figure 8 FIG. 1 is a schematic diagram of a network device according to an embodiment of the present invention.
[0009] 1: Network system 12_1~12_3: Time synchronization domain 14_1~14_3: Best Clock A~C: Precision Time Protocol Configuration File 2: Time synchronization network system 10: Time synchronization device 16_1~16_3: Connection port 18_1~18_3: Example of precise time agreement 20:Clock information S: Time receiving port M: Time transfer port 40: Time synchronization process 400~418: Steps 5: Time synchronization network system 50: Time synchronization device 56_1~56_2: Connection port 58_1~58_2: Example of precise time agreement 6: Time synchronization network system 60: Time synchronization device 66_2~66_3: Connection port 68_2~68_3: Precision Time Protocol Example 7: Time synchronization network system 70: Time synchronization device 74: Master Clock 76_1~76_3: Connection port 78_1~78_3: Precision Time Protocol Example 8: Network Devices 80: Processing unit 82: Storage unit 820: Program code DETAILED DESCRIPTION
[0010] Certain words are used in the specification and subsequent patent applications to refer to specific components. A person of ordinary skill in the art should understand that hardware manufacturers may use different terms to refer to the same component. This specification and subsequent patent applications do not distinguish components by name, but by functional differences. The term "including" mentioned throughout the specification and subsequent patent applications is an open-ended term and should be interpreted as "including but not limited to".
[0011] Please refer to Figure 1 , Figure 1 Schematic diagram of a network system 1 according to an embodiment of the present invention. The network system 1 includes time synchronization domains 12_1 to 12_3, 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 formed by multiple devices and multiple network switches (including multiple clocks), or may be a domain formed by only a single device (only one clock). 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 (Precision Time Protocol Profile, PTP Profile) A to C, wherein the precision time protocol profiles A to C may be a power network precision time protocol profile (PowerProfile), a telecommunication network precision time protocol profile (TelecomProfile) or a generalized precision time synchronization protocol gPTP, etc., and are not limited thereto.
[0012] It should be noted that the time synchronization domains 12_1 to 12_3 run the time synchronization mechanism according to different precise time protocol configuration files. Therefore, generally speaking, cross-domain time synchronization integration cannot be performed. In this case, each time synchronization domain has an optimal clock (such as Figure 1The best clock 14_1~14_3) in the network is used as the master clock of each time synchronization domain, that is, the devices belonging to the same time synchronization domain are synchronized according to the master clock of the domain to which they belong. The best clock refers to the most ideal clock suitable for a specific time synchronization domain evaluated based on factors such as time source, time accuracy, and oscillator stability, and can also be the clock that is most suitable for a specific time synchronization domain determined by humans. In this case, when a device manufacturer attempts to replace or add new equipment in a domain, the new equipment must be compatible with the precision time protocol profile used in the domain; when the device manufacturer develops equipment, it is necessary to customize and adjust various types of precision time protocol profiles to suit different fields; when the domain needs to be integrated with other specific time synchronization domains, all devices and network equipment may need to be updated to be compatible with the universal precision time protocol profile.
[0013] To solve the above problems, the prior art integrates multiple types of precision time protocol profiles through a time synchronization device, so that different time synchronization domains or devices using different types of precision time protocol profiles can synchronize time according to one of the master clocks, thereby achieving cross-domain time synchronization.
[0014] Please refer to Figure 2 , Figure 2 Schematic diagram of a time synchronization network system 2 according to an embodiment of the present invention. The time synchronization network system 2 includes time synchronization domains 12_1-12_3 and a time synchronization device 10. The time synchronization device 10 may be a network device such as a gateway, a switch, a router or a bridge running in the time synchronization domain, and is not limited thereto. The time synchronization device 10 is connected to the time synchronization domains 12_1-12_3 through a plurality of connection ports 16_1-16_3. In the time synchronization network system 2, the time synchronization domains 12_1-12_3 may be time synchronized through the time synchronization device 10, thereby achieving that all devices and equipment in the time synchronization domains 12_1-12_3 are synchronized according to an optimal clock in the time synchronization domains 12_1-12_3. It should be noted that in the time synchronization network system 2, the number of the time synchronization domains 12_1 to 12_3 is 3, which is for illustration only. 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.
[0015] like Figure 2 As shown, all devices and apparatuses in the time synchronization domains 12_1 to 12_3 are time synchronized according to the best clock 14_1 (as a master clock) of the time synchronization domain 12_1 using the precision time protocol profile A, but are not limited thereto. Figure 3 As shown, all devices and apparatuses in the time synchronization domains 12_1 to 12_3 can also perform time synchronization according to the best clock 14_2 of the time synchronization domain 12_2 using the PT profile B or the best clock 14_3 of the time synchronization domain 12_3 using the PT profile C (not shown in the figure). It should be noted that the master clock of the time synchronization network system 2 can be manually specified or automatically determined by the time synchronization device 10 by comparing the capability information of each clock in the PT announce message received from each of the time synchronization domains 12_1 to 12_3. For example, the capability information of the clock includes but is not limited to the time attribute data set (TimePropertiesParameterDataSet, timePropertiesDS) indicating the capability of the master clock, the parent parameter data set (ParentParameterDataSet, parentDS) indicating the capability of the upstream PT instance, and the corresponding priority vector (Time-synchronizationSpanningTreePriorityVector) and other parameters. In this embodiment, when the master clock 14_1 fails, the time synchronization device 10 can immediately determine a new master clock from the best clocks 14_2 and 14_3 or other clocks in the time synchronization domain 12_1 to maintain time synchronization.
[0016] In this embodiment, the time synchronization device 10 establishes PTP instances 18_1-18_3 for the ports 16_1-16_3 respectively to process the time synchronization of the time synchronization domains 12_1-12_3. Each of the PTP instances 18_1-18_3 needs to use the same PTP profile as the time synchronization domain connected by the corresponding port. For example, the PTP instance 18_1 corresponding to the port 16_1 uses the PTP profile A to communicate with the time synchronization domain 12_1, the PTP instance 18_2 corresponding to the port 16_2 uses the PTP profile B to communicate with the time synchronization domain 12_2, and the PTP instance 18_3 corresponding to the port 16_3 uses the PTP profile C to communicate with the time synchronization domain 12_3. Accordingly, the PT instances 18_1-18_3 respectively serve as the communication medium between the time synchronization device 10 and the time synchronization domains 12_1-12_3 according to the PT configuration files A-C, so that the time synchronization device 10 can exchange PT messages with the connected time synchronization domains 12_1-12_3. In other words, the PT instances 18_1-18_3 operate according to the PT configuration files used by the corresponding time synchronization domains and operate as a node of the corresponding time synchronization domains.
[0017] by Figure 21. Specifically, all equipment or devices in the time synchronization network system 2 are synchronized according to the master clock 14_1. Port 16_1 is a time receiving port (indicated by S) for receiving clock information such as clock attributes and time. According to the specification of the precision time protocol, the port state (portState) is set to a slave port (SlavePort); ports 16_2 and 16_3 are time transmission ports (indicated by M) for transmitting clock information such as clock attributes and time. According to the specification of the precision time protocol, the port state is set to a master port (MasterPort). The time synchronization device 10 receives the precision time protocol message related to the master clock 14_1 through the port 16_1 and processes the received precision time protocol message through the precision time protocol instance 18_1. After the time synchronization device 10 obtains the clock information of the master clock 14_1 from the precision time protocol instance 18_1, the time synchronization device 10 performs information conversion on the clock information according to the precision time protocol configuration files B and C. Then, the PT instances 18_2 and 18_3 transmit clock information to the time synchronization domains 12_2 and 12_3 through the ports 16_2 and 16_3 according to the PT profiles B and C. Thus, the devices and apparatuses in the time synchronization domains 12_2 and 12_3 can receive the clock information of the master clock 14_1, thereby achieving time synchronization of the time synchronization network system 2.
[0018] In practice, devices produced by different manufacturers or using different types of precision time protocol configuration files may have different authentication mechanisms when performing time synchronization. Due to different authentication mechanisms, precision time protocol messages carrying clock information may be rejected, resulting in time synchronization failing to proceed smoothly. Therefore, the time synchronization device 10 of an embodiment of the present invention operates as a virtual master clock according to a time synchronization method, so that all devices and equipment in the time synchronization network system 2 can regard the time synchronization device 10 as a master clock operating in the same time synchronization domain. The time synchronization method can be summarized as a time synchronization process 40, such as Figure 4 As shown, the time synchronization process 40 includes the following steps:
[0019] Step 400: Start.
[0020] Step 402: Obtain a master clock from a plurality of time synchronization domains.
[0021] Step 404: Update clock information of the master clock.
[0022] Step 406: Determine whether each of the plurality of ports is a time receiving port or a time transmitting port according to the master clock. If the port is a time transmitting port, execute step 408; otherwise, execute step 410.
[0023] Step 408: Update the clock attributes of the PTP instance corresponding to the port with the clock attributes of the master clock.
[0024] Step 410: Preserve the original clock properties of the PTP instance corresponding to the port.
[0025] Step 412: Perform time synchronization.
[0026] Step 414: Determine whether the connection with the master clock is interrupted. If so, execute step 418; otherwise, execute step 416.
[0027] Step 416: Determine whether better clock information is received. If yes, execute step 418; otherwise, execute step 412.
[0028] Step 418: Reset the PTP instances corresponding to other ports.
[0029] According to the time synchronization process 40, the time synchronization device 10 first determines a new master clock for the time synchronization network system 2 from the time synchronization domains 12_1 to 12_3 (step 402), and updates the clock information of the master clock, including the clock identification code (clockIdentity) of the master clock (step 404). Next, the time synchronization device 10 checks each of the ports 16_1 to 16_3 one by one to determine whether the port is a time receiving port or a time transmitting port (step 406). If the port is a time receiving port, the corresponding precision time protocol instance can retain the original clock properties; if the port is a time transmitting port, the time synchronization device 10 can update the clock properties of the precision time protocol instance corresponding to the port with the clock information of the master clock (step 408). Finally, the time synchronization device 10 performs time synchronization (step 412) and continuously monitors the connection status with the master clock (step 414). When the connection with the master clock is disconnected, the time synchronization device 10 resets the PT instance (step 418) and reselects a new master clock for the time synchronization network system 2 (step 402). During this process, the PT instances 18_1-18_3 continue to monitor the PT messages. When one of the PT instances 18_1-18_3 receives a PT announce message and the new clock is better than the corresponding best clock (step 416), the time synchronization device 10 can reset the remaining PT instances (step 418) and reselect a new master clock for the time synchronization network system 2 (step 402). Accordingly, the time synchronization device 10 can integrate the time of all devices and equipment in the time synchronization network system 2.
[0030] Please refer to Figure 2 In step 402, the time synchronization device 10 determines the best clock 14_1 of the time synchronization domain 12_1 as the master clock, and in step 404, updates the clock information 20 of the master clock with the clock information of the master clock 14_1. Next, in step 406, the time synchronization device 10 can check each of the ports 16_1 to 16_3 one by one, and determine that the port 16_1 is the time receiving port, and the ports 16_2 and 16_3 are the time transmitting ports. According to steps 408 and 410, the time synchronization device 10 updates the clock attributes of the precision time protocol instances 18_2 and 18_3 with the clock attributes of the master clock 14_1, and retains the original clock attributes of the precision time protocol instance 18_1. Finally, the precision time protocol instances 18_1 to 18_3 perform time synchronization of the time synchronization domains 12_1 to 12_3 according to the master clock 14_1. It should be noted that when the connection with the master clock 14_1 is disconnected, the time synchronization device 10 can reset the information of the precision time protocol instances 18_1 to 18_3 in step 418 and reselect a new master clock in step 402, for example Figure 3 In addition, if one of the PT instances 18_1-18_3 receives a PT announce message with a better clock than its corresponding best clock 14_1-14_3, the time synchronization device 10 can reset the other PT instances and reselect a new master clock in step 418.
[0031] According to the time synchronization process 40, in step 402, the time synchronization device 10 obtains a master clock from the time synchronization domains 12_1-12_3. Specifically, the time synchronization device 10 can select the master clock from the best clocks 14_1-14_3 by comparing the priority vectors of the clocks, wherein the best clocks 14_1-14_3 can be determined according to the Best Master Clock Algorithm (BMCA) or manually designated. The priority vector of the clock is included in the clock information, which is received by the precision time protocol instances 18_1-18_3 through the precision time protocol message. The time synchronization device 10 selects the best clock from the best clocks 14_1-14_3 as the master clock.
[0032] In step 404, the time synchronization device 10 updates the clock information 20 of the master clock with the clock information of the master clock 14_1. The clock information includes the capability information, time, and clock identification code (ID) as described above, but is not limited thereto. The time synchronization device 10 can convert the clock information of the master clock 14_1 according to different precision time protocol profiles. For example, the clock information of the master clock 14_1 can be converted into a format that complies with the precision time protocol profiles B and C, and is passed to the precision time protocol instances 18_2 and 18_3 respectively.
[0033] In step 406, the time synchronization device 10 determines each of the plurality of ports as a time receiving port or a time transmitting port according to the received PT messages. Specifically, the PT standard supports two operation modes: one-step mode and two-step mode. In the one-step mode, the timestamp of the transmitted message can be updated in time and directly carried in the Sync message, which is a hardware-based method and uses fewer messages. In the two-step mode, in addition to the Sync message, an additional Follow-up message carrying the transmission time of the previous message needs to be sent, which is a software-based method. In this embodiment, both the one-step mode and the two-step mode are applicable. In this embodiment, when the one-step mode is operated, the port receiving the Sync message of the PT is determined to be a time receiving port; otherwise, it is determined to be a time transmitting port. On the other hand, when the two-step mode is operated, the port receiving the Sync message or the Follow-up message of the PT is determined to be a time receiving port; otherwise, it is determined to be a time transmitting port. Therefore, the port 16_1 is a time receiving port because it receives a Sync message from the time synchronization domain 12_1 in the single-step mode, or receives a Sync message or a Follow_Up message in the dual-step mode, while the ports 16_2 and 16_3 are time transmitting ports.
[0034] In steps 408 and 410, the time synchronization device 10 modifies the clock attributes of each of the PT instances 18_1 to 18_3 according to whether the corresponding connection port is a time receiving port or a time transmitting port. The time synchronization device 10 updates the clock attributes such as the clock identification codes of the PT instances 18_2 and 18_3 corresponding to the time transmitting ports 16_2 and 16_3 to the clock attributes of the master clock 14_1, so that the PT instances 18_2 and 18_3 can send PT messages with the master clock attributes (e.g., the clock identification code of the master clock 14_1) through the time transmitting ports 16_2 and 16_3. In other words, the PT messages sent by the PT instances 18_2 and 18_3 will be like the PT messages sent by the master clock 14_1, and the time synchronization device 10 can be regarded as the master clock by the device-level devices in the time synchronization domains 12_2 and 12_3. In addition, the original clock property of the PT instance 18_1 can be retained because its corresponding port 16_1 is responsible for being a time receiving port for receiving clock information from the master clock 14_1.
[0035] In step 412, the time synchronization device performs time synchronization. Specifically, the PT instances 18_2 and 18_3 corresponding to the time transmission ports 16_2 and 16_3 can transmit the clock information of the master clock 14_1 obtained from the PT instance 18_1 corresponding to the time reception port 16_1 through the PT message. The clock information is converted by the time synchronization device 10 according to the PT profiles B and C respectively, and thus can be used in the time synchronization domains 12_2 and 12_3.
[0036] As mentioned above, the time synchronization device 10 uses different precision time protocol configuration files to connect the three time synchronization domains 12_1 to 12_3, wherein the time synchronization device 10 receives messages from the master clock 14_1 of the time synchronization domain 12_1 and plays the role of the master clock in the time synchronization domains 12_2 and 12_3. As the virtual master clock of the time synchronization domains 12_2 and 12_3, the time synchronization device 10 can use the clock identification code of the master clock 14_1 and other information to send precision time protocol messages, so that the devices in the time synchronization domains 12_2 and 12_3 can regard the time synchronization device 10 as the master clock 14_1 and synchronize time with it. In addition, the time synchronization device 10 can also modify some specific fields in the precision time protocol message to overcome various verification mechanisms of master clocks designed by different manufacturers. For example, the correction value field "correctionField" and the frequency ratio estimation value field "cumulativeRateRatio" in the Sync message and the Follow_Up message of the PT Protocol can be set to 0; the local transfer hop count field "localStepsRemoved" in the Announce message of the PT Protocol can be set to 0; the path tracking array "pathTrace" of the TLV in the Announce message of the PT Protocol can only retain the clock identification code of the master clock 14_1. Depending on the different verification mechanisms, different fields in the PT Protocol message may need to be modified, but are not limited to this. It should be noted that although the time synchronization device 10 achieves the effect of operating like a virtual master clock by modifying the content of the PT Protocol message, there are some specific message fields that are required for communication with the connected device and therefore do not need to be modified, such as "sourcePortIdentity", "sequenceId", "twoStepFlag" and "logMessageInterval". Accordingly, the devices in the time synchronization domains 12_2 and 12_3 can synchronize time with the master clock 14_1 according to the content of the precision time protocol message received from the time synchronization device 10 .
[0037] In step 414 to step 418, the time synchronization device 10 continuously monitors the PT messages from the time synchronization domains 12_1-12_3. During the time synchronization process 40, the master clock 14_1 may fail or a clock that is better than the master clock 14_1 may appear. In these cases, the time synchronization device 10 may reset the PT instances and reselect a new master clock for the time synchronization network system 2. In step 414, if the connection with the master clock 14_1 is interrupted, the time synchronization device 10 may reset the PT instances 18_1-18_3 and reselect a new master clock in step 402. In step 416, if one of the PT instances 18_1-18_3 receives a PT Announce message of a clock that is better than its corresponding best clock, the time synchronization device 10 may reset the other PT instances and select a new master clock in step 402. For example, if the PTP instance 18_3 receives a PTP Announce message of a clock that is better than the best clock 14_3 , the time synchronization device 10 may reset the PTP instances 18_1 and 18_2 and reselect a master clock according to step 402 .
[0038] Accordingly, the time synchronization device 10 operates as a virtual master clock, so that devices in the time synchronization domains 12_2 and 12_3 can regard the time synchronization device 10 as the master clock 14_1 and synchronize time with it.
[0039] Please refer to Figure 5A , Figure 5A FIG. 5 is a schematic diagram of a time synchronization network system 5 according to an embodiment of the present invention. The time synchronization network system 5 includes time synchronization domains 12_1-12_2 and a time synchronization device 50. Figure 5A As shown, the time synchronization device 50 establishes the PT instances 58_1-58_2 to connect to the time synchronization domains 12_1-12_2 respectively through the ports 56_1-56_2 according to the PT profiles A and B. The time synchronization device 50 receives the clock information of the master clock 14_1 through the time receiving port 56_1 (i.e., the port whose port status is set to SlavePort, marked as S) according to the PT profile A. After the time synchronization device 50 performs information conversion on the clock information, it transmits the clock information to the time synchronization domain 12_2 through the time transmitting port 56_2 (i.e., the port whose port status is set to MasterPort, marked as M) according to the PT profile B.
[0040] For the devices or equipment in the time synchronization domain 12_2, the time synchronization device 50 and the time synchronization domain 12_2 form a precision time agreement domain B, such as Figure 5BAs shown in FIG. 5 , the time synchronization device 50 operates as a virtual master clock, and for the time synchronization domain 12_2, the time synchronization device 50 can be regarded as a master clock existing in the same domain. Therefore, the devices in the time synchronization domain 12_2 may not perceive that the master clock 14_1 actually comes from a different domain (the time synchronization domain 12_1) that uses a different precision time protocol profile. In other words, Figure 5A As shown by the dotted line, the time of the master clock 14_1 is transmitted from the time synchronization domain 12_1, and reaches the time synchronization domain 12_2 through the time synchronization device 50. However, for the time synchronization domain 12_2, the received time is the time of the virtual master clock 50, as shown in FIG. Figure 5B As shown by the dotted line in the middle, the problem of time synchronization failure caused by the verification mechanism is avoided.
[0041] exist Figure 5A , Figure 5B In the embodiment, the time synchronization network system 5 uses a single time synchronization device 50, and according to the time synchronization process 40, all time synchronization domains connected to the time synchronization device 50 can operate according to the time of the same master clock, thereby achieving time synchronization. A person skilled in the art can make appropriate modifications according to the actual needs of the system, but is not limited thereto. For example, please refer to Fig. 6A , Fig. 6A FIG. 6 is a schematic diagram of a time synchronization network system 6 according to an embodiment of the present invention. In this embodiment, the time synchronization network system 6 uses two time synchronization devices 50 and 60 to synchronize the time of the time synchronization domains 12_1 to 12_3.
[0042] like Fig. 6A As shown, the time synchronization device 60 establishes the PT instances 68_2-68_3 to connect to the time synchronization domains 12_2-12_3 through the connection ports 66_2-66_3 according to the PT profiles B and C. The time synchronization device 60 receives the clock information of the master clock 14_1 through the time receiving port 66_2 (labeled as S) according to the PT profile B. After the time synchronization device 60 performs information conversion on the clock information, it transmits the clock information to the time synchronization domain 12_3 through the time transmission port 66_3 (labeled as M) according to the PT profile C.
[0043] For the devices or equipment in the time synchronization domain 12_3, the time synchronization device 60 and the time synchronization domain 12_3 form a precision time agreement domain C, such as Fig. 6AAs shown. The time synchronization device 60 operates as a virtual master clock, and for the time synchronization domain 12_3, the time synchronization device 60 can be regarded as a master clock existing in the same domain. Therefore, the devices in the time synchronization domain 12_3 may not perceive that the master clock 14_1 actually comes from a different domain (time synchronization domain 12_1) using a different precision time protocol profile. Please refer to Figure 6B , Figure 6B for Fig. 6A Another schematic diagram of the time synchronization network system 6 in FIG. Fig. 6A As shown by the dotted line, the time of the master clock 14_1 is transmitted from the time synchronization domain 12_1, passes through the time synchronization device 50, the time synchronization domain 12_2 and the time synchronization device 60, and finally reaches the time synchronization domain 12_3. However, for the time synchronization domain 12_3, the received time is the time of the virtual master clock 60, as shown in FIG. Figure 6B Shown by the dashed line.
[0044] In the above-mentioned embodiment, the master clock is determined by the time synchronization device through BMCA, and whether each port of the time synchronization device is a time transmission port or a time receiving port is determined according to whether a precision time protocol message (such as Sync or Follow_Up) related to the master clock is received. However, in one embodiment, the time synchronization network system 2 may further include a management device that can determine the master clock. The management device can determine the master clock of the time synchronization network system 2, and can also determine and configure each port of the time synchronization device as a time transmission port or a time receiving port according to an external port configuration method defined by the precision time protocol standard. In this embodiment, the time synchronization device can directly skip steps 402 and 406 of the time synchronization process 40, and can check each port to determine whether to modify the clock attribute corresponding to the port. If the port is a time receiving port, the corresponding precision time protocol instance can retain the original clock attribute (step 410); if the port is a time transmission port, the time synchronization device can update the clock attribute of the corresponding precision time protocol instance with the clock information of the master clock (step 408). Finally, time synchronization may be performed as described in step 412 .
[0045] In the above embodiment, the master clock is a clock in the time synchronization domain 12_1~12_3, and the time synchronization device determines whether to modify its clock information according to whether each connection port corresponding to the precision time protocol instance 18_1~18_3 is a time receiving port or a time transmitting port. In another embodiment, a clock of the time synchronization device may be the master clock. In other words, the time synchronization device may select the master clock from the best clock 14_1~14_3 and the clock of the time synchronization device. In this case, the master clock may not belong to any time synchronization domain connected to the time synchronization device, but time synchronization can still be performed according to the time synchronization process 40.
[0046] Please refer to Figure 7 , Figure 7 FIG. 7 is a schematic diagram of a time synchronization network system 7 according to an embodiment of the present invention. The time synchronization network system 7 includes time synchronization domains 12_1 to 12_3 and a time synchronization device 70. Figure 7 As shown, the time synchronization device 7 establishes the PT instances 78_1-78_3 to connect to the time synchronization domains 12_1-12_3 through the ports 76_1-76_3 respectively according to the PT profiles A-C. In this embodiment, the time synchronization network system 7 uses a clock 74 of the time synchronization device 70 as the master clock and synchronizes the time of the time synchronization domains 12_1-12_3 accordingly. According to the time synchronization process 40, the time synchronization device 70 selects the clock 74 as the master clock in step 402, and then updates the clock information of the master clock in step 404. It should be noted that the master clock 74 does not belong to any of the time synchronization domains 12_1-12_3, and the time information of the master clock 74 needs to be transmitted to all the time synchronization domains 12_1-12_3. Therefore, in this embodiment, the time synchronization device 70 should determine all the ports 76_1-76_3 as time transmission ports (marked as M). In addition, since the master clock 74 is located in the time synchronization device 70, the PT instances 78_1-78_3 can use the original clock attributes to transmit PT messages without modification. In other words, the time synchronization device 70 can skip steps 406 to 410 to determine all the connection ports 76_1-76_3 as time transmission ports, and directly execute step 412 to perform time synchronization. Similar to the above embodiment, in step 412, the time synchronization device 70 can convert the clock information of the master clock 74 according to different PT profiles A-C, and transmit the clock information to the time synchronization domains 12_1-12_3 respectively.
[0047] For further information, please refer to Figure 8, which is a schematic diagram of a network device 8 according to an embodiment of the present invention. The network device 8 may be, but is not limited to, a network device such as a gateway, a switch, a router, and a bridge running in a time synchronization domain, and is used to implement the time synchronization devices 10, 50, 60, and 70. Figure 8 As shown, the network device 8 may include a processing unit 80 and a storage unit 82. The processing unit 80 may be a microprocessor or an application specific integrated circuit (ASIC). The storage unit 82 may be any type of data storage device for storing a program code 820, and the program code 820 is read and executed by the processing unit 80. For example, the storage unit 82 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, but is not limited thereto.
[0048] The network device 8 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 network device 8 is used to implement the time synchronization device, the time synchronization process 40 can be compiled into a program code 820, and stored in the storage unit 82 for execution by the processing unit 80. In addition, the storage unit 82 is also used to store the clock information 20 and the data required when the time synchronization method is running, but is not limited to this.
[0049] In the existing industrial automation field, it is preferred that all devices or equipment can be synchronized with a master clock that is preset or expected by the manufacturer. Even in an environment where multiple different precision time protocol profiles are used at the same time, it is still hoped that all devices or equipment using different precision time protocol profiles can be synchronized with the same master clock at the application level. However, the operation mode of the time synchronization mechanism inside different precision time protocol profiles is different. In order to ensure that all devices or equipment can correctly select the designated master clock for time synchronization, manufacturers have adopted various verification mechanisms, which makes time synchronization across different time synchronization domains difficult. Therefore, the purpose of the virtual master clock provided by the present invention is to enable the time synchronization device to synchronize devices and equipment using different precision time protocol profiles with the master clock as if they were synchronized using the same precision time protocol profile in the same time synchronization domain. In other words, the device or equipment may think that it is performing time synchronization based on the master clock in the same time synchronization domain using the same precision time protocol profile. Therefore, there will be no information errors caused by crossing different precision time protocol profiles, and there will be no verification failures that may be caused by crossing different precision time protocol profiles. Accordingly, all devices or equipment can be synchronized to the same master clock at the application level.
[0050] In summary, the present invention provides a time synchronization method and device, wherein the time synchronization device can operate as a virtual master clock, so that problems caused by various verification mechanisms can be overcome when performing time synchronization across network domains. The above descriptions are only preferred embodiments of the present invention. All equivalent changes and modifications made according to the claims of the present invention shall fall within the protection scope of the present invention.
Claims
1. A time synchronization method, characterized in that: For a time synchronization device, wherein the time synchronization device runs a plurality of precision time protocol instances to connect to a plurality of time synchronization domains through a plurality of ports, the time synchronization method comprises: Obtaining a master clock from the plurality of time synchronization domains; Updating clock information of the master clock; According to the master clock, each of the plurality of connection ports is determined to be a time receiving port or a time transmitting port; modifying a clock property of each of the plurality of PT instances for the time receiving port or the time sending port according to a corresponding port; and The plurality of precision time protocol instances synchronize the time of the plurality of time synchronization domains according to the master clock.
2. The time synchronization method according to claim 1, characterized in that: The plurality of time synchronization domains use different types of precision time protocol profiles.
3. The time synchronization method according to claim 2, characterized in that: Each of the plurality of PT instances uses a PT profile of the same type as the corresponding time synchronization domain.
4. The time synchronization method according to claim 1, characterized in that: The step of obtaining the master clock from the plurality of time synchronization domains is to select the master clock from a best clock of each of the plurality of time synchronization domains, and the best clock of each of the plurality of time synchronization domains is determined according to a best master clock algorithm.
5. The time synchronization method according to claim 4, characterized in that: The master clock is selected by comparing the priority vector of the best clock of each of the plurality of time synchronization domains.
6. The time synchronization method according to claim 1, characterized in that: The clock attribute at least includes a clock identification code.
7. The time synchronization method according to claim 1, characterized in that: The step of determining each of the plurality of ports as the time receiving port or the time transmitting port according to the master clock comprises: When a clock of the time synchronization device is the master clock, each of the plurality of connection ports is determined to be the time transmission port.
8. The time synchronization method according to claim 7, characterized in that: The step of modifying the clock attribute of each of the plurality of PT instances according to the corresponding port being the time receiving port or the time transmitting port comprises: The original properties of each PT instance of the plurality of PT instances corresponding to the time transfer port are retained.
9. The time synchronization method according to claim 1, characterized in that: The step of determining each of the plurality of ports as the time receiving port or the time transmitting port according to the master clock comprises: When running in single-step mode, in response to a first port of the plurality of ports receiving a precision time protocol synchronization message related to the master clock, determining the first port as the time receiving port, and determining the remaining ports of the plurality of ports as the time transmitting ports; as well as When running the dual-step mode, in response to a first port of the plurality of ports receiving a precision time protocol synchronization message and a precision time protocol follow-up message related to the master clock, the first port is determined to be the time receiving port, and the remaining ports of the plurality of ports are determined to be the time sending ports.
10. The time synchronization method according to claim 9, characterized in that: The step of modifying the clock attribute of each of the plurality of PT instances according to the corresponding port being the time receiving port or the time transmitting port comprises: updating the clock attribute of each PT instance of the plurality of PT instances corresponding to the time transfer port with the clock attribute of the master clock; and The original properties of each PT instance in the plurality of PT instances corresponding to the time receiving port are retained.
11. The time synchronization method according to claim 1, characterized in that: The master clock is determined externally, and according to the master clock, the step of determining each of the plurality of ports as the time receiving port or the time transmitting port is determined by an external port configuration method.
12. The time synchronization method according to claim 11, characterized in that: The step of modifying the clock attribute of each of the plurality of PT instances according to the corresponding port being the time receiving port or the time transmitting port comprises: updating the clock attribute of each PT instance of the plurality of PT instances corresponding to the time transfer port with the clock attribute of the master clock; and The original properties of each PT instance in the plurality of PT instances corresponding to the time receiving port are retained.
13. The time synchronization method according to claim 1, characterized in that: The step of synchronizing the time of the plurality of time synchronization domains according to the master clock of the plurality of precision time protocol instances comprises: Each of the plurality of PT instances corresponding to the time transfer port transmits a PT message having clock information of the master clock to a corresponding time synchronization domain.
14. The time synchronization method according to claim 13, characterized in that: Also includes: Modify at least one of the following PTP message fields: A correction value field in a precision time protocol synchronization message and a precision time protocol follow-up message; A frequency ratio estimate field in a precision time protocol synchronization message and a precision time protocol follow-up message; A local delivery hop count field in a precision time protocol announcement message; as well as A path tracking array field in a PSTP publication message.
15. A time synchronization device, characterized in that: Used to run multiple instances of the Precision Time Protocol to connect multiple time synchronization domains through multiple ports, including: a processing unit for executing a program code; as well as A storage unit, coupled to the processing unit, is used to store the program code to instruct the processing unit to execute a time synchronization method, the time synchronization method comprising: Obtaining a master clock from the plurality of time synchronization domains; Updating clock information of the master clock; According to the master clock, each of the plurality of connection ports is determined to be a time receiving port or a time transmitting port; modifying a clock property of each of the plurality of PT instances for the time receiving port or the time sending port according to a corresponding port; and The plurality of precision time protocol instances synchronize the time of the plurality of time synchronization domains according to the master clock.
16. The time synchronization device according to claim 15, characterized in that: The plurality of time synchronization domains use different types of precision time protocol profiles.
17. The time synchronization device according to claim 16, characterized in that: Each of the plurality of PT instances uses a PT profile of the same type as the corresponding time synchronization domain.
18. The time synchronization device according to claim 15, characterized in that: The step of obtaining the master clock from the plurality of time synchronization domains is to select the master clock from a best clock of each of the plurality of time synchronization domains, and the best clock of each of the plurality of time synchronization domains is determined according to a best master clock algorithm.
19. The time synchronization device according to claim 18, characterized in that: The master clock is selected by comparing the priority vector of the best clock of each of the plurality of time synchronization domains.
20. The time synchronization device according to claim 15, characterized in that: The clock attribute at least includes a clock identification code.
21. The time synchronization device according to claim 15, characterized in that: The step of determining each of the plurality of ports as the time receiving port or the time transmitting port according to the master clock comprises: When a clock of the time synchronization device is the master clock, each of the plurality of connection ports is determined to be the time transmission port.
22. The time synchronization device according to claim 21, characterized in that: The step of modifying the clock attribute of each of the plurality of PT instances according to the corresponding port being the time receiving port or the time transmitting port comprises: The original properties of each PT instance of the plurality of PT instances corresponding to the time transfer port are retained.
23. The time synchronization device according to claim 15, characterized in that: The step of determining each of the plurality of ports as the time receiving port or the time transmitting port according to the master clock comprises: When running in single-step mode, in response to a first port of the plurality of ports receiving a precision time protocol synchronization message related to the master clock, determining the first port as the time receiving port, and determining the remaining ports of the plurality of ports as the time transmitting ports; as well as When running the dual-step mode, in response to a first port of the plurality of ports receiving a precision time protocol synchronization message and a precision time protocol follow-up message related to the master clock, the first port is determined to be the time receiving port, and the remaining ports of the plurality of ports are determined to be the time sending ports.
24. The time synchronization device according to claim 23, characterized in that: The step of modifying the clock attribute of each of the plurality of PT instances according to the corresponding port being the time receiving port or the time transmitting port comprises: updating the clock attribute of each PT instance of the plurality of PT instances corresponding to the time transfer port with the clock attribute of the master clock; and The original properties of each PT instance in the plurality of PT instances corresponding to the time receiving port are retained.
25. The time synchronization device according to claim 15, characterized in that: The master clock is determined externally, and according to the master clock, the step of determining each of the plurality of ports as the time receiving port or the time transmitting port is determined by an external port configuration method.
26. The time synchronization device according to claim 25, characterized in that: The step of modifying the clock attribute of each of the plurality of PT instances according to the corresponding port being the time receiving port or the time transmitting port comprises: updating the clock attribute of each PT instance of the plurality of PT instances corresponding to the time transfer port with the clock attribute of the master clock; and The original properties of each PT instance in the plurality of PT instances corresponding to the time receiving port are retained.
27. The time synchronization device according to claim 15, characterized in that: The step of synchronizing the time of the plurality of time synchronization domains according to the master clock of the plurality of precision time protocol instances comprises: Each of the plurality of PT instances corresponding to the time transfer port transmits a PT message having clock information of the master clock to a corresponding time synchronization domain.
28. The time synchronization device according to claim 27, characterized in that: The time synchronization method further comprises modifying at least one of the following precision time protocol message fields: A correction value field in a precision time protocol synchronization message and a precision time protocol follow-up message; A frequency ratio estimate field in a precision time protocol synchronization message and a precision time protocol follow-up message; A local delivery hop count field in a precision time protocol announcement message; as well as A path tracking array field in a PSTP publication message.