Method for synchronizing time of multiple time domains, computing device and storage medium
By leveraging the Precision Time Protocol (PTP) and offset clock layer between master and slave nodes, the problem of increased hardware costs associated with multiple time-domain synchronization in existing technologies is solved, achieving stable and flexible multi-time-domain synchronization suitable for vehicular networks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HYUNDAI AUTOEVER
- Filing Date
- 2022-12-13
- Publication Date
- 2026-06-05
AI Technical Summary
The existing Precision Time Protocol (PTP) standard does not include a specification for multiple time domain synchronization, which requires additional hardware to synchronize multiple time domains in a network, increasing costs and resource consumption.
By working together the Precision Time Protocol (PTP) layer and the offset clock layer between the master and slave nodes, time synchronization across multiple time domains is achieved. This includes the master node transmitting the base time and offset value to the slave node and adjusting the slave node's hardware clock to synchronize the time across multiple time domains.
It achieves stable and flexible time synchronization across multiple time domains without adding hardware, supports multi-time domain vehicle networks, and reduces costs and resource consumption.
Smart Images

Figure CN116266774B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for synchronizing time in multiple time domains and an apparatus for implementing the method, and more particularly to a method for synchronizing time in multiple time domains among multiple nodes constituting a network and an apparatus for implementing the method. Background Technology
[0002] Network Time Protocol (NTP) is a network protocol used to synchronize clocks between computer systems via packet switching and variable delay time data networks.
[0003] Precision Time Protocol (PTP) is a protocol that uses a master-slave hierarchy to synchronize the clocks of network devices. It can use hardware timestamps to provide a higher level of clock accuracy compared to Network Time Protocol (NTP), thereby synchronizing clocks to an accuracy of less than 1 microsecond.
[0004] Precision Time Protocol (PTP) uses a master and slave hierarchy similar to Network Time Protocol (NTP). The most accurate clock available is called the master clock, and slave devices use signals from the master device to synchronize their own clocks.
[0005] The Precision Time Protocol (PTP) defined in the existing 802.1AS-2011 (Generalized Precision Time Protocol, gPTP) standard does not include multiple time-domain synchronization-related specifications.
[0006] In existing Precision Time Protocols (PTP), where the entire network operates within a single time domain, when nodes in the network require multiple time zones, time synchronization is achieved by physically reconfiguring the network by adding separate hardware devices. Therefore, using PTP to synchronize time across multiple time domains results in significant cost and resource consumption.
[0007] Therefore, there is a need for a method to synchronize time across multiple time domains in an existing network without adding separate hardware, but solely through software functionality. Summary of the Invention
[0008] The technical problem to be solved by the present invention is to provide a method for synchronizing time in multiple time domains between a master node and a slave node using a Precise Time Protocol (PTP), and an apparatus for implementing the method.
[0009] Another technical problem that this invention aims to solve is to provide a method for synchronizing time in multiple time domains using a new Precision Time Protocol (PTP) standard that adds multiple time-domain synchronization-related specifications not included in the existing 802.1AS-2011 (Generalized Precision Time Protocol, gPTP) standard, as well as an apparatus for implementing the method.
[0010] Another technical challenge that this invention aims to address is to provide a method for synchronizing time in multiple time domains that can stably and flexibly construct an in-vehicle network supporting multiple time domains when implementing an autonomous driving platform, as well as an apparatus for implementing the method.
[0011] The technical issues of this invention are not limited to those mentioned above. Those skilled in the art will be able to further understand other technical issues not mentioned through the following description.
[0012] To address the aforementioned technical problem, an embodiment of the present invention provides a method for synchronizing the time of multiple time domains between a master node and a slave node, comprising: transmitting a reference time pointed to by the hardware clock of the master node to the precision time protocol (PTP) layer of the slave node; synchronizing the hardware clock of the slave node to the reference time pointed to by the hardware clock of the master node by the precision time protocol (PTP) layer of the slave node; transmitting an offset value (θ1) of a first time domain among the multiple time domains to the offset value clock layer of the slave node by the offset value clock layer of the master node; and applying the offset value (θ1) of the first time domain transmitted to the offset value clock layer of the slave node to the reference time pointed to by the hardware clock of the slave node, thereby obtaining the time of the first time domain by the precision time protocol (PTP) layer of the slave node.
[0013] As one embodiment, it may further include: transmitting the offset value (θ2) of the second time domain among the plurality of time domains from the offset value clock layer of the master node to the offset value clock layer of the slave node; and obtaining the time of the second time domain by applying the offset value (θ2) of the second time domain transmitted to the offset value clock layer of the slave node to the reference time pointed to by the hardware clock of the slave node.
[0014] As one embodiment, it may further include: setting the clock mode of each time domain of the offset clock layer to a master mode or a slave mode; and when the clock mode of the first time domain is set to the master mode in the offset clock layer of the master node, setting the clock mode of the first time domain to the slave mode in the offset clock layer of the slave node.
[0015] As an example, the offset clock layer provides the application layer, which is the upper-level layer of the offset clock layer, with interfaces for setting and obtaining time values of each time domain, setting and obtaining offset values of each time domain, and setting and obtaining clock modes of each time domain.
[0016] As an embodiment, it may further include: when the application layer of the master node calls the setTime(1,T) function, the precise time protocol (PTP) layer of the master node transmits the time value of the first time domain, i.e., T, to the precise time protocol (PTP) layer of the slave node; and when the application layer of the slave node calls the getTime(1) function, the time of the first time domain obtained in the precise time protocol (PTP) layer of the slave node is returned.
[0017] As an embodiment, it may further include: when the setOffset(1,θ1) function is called at the offset clock layer of the master node, the first time domain offset value, i.e. θ1, is transmitted to the offset clock layer of the slave node; and when the getOffset(1) function is called at the offset clock layer of the slave node, the transmitted first time domain offset value, i.e. θ1, is returned.
[0018] As an embodiment, it may further include: when the setMode(1) function is called in the offset clock layer of the master node, the step of setting the clock mode of the first time domain to master mode; the step of setting the clock mode of the first time domain of the slave node to slave mode; and the step of returning the set clock mode of the first time domain when the getMode(1) function is called in the offset clock layer.
[0019] As an example, the function calls for setting the time values of each time domain and setting the offset values of each time domain are executed only when the clock mode of each time domain in the offset value clock layer is the master mode.
[0020] As one embodiment, the master node and the slave node are respectively an electronic control unit (ECU) or a network switch.
[0021] To address the aforementioned technical issues, a computer-readable non-volatile storage medium according to an embodiment of the present invention may store a computer program for causing a computer to execute the method.
[0022] To address the aforementioned technical problem, a computing device for synchronizing time across multiple time domains between a master node and slave nodes, according to an embodiment of the present invention, includes: one or more processors; a communication interface for communicating with an external device; a memory for loading a computer program executed by the processor; and a storage device for storing the computer program; the computer program includes instructions for performing the following action: transmitting a reference time pointed to by the hardware clock of the master node to the slave node by the Precision Time Protocol (PTP) layer of the master node. The actions of the Precision Time Protocol (PTP) layer of the slave node; the actions of synchronizing the hardware clock of the slave node to the reference time pointed to by the hardware clock of the master node by the Precision Time Protocol (PTP) layer of the slave node; the actions of transmitting the offset value (θ1) of the first time domain in the plurality of time domains to the offset value clock layer of the slave node by the offset value clock layer of the master node; and the actions of applying the offset value (θ1) of the first time domain transmitted to the offset value clock layer of the slave node to the reference time pointed to by the hardware clock of the slave node and thereby obtaining the time of the first time domain by the Precision Time Protocol (PTP) layer of the slave node. Attached Figure Description
[0023] Figure 1 This is a system configuration diagram for synchronizing multiple time domains based on a Precise Time Protocol (PTP) according to an embodiment of the present invention.
[0024] Figure 2 This is an example illustrating the configuration of an in-vehicle network device to which an embodiment of the present invention is applied.
[0025] Figure 3 This is a flowchart illustrating a method for synchronizing time in multiple time domains between a master node and a slave node to which an embodiment of the present invention is applicable.
[0026] Figure 4 These are examples of calculating the propagation delay value generated when transmitting messages between a master node and a slave node, applicable to several embodiments of the present invention.
[0027] Figure 5 These are examples of several embodiments of the present invention that apply to synchronizing the hardware clock of the slave node to the reference time pointed to by the hardware clock of the master node.
[0028] Figure 6This is an example of calculating the offset values of each time domain and using the offset values to obtain the time of each time domain, according to several embodiments of the present invention.
[0029] Figure 7 This is a system configuration diagram for synchronizing multiple time domains using an offset clock layer based on a Precision Time Protocol (PTP) according to another embodiment of the present invention.
[0030] Figure 8 This is an example illustrating the configuration of an in-vehicle network device to which another embodiment of the present invention is applied.
[0031] Figure 9 This is a flowchart illustrating a method for synchronizing time in multiple time domains between a master node and a slave node to which another embodiment of the present invention applies.
[0032] Figure 10 This is a hardware configuration diagram of an exemplary computing device that can implement the methods applicable to several embodiments of the present invention. Detailed Implementation
[0033] The preferred embodiments of this disclosure will now be described in detail with reference to the accompanying drawings. The advantages and features of this disclosure, and the methods for achieving them, will become even clearer through the subsequent detailed descriptions of the embodiments in conjunction with the accompanying drawings. However, the technical concept of this disclosure is not limited to the following embodiments, but can be implemented in many different forms. The following embodiments are merely for the purpose of more completely disclosing the technical concept of this disclosure and for providing a more complete overview of the scope of this disclosure to those skilled in the art. The technical concept of this disclosure should only be defined within the scope of the claims.
[0034] It should be noted that, in assigning reference numbers to the constituent elements in the various figures, the same numbers are assigned to the same constituent elements as much as possible, even if they are shown in different figures. Furthermore, in describing this disclosure, detailed descriptions of related well-known components or functions will be omitted when it is determined that a detailed explanation of these components or functions may obscure the gist of this disclosure.
[0035] Unless otherwise defined, all terms (including technical and scientific terms) used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure pertains. Furthermore, unless explicitly defined otherwise, commonly used terms already defined in dictionaries should not be interpreted as having overly idealized or exaggerated meanings. The terminology used in this specification is for illustrative purposes only and is not intended to limit the scope of this disclosure. In this specification, singular statements also include plural meanings unless otherwise defined.
[0036] Furthermore, in describing the constituent elements of this disclosure, terms such as first, second, A, B, (a), and (b) may be used. The terms described above are merely used to distinguish the constituent elements from other constituent elements, and the nature, order, or sequence of the corresponding constituent elements are not limited by the terms. When a constituent element is described as being "connected," "combined," or "linked" to other constituent elements, the constituent element may be directly connected or linked to the other constituent elements; however, it should be understood that there may also be other constituent elements "connected," "combined," or "linked" between the constituent elements.
[0037] The following description will focus on several embodiments of the present disclosure with reference to the accompanying drawings.
[0038] Figure 1 This is a system configuration diagram for synchronizing multiple time domains based on a Precise Time Protocol (PTP), applicable to embodiments of the present invention. See also... Figure 1 The system of the present invention includes a network device based on Precision Time Protocol (PTP), namely a master node 11 and a slave node 12.
[0039] The master node 11 and slave node 12 include a Precision Time Protocol (PTP) layer for synchronizing the respective times of multiple time domains based on the Precision Time Protocol (PTP).
[0040] The Precise Time Protocol (PTP) layer 120 of node 12 calculates the propagation delay value generated when sending and receiving messages with master node 11, and uses the propagation delay value to synchronize the hardware clock of node 12 to the reference time pointed to by the hardware clock of master node 11.
[0041] Furthermore, the Precision Time Protocol (PTP) layer 120 of node 12 calculates the offset value of each time domain using the time values of each time domain transmitted from the Precision Time Protocol (PTP) layer 110 of master node 11 and the pre-calculated propagation delay value. At this time, slave node 12 can obtain the time of each time domain by applying the offset value of each time domain to the hardware clock of slave node 12.
[0042] Therefore, by using the master and slave nodes based on the Precise Time Protocol (PTP) as described above, time in multiple time domains can be synchronized.
[0043] Figure 2 This is an example illustrating the configuration of an in-vehicle network device to which an embodiment of the present invention is applied. See also... Figure 2The in-vehicle network device includes multiple electronic control units (ECU_1, ECU_2, ECU_3, and ECU_4) 21, 22, 23, and 24, and a network switch 25 for sending and receiving data between the multiple electronic control units. The multiple electronic control units 21, 22, 23, and 24, and the network switch 25 can be configured as master nodes or slave nodes, respectively.
[0044] Multiple electronic control units 21, 22, 23, and 24 include application layers 210, 220, 230, and 240, and Precision Time Protocol (PTP) layers 211, 221, 231, and 241, while the network switch 25 includes a Precision Time Protocol (PTP) layer 251. The Precision Time Protocol (PTP) layers 211, 221, 231, and 241 can provide interfaces to the application layers 210, 220, 230, and 240, which are equivalent to higher-level layers, including function call functions for setting and obtaining time values in various time domains and for setting and obtaining offset values.
[0045] Each Precision Time Protocol (PTP) layer 211, 221, 231, and 241 can synchronize the reference time 213, 223, 233, and 243 pointed to by the hardware clock between the master node and the slave node, and control the setting and acquisition of offset values 212, 222, 232, and 242 of multiple time domains, thereby synchronizing the time of multiple time domains between the master node and the slave node.
[0046] By configuring the in-vehicle network device of the present invention as described above, an in-vehicle network supporting multiple time domains can be stably and flexibly constructed among multiple electronic control units (ECUs) and network switches.
[0047] Figure 3 This is a flowchart illustrating a method for synchronizing time in multiple time domains between a master node and a slave node to which an embodiment of the present invention is applicable. Figure 3 The various actions illustrated in the figure can be performed through Figure 2 The composition and execution.
[0048] See Figure 3 First, in action S31, the Precise Time Protocol (PTP) layer of the slave node calculates and stores the propagation delay value generated when sending and receiving messages with the master node.
[0049] For example, such as Figure 4 As shown, when the master node GM_p is an electronic control unit 1 (ECU1) and the slave node S_p is a switch, the propagation delay value d can be calculated and stored by the Precise Time Protocol (PTP) layer of the slave node S_p.
[0050] Specifically, the Pdelay_Req signal, which includes information related to the reference time t1 pointed to by the hardware clock, can be transmitted from the Precision Time Protocol (PTP) layer of the slave node S_p to the master node GM_p.
[0051] At this time, the Precision Time Protocol (PTP) layer of the slave node S_p can obtain information related to the reference time T2 of the Pdelay_Req signal received by the Precision Time Protocol (PTP) layer of the master node GM_p, as well as information related to the reference time T3 of the Pdelay_Resp signal corresponding to the Pdelay_Req signal transmitted to the Precision Time Protocol (PTP) layer of the slave node S_p. Furthermore, the Precision Time Protocol (PTP) layer of the slave node S_p can obtain information related to the reference time t4 of the Pdelay_Resp signal received from the master node GM_p.
[0052] In this way, the Precise Time Protocol (PTP) layer of node S_p can calculate and store the propagation delay value d using the difference between reference times t1 and t4 and the difference between T2 and T3, so as to use the stored propagation delay value d when calculating the respective offset values of multiple time domains.
[0053] Next, in action S32, the Precision Time Protocol (PTP) layer of the master node transmits the reference time pointed to by the master node's hardware clock to the Precision Time Protocol (PTP) layer of the slave node. In action S33, the Precision Time Protocol (PTP) layer of the slave node synchronizes the slave node's hardware clock to the reference time pointed to by the transmitted master node's hardware clock.
[0054] For example, such as Figure 5 As shown, when the master node GM_p is an electronic control unit 1 (ECU1) and the slave node S_p is a switch, the Precision Time Protocol (PTP) layer of the master node GM_p can transmit the reference time pointed to by the hardware clock of the master node GM_p to the Precision Time Protocol (PTP) layer of the slave node S_p, and the Precision Time Protocol (PTP) layer of the slave node S_p can synchronize the hardware clock of the slave node S_p to the reference time pointed to by the hardware clock of the master node GM_p that has been transmitted.
[0055] Specifically, after the master node GM_p transmits the Sync packet to the slave node S_p at the reference time T1 pointed to by the hardware clock through the Precision Time Protocol (PTP) layer, a Follow_up packet containing information related to the reference time T1 can be transmitted to the slave node S_p.
[0056] At this point, the Precision Time Protocol (PTP) layer of the slave node S_p can utilize the reference time t2 of the Sync data packet received from the master node GM_p and the reference time T1 of the master node GM_p contained in the transmitted Follow_up data packet, as well as the previously explained... Figure 4 In the instance, the propagation delay value d, which is pre-calculated and stored, is used to calculate the time difference α between the master node GM_p and the slave node S_p.
[0057] In this way, the Precise Time Protocol (PTP) layer of the slave node S_p can perform a pre-correction on the calculated time difference α applied to the hardware clock of the slave node S_p, thereby synchronizing the hardware clock of the slave node S_p to the reference time pointed to by the hardware clock of the master node GM_p.
[0058] Next, in action S34, the precise time protocol (PTP) layer of the master node transmits the time value of the first time domain, which is calculated by adding the reference time to the offset value (θ1) of the first time domain in multiple time domains, to the precise time protocol (PTP) layer of the slave node. In action S35, the precise time protocol (PTP) layer of the slave node calculates the offset value (θ1) of the first time domain using the time value of the first time domain and the stored propagation delay value.
[0059] Finally, in action S36, the calculated offset value (θ1) of the first time domain is applied by the Precise Time Protocol (PTP) layer of the slave node to the reference time pointed to by the hardware clock of the slave node, thereby obtaining the time of the first time domain.
[0060] At this point, it is also possible to further execute the action of transmitting the second time domain time value, calculated by adding the reference time to the offset value (θ2) in the second time domain by the master node's Precision Time Protocol (PTP) layer, to the slave node's Precision Time Protocol (PTP). The slave node's Precision Time Protocol (PTP) layer then uses the second time domain time value and the stored propagation delay value to calculate the offset value (θ2) in the second time domain, and applies it to the reference time to obtain the time in the second time domain. Similarly, it is possible to execute the action of calculating the respective offset values of other time domains besides the first and second time domains, and calculating the time of each time domain by applying the offset values.
[0061] For example, such as Figure 6As shown, when the master node GM_p is Electronic Control Unit 1 (ECU1) and the slave node S_p is a switch, the Precision Time Protocol (PTP) layer of the master node GM_p can calculate the time values of each time domain by adding a reference time to the respective offset values of multiple time domains, and transmit them to the Precision Time Protocol (PTP) layer of the slave node S_p. The Precision Time Protocol (PTP) layer of the slave node S_p then uses the time values of each time domain and the previously explained... Figure 4 The propagation delay value d is calculated and stored in the instance to calculate the offset value in each time domain.
[0062] Specifically, after the master node GM_p transmits the Sync packet to the slave node S_p at the reference time t1 pointed to by the hardware clock via the Precision Time Protocol (PTP) layer, the offset value (θ) of the Nth time domain, which includes multiple time domains, can be included. N The Follow_up data packet, which calculates the Nth time domain time value (t1+θ1) by adding the reference time t1 to the Nth time domain, is sent to the slave node S_p.
[0063] At this point, the Precise Time Protocol (PTP) layer of node S_p can utilize the base time t2 of the Sync data packet received from master node GM_p and the Nth time domain time value (t1+θ) contained in the transmitted Follow_up data packet. N ) and as explained earlier Figure 4 In the example, the pre-calculated and stored propagation delay value d is used to calculate the offset value (θ) in the Nth time domain. N ).
[0064] In this way, the Precise Time Protocol (PTP) layer of node S_p can perform calculations of the respective offsets (θ) in multiple time domains. N It then applies the post-correction to the reference time pointed to by the hardware clock to obtain the Nth time domain time value on the slave node S_p.
[0065] As an example, the Precision Time Protocol (PTP) layer can provide an interface to the application layer, which is equivalent to the upper layer of the Precision Time Protocol (PTP) layer, for setting and obtaining time values for each time domain and for setting and obtaining offset values for each time domain.
[0066] For example, when the setTime(1,T) function is called in the application layer of the master node, the precise time protocol (PTP) layer of the master node will transmit the time value of the first time domain, i.e., T, to the precise time protocol (PTP) layer of the slave node. When the getTime(1) function is called in the application layer of the slave node, the time of the first time domain obtained in the precise time protocol (PTP) layer of the slave node will be returned.
[0067] In addition, when the setOffset(1,θ1) function is called in the Precision Time Protocol (PTP) layer of the master node, the offset value (θ1) of the first time domain can be set, and when the getOffset(1) function is called in the Precision Time Protocol (PTP) layer of the slave node, the offset value (θ1) of the first time domain calculated using the time value of the first time domain and the stored propagation delay value is returned.
[0068] Using the methods described above for embodiments of the present invention, time synchronization between master and slave nodes across multiple time domains can be achieved via the Precision Time Protocol (PTP). Furthermore, a novel Precision Time Protocol (PTP) standard can be provided, incorporating multiple time domain synchronization-related specifications not included in the existing 802.1AS-2011 (Generalized Precision Time Protocol, gPTP) standard.
[0069] Figure 7 This is a system configuration diagram for synchronizing multiple time domains using an offset clock layer based on a Precision Time Protocol (PTP), according to another embodiment of the present invention. See also... Figure 7 The system of the present invention includes a network device based on Precision Time Protocol (PTP), namely a master node 11 and a slave node 12.
[0070] The master node 11 and slave node 12 comprise a Precision Time Protocol (PTP) layer for synchronizing the respective times of multiple time domains based on the Precision Time Protocol (PTP), and an offset clock layer equivalent to the upper-level layer of the Precision Time Protocol (PTP) layer. That is, Figure 7 The composition of the above description is as follows Figure 1 Compared to the structure in the previous section, it also includes the structure of the offset clock layer.
[0071] The Precision Time Protocol (PTP) layer 110 of the master node 11 transmits the reference time pointed to by the hardware clock to the Precision Time Protocol (PTP) layer 120 of the slave node 12, thereby enabling the Precision Time Protocol (PTP) layer 120 of the slave node 12 to synchronize the hardware clock of the slave node 12 to the reference time pointed to by the hardware clock of the master node 11.
[0072] The master node 11 and slave node 12 do not need to use packet communication between the Precision Time Protocol (PTP) layers to calculate the offset values of each time domain. Instead, they can obtain the offset values by sending and receiving messages between the offset value clock layers.
[0073] Specifically, the offset clock layer 111 of the master node 11 transmits the offset values of each time domain to the offset clock layer 121 of the slave node 12. At this time, the Precision Time Protocol (PTP) layer 120 of the slave node 12 can apply the offset values of each time domain transmitted to the offset clock layer 121 of the slave node 12 to the reference time pointed to by the hardware clock of the slave node 12, thereby obtaining the time of each time domain.
[0074] Therefore, by using the master and slave nodes based on the Precision Time Protocol (PTP) with the added offset clock layer as described above, time synchronization can be achieved across multiple time domains.
[0075] Figure 8 This is an example illustrating the configuration of an in-vehicle network device to which another embodiment of the present invention is applied. See also... Figure 8 The in-vehicle network device includes multiple electronic control units (ECU_1, ECU_2, ECU_3, and ECU_4) 71, 72, 73, and 74, and a network switch 75 for sending and receiving data between the multiple electronic control units. The multiple electronic control units 71, 72, 73, and 74, and the network switch 75 can be configured as master nodes or slave nodes, respectively.
[0076] Multiple electronic control units 71, 72, 73, and 74 include application layers 710, 720, 730, and 740, offset clock layers 711, 721, 731, and 741, and Precision Time Protocol (PTP) layers 712, 722, 732, and 742, while the network switch 75 includes a Precision Time Protocol (PTP) layer 752. The offset clock layers 711, 721, 731, and 741 can provide interfaces to the application layers 710, 720, 730, and 740, which correspond to the upper-level layers, including function call functions for setting and retrieving time values for each time domain, setting and retrieving offset values, and setting and retrieving clock modes for each time domain.
[0077] Each Precision Time Protocol (PTP) layer 712, 722, 732, 742, and 752 can synchronize the reference time t pointed to by the hardware clock between the master node and the slave node.
[0078] Each offset clock layer 711, 721, 731, and 741 can handle multiple time-domain offset values (θ1, θ2, ..., θ4) between the master and slave nodes. NThe settings and acquisition of the offset clock layers 711, 721, 731, and 741 are controlled, thereby controlling the settings and acquisition of the clock modes for each time domain related to the master and slave nodes. At this time, the offset clock layers 711, 721, 731, and 741 can set the clock mode of each time domain to master mode or slave mode. The setting of the clock mode for each time domain can be independently set regardless of whether the Precision Time Protocol (PTP) layers 712, 722, 732, and 742 are master / slave.
[0079] For example, in the first electronic control unit (ECU_1), which is equivalent to the master node, the Precision Time Protocol (PTP) layer 712 can set the Ethernet port GM_P to master mode. At this time, although the clock mode of the first time domain of the offset clock layer 711 can be set to the same master mode as the Ethernet port GM_P, the clock mode of the Nth time domain can be set to a slave mode different from the Ethernet port GM_P.
[0080] Furthermore, in the fourth electronic control unit (ECU_4), which is equivalent to a slave node, the Precision Time Protocol (PTP) layer 742 can set the Ethernet port S_P to slave mode. At this time, although the clock mode of the first time domain of the offset value clock layer 741 can be set to the same slave mode as the Ethernet port S_P, the clock mode of the Nth time domain can be set to a master mode different from that of the Ethernet port S_P.
[0081] That is, when synchronizing the time of multiple time domains using the Precision Time Protocol (PTP) layer and the offset clock layer, the master / slave function of the Precision Time Protocol (PTP) layer and the master / slave function of each time domain in the offset clock layer can be executed independently.
[0082] Figure 9 This is a flowchart illustrating a method for synchronizing time in multiple time domains between a master node and a slave node to which another embodiment of the present invention applies. Figure 9 The various actions illustrated in the figure can be performed through Figure 8 The composition and execution.
[0083] See Figure 9 First, in action S81, the Precision Time Protocol (PTP) layer of the master node transmits the reference time pointed to by the hardware clock of the master node to the Precision Time Protocol (PTP) layer of the slave node. In action S82, the Precision Time Protocol (PTP) layer of the slave node synchronizes the hardware clock of the slave node to the reference time pointed to by the hardware clock of the master node.
[0084] Next, in action S83, the offset value (θ1) of the first time domain in the plurality of time domains is transmitted from the offset value clock layer of the master node to the offset value clock layer of the slave node.
[0085] Finally, in action S84, the Precision Time Protocol (PTP) layer of the slave node applies the offset value (θ1) of the first time domain transmitted to the offset clock layer of the slave node to the reference time pointed to by the hardware clock of the slave node, thereby obtaining the time of the first time domain.
[0086] At this point, additional actions can be performed, such as transmitting the offset value (θ2) of the second time domain from the master node's offset clock layer to the slave node's offset clock layer, and applying the transmitted second time domain offset value (θ2) to the reference time pointed to by the slave node's hardware clock using the slave node's Precision Time Protocol (PTP) layer, thereby obtaining the time of the second time domain. Similarly, actions can be performed to calculate the time of each time domain by applying the respective offset values of other time domains besides the first and second time domains.
[0087] As one embodiment, the operation of setting the clock mode of each time domain in the offset clock layer to master mode or slave mode can be performed. In this case, if the clock mode of the first time domain is set to master mode in the offset clock layer of the master node, the clock mode of the first time domain can be set to slave mode in the offset clock layer of the slave node. Furthermore, if the clock mode of the Nth time domain is set to master mode in the offset clock layer of the slave node, the clock mode of the Nth time domain can be set to slave mode in the offset clock layer of the master node.
[0088] That is, the master / slave relationship between the Precision Time Protocol (PTP) layer and the offset clock layer does not need to be consistent, but can be set independently of each other.
[0089] As an example, the offset clock layer can provide the application layer, which is equivalent to the upper layer of the offset clock layer, with interfaces for setting and obtaining time values for each time domain, setting and obtaining offset values for each time domain, and setting and obtaining clock modes for each time domain.
[0090] For example, when the `setTime(1,T)` function is called at the application layer of the master node, the time value of the first time domain can be transmitted from the Precision Time Protocol (PTP) layer of the master node to the Precision Time Protocol (PTP) layer of the slave node. Then, when the `getTime(1)` function is called at the application layer of the slave node, the time of the first time domain obtained from the Precision Time Protocol (PTP) layer of the slave node can be returned.
[0091] Furthermore, when the setOffset(1,θ1) function is called at the offset clock layer of the master node, the offset value (θ1) of the first time domain can be transmitted to the offset clock layer of the slave node, and when the getOffset(1) function is called at the offset clock layer of the slave node, the transmitted offset value (θ1) of the first time domain can be returned.
[0092] Furthermore, when the `setMode(1)` function is called in the offset clock layer of the master node, the clock mode of the first time domain can be set to master mode, and the clock mode of the first time domain of the slave node can be set to slave mode. At this time, when the `getMode(1)` function is called in the offset clock layer, the set clock mode of the first time domain can be returned.
[0093] Furthermore, function calls used to set time values for each time domain and to set offset values for each time domain can be executed only when the clock mode of each time domain in the offset clock layer is the master mode.
[0094] Figure 10 This is a hardware configuration diagram of an exemplary computing device that can implement the methods applicable to several embodiments of the present invention. For example... Figure 10 As shown, the computing device 100 may include one or more processors 101, a bus 107, a network interface 102, a memory 103 for loading a computer program 105 executed by the processor 101, and a storage device 104 for storing the computer program 105. Figure 10 Only the constituent elements relevant to embodiments of the present invention have been illustrated. Therefore, those skilled in the art to which this invention pertains should understand that, in addition to… Figure 10 In addition to the constituent elements shown in the diagram, other general constituent elements may also be included.
[0095] For example, computing device 100 may be part of an electronic device installed in a car.
[0096] The processor 101 is used to control the overall operation of the various components of the computing device 100. For example, the processor 101 may be an electronic control unit (ECU) installed in a car.
[0097] Furthermore, processor 101 may also include at least one of a central processing unit (CPU), a microprocessor unit (MCU), a micro controller unit, a graphics processing unit (GPU), or any type of processor known in the art of this invention. Additionally, processor 101 can perform operations related to at least one application or program for running methods / actions to which various embodiments of the present invention are applicable. Computing device 100 may be equipped with more than one processor.
[0098] Memory 103 is used to store various data, instructions, and / or information. Memory 103 can load more than one program 105 from storage device 104 to perform methods / actions applicable to various embodiments of the present invention. For example, when computer program 105 is loaded into memory 103, logic (or modules) can be implemented on memory 103. Memory 103 may be an example of random access memory (RAM), but is not limited thereto.
[0099] Bus 107 is used to provide communication functions between the components of computing device 100. Bus 107 can be implemented in various forms such as address bus, data bus, and control bus.
[0100] Network interface 102 is used to support wired and wireless Internet communication of computing device 100. Network interface 102 can support not only Internet communication but also various other communication methods. Therefore, network interface 102 may include communication modules known in the technical field of this invention.
[0101] Storage device 104 is used for non-transitory storage of one or more computer programs 105. Storage device 104 may include non-volatile memory such as flash memory, hard disk, portable hard disk, or any form of computer-readable storage medium known in the art to which this invention pertains.
[0102] Computer program 105 may include one or more instructions for implementing methods / actions applicable to various embodiments of the present invention. When computer program 105 is loaded into memory 103, processor 101 may execute methods / actions applicable to various embodiments of the present invention by running the one or more instructions.
[0103] As one embodiment, computer program 105 may include instructions for performing the following actions: calculating and storing the propagation delay value generated when sending and receiving messages with the master node by the Precision Time Protocol (PTP) layer of the slave node; transmitting the reference time pointed to by the hardware clock of the master node to the Precision Time Protocol (PTP) layer of the slave node by the Precision Time Protocol (PTP) layer of the master node; synchronizing the hardware clock of the slave node to the reference time pointed to by the hardware clock of the master node by the Precision Time Protocol (PTP) layer of the slave node; and having the master node... The actions of the Precision Time Protocol (PTP) layer transmitting the time value of the first time domain, calculated by adding the reference time to the offset value (θ1) of the first time domain in the plurality of time domains, to the Precision Time Protocol (PTP) layer of the slave node; the actions of the Precision Time Protocol (PTP) layer of the slave node calculating the offset value (θ1) of the first time domain using the time value of the first time domain and the stored propagation delay value; and the actions of the Precision Time Protocol (PTP) layer of the slave node applying the calculated offset value (θ1) of the first time domain to the reference time pointed to by the hardware clock of the slave node and thereby obtaining the time of the first time domain.
[0104] See the above content. Figures 1 to 10 Various embodiments of the present invention and their effects have been described. The effects of applying the technical concept of the present invention are not limited to those mentioned above; those skilled in the art will further understand other effects not mentioned from the following description.
[0105] The technical concept of the present invention described above can be implemented in computer-readable code on a computer-readable medium. For example, the computer-readable storage medium can be a portable storage medium (such as a CD, DVD, Blu-ray disc, USB storage device, and portable hard drive) or a fixed storage medium (such as ROM, RAM, and computer internal hard drive). The computer program stored on the computer-readable storage medium can be transmitted to other computing devices via a network such as the Internet and installed on those other computing devices, thereby being used on them.
[0106] In the foregoing, all process elements constituting the embodiments of the present invention have been described in a manner combining them into one or in combination. However, the technical concept of the present invention is not limited to the embodiments described above. That is, within the scope of the present invention, all constituent elements can be selectively combined into one or more and perform actions.
[0107] The accompanying drawings illustrate actions in a specific order, but this should not be construed as meaning that the desired result can only be achieved if the actions are performed sequentially in the illustrated order or if all illustrated actions are executed. In certain situations, multitasking and parallel processing may be more advantageous. In particular, for the embodiments described above, the separation of various components should not be construed as necessarily requiring separation as described, but rather as meaning that the illustrated program components and systems can generally be integrated into a single software product or packaged into multiple software products.
[0108] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, those skilled in the art will understand that the present invention can be implemented in other specific forms without altering its technical concept or essential features. Therefore, the embodiments described above should be understood in all respects as exemplary rather than limiting. The scope of protection of the present invention should be interpreted through the appended claims, and all technical concepts within the same scope should be interpreted as being included within the scope of the claims that define the technical concepts by way of the present invention.
Claims
1. A method for synchronizing time across multiple time domains. Methods for synchronizing time across multiple time domains between master and slave nodes include: The step of transmitting the reference time pointed to by the hardware clock of the master node to the precision time protocol layer of the slave node by the precision time protocol layer; The step of synchronizing the hardware clock of the slave node to the reference time pointed to by the hardware clock of the master node by the precise time protocol layer of the slave node; The step of transmitting the offset value θ1 of the first time domain in the plurality of time domains to the offset value clock layer of the slave node from the offset value clock layer of the master node; The step of obtaining the time in the first time domain by having the precise time protocol layer of the slave node transmit the offset value θ1 of the first time domain to the offset value clock layer of the slave node and apply it to the reference time pointed to by the hardware clock of the slave node; The step of transmitting the offset value θ2 of the second time domain in the plurality of time domains to the offset value clock layer of the slave node from the offset value clock layer of the master node; as well as, The step of obtaining the time in the second time domain by having the precise time protocol layer of the slave node transmit the offset value θ2 of the second time domain to the offset value clock layer of the slave node and apply it to the reference time pointed to by the hardware clock of the slave node.
2. The method for synchronizing time in multiple time domains according to claim 1 further includes: The step of setting the clock mode of each time domain of the offset value clock layer to master mode or slave mode; When the clock mode of the first time domain is set to the master mode in the offset clock layer of the master node, the clock mode of the first time domain is set to the slave mode in the offset clock layer of the slave node.
3. The method for synchronizing time across multiple time domains according to claim 1, The offset clock layer provides the application layer, which is the upper-level layer of the offset clock layer, with interfaces for setting and obtaining time values for each time domain, setting and obtaining offset values for each time domain, and setting and obtaining clock modes for each time domain.
4. The method for synchronizing time in multiple time domains according to claim 3 further includes: When the application layer of the master node calls the setTime(1, T) function, the precise time protocol layer of the master node transmits the time value T of the first time domain to the precise time protocol layer of the slave node. as well as, The step of returning the time in the first time domain obtained in the precise time protocol layer of the slave node when the getTime(1) function is called in the application layer of the slave node.
5. The method for synchronizing time in multiple time domains according to claim 3 further includes: The step of transmitting the first time domain offset value θ1 to the offset value clock layer of the slave node when the setOffset(1, θ1) function is called at the offset value clock layer of the master node; as well as, The step of returning the first time domain offset value θ1 transmitted when the getOffset(1) function is called at the clock layer of the slave node offset value.
6. The method for synchronizing time in multiple time domains according to claim 3 further includes: When the setMode(1) function is called in the offset clock layer of the master node, the step of setting the clock mode of the first time domain to the master mode is performed. The step of setting the clock mode of the first time domain of the slave node to slave mode; as well as, The step of returning the clock mode of the first time domain when the getMode(1) function is called at the offset clock layer.
7. The method for synchronizing time across multiple time domains according to claim 3, Function calls for setting the time values of each time domain and for setting the offset values of each time domain are executed only when the clock mode of each time domain in the offset clock layer is the master mode.
8. The method for synchronizing time across multiple time domains according to claim 1, The master node and the slave node are respectively an electronic control unit or a network switch.
9. A computer-readable non-volatile storage medium, The computer program is stored for causing a computer to perform the method according to any one of claims 1 to 8.
10. A computing device, As a computing device for synchronizing time across multiple time domains between a master node and slave nodes, it includes: More than one processor; A communication interface used for communicating with external devices; Memory for loading computer programs executed by the processor; and, A storage device for storing the computer program; The computer program includes instructions for performing the following actions: The action of transmitting the reference time pointed to by the hardware clock of the master node to the precision time protocol layer of the slave node. The action of synchronizing the hardware clock of the slave node to the reference time pointed to by the hardware clock of the master node by the precise time protocol layer of the slave node; The action of transmitting the offset value θ1 of the first time domain in the plurality of time domains to the offset value clock layer of the slave node by the offset value clock layer of the master node; The operation of obtaining the time in the first time domain by the precise time protocol layer of the slave node transmitting the offset value θ1 of the first time domain to the offset value clock layer of the slave node and applying it to the reference time pointed to by the hardware clock of the slave node; The step of transmitting the offset value θ2 of the second time domain in the plurality of time domains to the offset value clock layer of the slave node from the offset value clock layer of the master node; as well as, The step of obtaining the time in the second time domain by having the precise time protocol layer of the slave node transmit the offset value θ2 of the second time domain to the offset value clock layer of the slave node and apply it to the reference time pointed to by the hardware clock of the slave node.