The present invention relates to a method and a device for time synchronization, and more particularly, to a method and a device for time synchronization in multiple time synchronization network domains.
Precision Time Protocol (PTP) is a standard for time synchronization defined by IEEE 1588, and is used to achieve high-precision time synchronization throughout a time-critical network. As the market evolves, different network applications have unique requirements. To address this, many different PTP profiles have been proposed for different applications, such as Power Profile (IEEE Std C37.238) for power networks, Telecom Profile (ITU-T G.8265.1) for telecommunication networks, and Generalized Precision Time Protocol (gPTP, IEEE Std 802.1AS). PTP profiles allow applications in different fields to set specific operating parameters, attributes, and default values to meet their requirements. However, this can make it difficult for devices and networks using different PTP profiles to communicate effectively. In general, in order to ensure time synchronization, apparatuses or devices in the same environment must use the same PTP profile, making cross-domain time integration challenging.
The conventional technology integrates multiple types of PTP profiles through a time gateway so that different time synchronization domains or devices using different types of PTP profiles may synchronize time according to one grandmaster (GM) clock thereof. Accordingly, time synchronization is achieved between time synchronization domains with different types of PTP profiles.
However, when performing time synchronization, various profiles or machines may employ different verification mechanisms. Thus, during time synchronization across network domains with different types of PTP profiles, the time synchronization method may not operate smoothly due to different verification mechanisms.
The present invention therefore provides a method and a device for successfully passing the verification mechanism when synchronizing time across multiple devices or network domains that use different types of PTP profiles, so as to overcome the shortcoming of the prior art.
An embodiment of the present invention discloses a time synchronization method for a time synchronization device, where the time synchronization device runs a plurality of Precision Time Protocol (PTP) instances to connect to a plurality of time synchronization domains through a plurality of ports. The time synchronization method includes obtaining a grandmaster (GM) clock from the plurality of time synchronization domains; updating clock information of the grandmaster clock; determining whether each of the plurality of ports is a time receiving port or a time transmitting port according to the grandmaster clock; modifying clock attributes of each of the plurality of PTP instances according to whether the corresponding port is the time receiving port or the time transmitting port; and synchronizing, by the plurality of PTP instances, timings of the plurality of time synchronization domains according to the grandmaster clock.
An embodiment of the present invention further discloses a time synchronization device. The time synchronization device is configured to run a plurality of PTP instances to connect to a plurality of time synchronization domains through a plurality of ports, and includes a processing unit and a storage unit. The processing unit is configured to execute a program code. The storage unit, coupled to the processing unit, is configured to store the program code to instruct the processing unit to execute a time synchronization method. The time synchronization method includes obtaining a grandmaster clock from the plurality of time synchronization domains; updating clock information of the grandmaster clock; determining whether each of the plurality of ports is a time receiving port or a time transmitting port according to the grandmaster clock; modifying clock attributes of each of the plurality of PTP instances according to whether the corresponding port is the time receiving port or the time transmitting port; and synchronizing, by the plurality of PTP instances, timings of the plurality of time synchronization domains according to the grandmaster clock.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
Certain terms are used throughout the description and following claims to refer to particular components. As one skilled in the art will appreciate, hardware manufacturers may refer to a component by different names. This document does not intend to distinguish between components that differ in name but not function. In the following description and in the claims, the terms “include” and “comprise” are utilized in an open-ended fashion, and thus should be interpreted to mean “include, but not limited to”.
Please refer to
It should be noted that, since the time synchronization domains 12_1-12_3 operate time synchronization mechanisms according to different PTP profiles A-C, cross-domain integration for time synchronization cannot be performed in general. In this situation, each time synchronization domain may have an optimal clock (such as the optimal clocks 14_1-14_3 in
To address the above issues, the conventional technology integrates multiple types of PTP profiles through a time synchronization device so that different time synchronization domains or devices using different types of PTP profiles may synchronize time according to a grandmaster (GM) clock thereof, which realizing the cross-domain time synchronization.
Please refer to
As shown in
In the present embodiment, the time synchronization device 10 builds PTP instances 18_1-18_3 for the ports 16_1-16_3 respectively so as to process the time synchronization for the time synchronization domains 12_1-12_3. Each PTP instance of the PTP instances 18_1-18_3 should use the same type of PTP profile corresponding to the time synchronization domain connected by the corresponding port. For example, the PTP instance 18_1 for the port 16_1 uses the PTP profile A to communicate with the time synchronization domain 12_1, the PTP instance 18_2 for the port 16_2 uses the PTP profile B to communicate with the time synchronization domain 12_2, and the PTP instance 18_3 for the port 16_3 uses the PTP profile C to communicate with the time synchronization domain 12_3. Accordingly, each of the PTP instances 18_1-18_3 serves as a communication medium between the time synchronization device 10 and the time synchronization domains 12_1-12_3 according to the corresponding PTP profiles A-C, and the time synchronization device 10 is capable of exchanging PTP messages with the connected time synchronization domains 12_1-12_3. In other words, each of the PTP instances 18_1-18_3 operates according to the PTP profile used by the corresponding time synchronization domain and runs as one node of the corresponding time synchronization domain.
Take the time synchronization network system 2 in
In practice, devices produced by various manufacturers and devices using different types of PTP profiles may have different verification mechanisms when performing time synchronization. Due to the different verification mechanisms, the PTP messages carrying the clock information may be rejected and thus the time synchronization may not be operated successfully. Therefore, the time synchronization device 10 in the embodiment of the present invention runs as a virtual grandmaster clock according to a time synchronization method, so that all devices in the time synchronization network system 2 may regard the time synchronization device 10 as a grandmaster clock running in the same time synchronization domain. The time synchronization method may be summarized into a time synchronization process 40 shown in
Step 400: Start.
Step 402: Obtain a grandmaster clock from a plurality of time synchronization domains.
Step 404: Update clock information of the grandmaster clock.
Step 406: Determine whether each of the plurality of ports is a time receiving port or a time transmitting port according to the grandmaster clock. If the port is the time transmitting port, proceed to Step 408; otherwise, proceed to Step 410.
Step 408: Update the clock attributes of the PTP instance corresponding to the port with the clock attributes of the grandmaster clock.
Step 410: Keep the original clock attributes of the PTP instance corresponding to the port.
Step 412: Perform time synchronization.
Step 414: Determine whether the connection to the grandmaster clock is disconnected. If yes, proceed to Step 418; otherwise, proceed to Step 416.
Step 416: Determine whether better clock information is received. If yes, proceed to Step 418; otherwise, proceed to Step 412.
Step 418: Reset the PTP instances corresponding to other ports.
According to the time synchronization process 40, the time synchronization device 10 first determines a new grandmaster clock from the time synchronization domains 12_1-12-3 for the time synchronization network system 2 (Step 402), and then updates the clock information of the grandmaster clock comprising the clock ID (clockIdentity) of the grandmaster clock (Step 404). Next, the time synchronization device 10 checks each port of the ports 16_1-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 the time receiving port, the corresponding PTP instance may keep the original clock attributes (Step 410); if the port is the time transmitting port, the time synchronization device 10 may update the clock attributes of the corresponding PTP instance with the clock information of the grandmaster clock (Step 408). Finally, the time synchronization device 10 performs time synchronization (Step 412), and keeps monitoring the connection of the grandmaster clock (Step 414). If the connection to the grandmaster clock is disconnected, the time synchronization device 10 resets the PTP instances (Step 418) and reselects a new grandmaster clock for the time synchronization network system 2 (Step 402). During the processes, the PTP instances 18_1-18_3 continuously listen to the PTP messages. If one of the PTP instances receives a PTP Announce message with a new clock better than the corresponding optimal clock (Step 416), the time synchronization device 10 may reset the other PTP instances (Step 418) and reselect a new grandmaster clock for the time synchronization network system 2 (Step 402). Accordingly, the time synchronization device 10 integrates the time for all devices in the time synchronization network system 2.
Referring to
According to the time synchronization process 40, in Step 402, the time synchronization device 10 obtains the grandmaster clock from time synchronization domains 12_1-12_3. Specifically, the time synchronization device 10 may select the grandmaster clock from the optimal clocks 14_1-14_3 by comparing priority vectors of the clocks, and the optimal clocks 14_1-14_3 are determined according to a best master clock algorithm (BMCA) or designated manually. The priority vectors of clocks are included in the clock information and received by the PTP instances 18_1-18_3 via PTP message. The time synchronization device 10 determines a best clock among the optimal clocks 14_1-14_3 to be the grandmaster clock.
In Step 404, the time synchronization device 10 updates the clock information of the grandmaster clock 20 with the clock information of the grandmaster clock 14_1. The clock information comprises the capability information, time and clock ID as mentioned above and is not limited thereto. The time synchronization device 10 may perform information conversion on the clock information of the grandmaster clock 14_1 according to different PTP profiles. For example, the clock information of the grandmaster clock 14_1 may be converted to comply with the format of the PTP profiles B and C and passed to the PTP instances 18_2 and 18_3 respectively.
In Step 406, the time synchronization device 10 determines whether each of the plurality of ports is a time receiving port or a time transmitting port according to the receiving PTP messages. Specifically, PTP standard supports two modes of operations: one-step mode and two-step mode. In the one-step mode, a transmission timestamp is updated in time and carried in the sync message on the fly, which is a hardware-based method and requires fewer messages. In the two-step mode, in addition to a sync message, an additional follow-up message containing transmission time of the preceding message is transmitted, which is software-proceeded method. In the present embodiment, both of the one-step mode and the two-step mode are applicable. In the present embodiment, while operating with the one-step mode, the port receiving the PTP messages Sync is determined to be the time receiving port; otherwise, it is determined to be the time transmitting port. On the other hand, while operating with the two-step mode, the port receiving the PTP messages Sync or Follow_Up is determined to be the time receiving port; otherwise, it is determined to be the time transmitting port. Therefore, the port 16_1 is the time receiving port because it receives the Sync message in the one-step mode or it receives the Sync message or the Follow_Up message in the two-step mode from the time synchronization domain 12_1, and the ports 16_2 and 16_3 are the time transmitting ports.
In Steps 408 and 410, the time synchronization device 10 modifies the clock attributes of each of the PTP instances 18_1-18_3 according to whether the corresponding port is the time receiving port or the time transmitting port. The time synchronization device 10 updates the clock attributes such as the clock IDs of the PTP instances 18_2 and 18_3 corresponding to the time transmitting ports 16_2 and 16_3 with the clock attributes of the grandmaster clock 14_1, and thereby the PTP instances 18_2 and 18_3 may send PTP message with the clock attributes such as the clock ID of grandmaster clock 14_1 via the time transmitting ports 16_2 and 16_3. In other words, the PTP messages sent by the PTP instances 18_2 and 18_3 are just like the PTP messages sent by the grandmaster clock 14_1, and the time synchronization device 10 may be regarded as the grandmaster clock for the devices in the time synchronization domains 12_2 and 12_3. In addition, the clock attributes of the PTP instance 18_1 may be kept because the corresponding port 16_1 is the time receiving port that is responsible for receiving the clock information of the grandmaster clock 14_1.
In Step 412, the time synchronization device 10 performs time synchronization. Specifically, the PTP instances 18_2 and 18_3 corresponding to the time transmitting ports 16_2 and 16_3 may transmit PTP messages with the clock information of the grandmaster clock 14_1 obtained from the PTP instance 18_1 corresponding to the time receiving port 16_1. The clock information is converted by the time synchronization device 10 according to the PTP profiles B and C respectively and thus available for the time synchronization domains 12_2 and 12_3.
As mentioned above, the time synchronization device 10 connects three time synchronization domains 12_1-12_3 using different PTP profiles, where the time synchronization device 10 receives information from the grandmaster clock 14_1 of the time synchronization domain 12_1 and plays a role of grandmaster clock in the time synchronization domains 12_2 and 12_3. As a virtual grandmaster clock for the time synchronization domains 12_2 and 12_3, the time synchronization device 10 may send PTP messages using the information of the grandmaster clock 14_1 such as the clock ID, so that the devices in the time synchronization domains 12_2 and 12_3 may regard the time synchronization device 10 as the grandmaster clock 14_1 and synchronize the time therewith. Furthermore, the time synchronization device 10 may further modify some specific fields in the PTP messages to overcome the various verification mechanisms for the grandmaster clock designed by different manufacturers. For example, the fields such as “correctionField” or “cumulativeRateRatio” in PTP Sync and Follow_Up messages may be reset to 0; the field “localStepsRemoved” of PTP Announce message may be assigned the value of 0; the “pathTrace” array of the PTP Announce TLV may only keep the clock ID of the grandmaster 14_1. According to different verification mechanisms, different fields in PTP messages may need to be modified and are not limited thereto. It should be noted, although the time synchronization device 10 achieves the effect of running like a virtual grandmaster clock by modifying the PTP message content, there are some specific message fields that need to be used to communicate with the connected device and 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 may synchronize the time with the grandmaster clock 14_1 according to the content of the PTP messages received from the time synchronization device 10.
In Steps 414 to 418, the time synchronization device 10 keeps monitoring the PTP messages from the time synchronization domains 12_1-12_3. It is possible that the grandmaster clock 14_1 fails or a clock better than the grandmaster clock 14_1 appears during the time synchronization process 40, and the time synchronization device 10 may reset the PTP instances and reselect a new grandmaster clock for the time synchronization network system 2 in these situations. In Step 414, when losing the connection with the grandmaster clock 14_1, the time synchronization device 10 may reset the PTP instances 18_1-18_3 and then start to select a new grandmaster clock in Step 402. In Step 416, if one of the PTP instances 18_1-18_3 receives a PTP Announce message of a clock better than the corresponding optimal clock, the time synchronization device 10 may reset the other PTP instances and start to select a new grandmaster clock in Step 402. For example, if the PTP instance 18_3 receives a PTP Announce message of a clock better than the optimal clock 14_3, the time synchronization device 10 may reset the PTP instance 18_1 and 18_2 and reselect the grandmaster clock according to Step 402.
Accordingly, the time synchronization device 10 runs as a virtual grandmaster clock so that the devices in the time synchronization domains 12_2 and 12_3 may consider the time synchronization device 10 to be the grandmaster clock 14_1 and synchronize time therewith.
Please refer to
For devices in the time synchronization domain 12_2, the time synchronization device 50 and the time synchronization domain 12_2 form a PTP domain B as shown in
In
As shown in
For devices in the time synchronization domain 12_3, the time synchronization device 60 and the time synchronization domain 12_3 form a PTP domain C as shown in
In the above embodiment, the grandmaster clock is determined by the time synchronization device through the BMCA, and whether each port of the time synchronization device is a time transmitting port or a time receiving port is determined based on whether a PTP message (such as Sync or Follow_Up) related to the grandmaster clock is received. However, in an embodiment, the time synchronization network system 2 may further comprise a management device that is capable of determining the grandmaster clock. The management device may determine the grandmaster clock of the synchronization network system 2 and then determine and configure each port of the time synchronization device to be a time transmitting port or a time receiving port through an external port configuration method defined in PTP standard accordingly. In the embodiment, Step 402 and Step 406 may be skipped by the time synchronization device, and then the time synchronization device may check each port to determine whether to modify the clock attributes corresponding to the port. If the port is the time receiving port, the corresponding PTP instance may keep the original clock attributes (Step 410); if the port is the time transmitting port, the time synchronization device 10 may update the clock attributes of the corresponding PTP instance with the clock information of the grandmaster clock (Step 408). Finally, time synchronization is performed as mentioned in Step 412.
In the above embodiment, the grandmaster clock is a clock in the time synchronization domains 12_1-12_3, and the time synchronization device determines whether to modify the clock attributes of the PTP instances 18_1-18_3 according to whether the corresponding port is the time receiving port or the time transmitting port. In another embodiment, a clock of the time synchronization device may be the grandmaster clock; in other words, the time synchronization device may select the grandmaster clock among the optimal clocks 14_1-14_3 and the clock of the time synchronization device. In this situation, the grandmaster clock may not belong to any time synchronization domain connected to the time synchronization device, and the time synchronization may still be performed according to the time synchronization process 40.
Please refer to
Furthermore, please refer to
The network device 8 is used to represent the necessary components required to implement the embodiments of the present invention, and those skilled in the art may make various modifications and adjustments accordingly, and is not limited to this. For example, when the network device 8 is applied to implement the time synchronization device, the time synchronization process 40 may be complied into the program code 820, stored in the storage unit 82, and executed by the processing unit 80. Moreover, the storage unit 82 is also used for storing the clock information 20 and data required for running the time synchronization method, and is not limited thereto.
In the current industrial automation field, all machines are tending to be able to synchronize time with a grandmaster clock that is preset or expected by the manufacturer. Even in an environment with various PTP profiles, it is still hoped that all machines using different PTP profiles can be synchronized to the same grandmaster clock at the application level. However, the internal operation mechanisms of time synchronization for the different PTP profiles are not always the same. In order to ensure that all machines can correctly select the designated grandmaster clock for time synchronization, various verification mechanisms are applied by the manufacturers, thus hindering cross-domain time synchronization. Therefore, the virtual grandmaster clock provided by the present invention aims at allowing the time gateway to synchronize machines using different PTP profiles with the grandmaster clock just like synchronization in the same time synchronization domain using the same PTP profile. In other words, the devices may suppose that it is synchronizing time with the grandmaster clock in the same domain using the same PTP profile directly. Therefore, there will be no information errors caused by crossing different PTP profiles, nor will the verification process fail due to crossing domains using different PTP profiles. Accordingly, all machines are able to synchronize with the same grandmaster clock at the application level.
In summary, the present invention provides a method and a device for time synchronization, where a time synchronization device may run as a virtual grandmaster clock, so that the cross-domain time synchronization may overcome the problem caused by various verification mechanisms.
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.
This application claims the benefit of U.S. Provisional Application No. 63/544,644, filed on Oct. 18, 2023. The content of the application is incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
63544644 | Oct 2023 | US |