Time synchronization method, apparatus, device, storage medium, and vehicle

By employing a dual-crystal structure in the vehicle, the first crystal oscillator is used to acquire the time and the controller calculates the delay time, while the second crystal oscillator is used for synchronization. This solves the problem of inaccurate time caused by a single crystal oscillator, achieves high-precision time synchronization, and meets the precise control requirements of the vehicle.

CN116938374BActive Publication Date: 2026-05-29BEIJING CO WHEELS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING CO WHEELS TECH CO LTD
Filing Date
2022-04-11
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing time synchronization methods have low accuracy in vehicles and cannot meet the requirements of precise control. This is mainly because a single crystal oscillator produces slight jumps during the time update process, leading to inaccurate time.

Method used

A dual-crystal structure is adopted. The first crystal oscillator collects the message transmission and reception time and the local time. The controller calculates the delay time and sends it to the second crystal oscillator for synchronization, ensuring that the time acquisition and synchronization processes are independent and do not interfere with each other, thereby improving the calculation accuracy of the master clock time.

Benefits of technology

This improves the accuracy of time synchronization, meets the requirements for precise vehicle control, and ensures the accuracy and independence of the time synchronization process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116938374B_ABST
    Figure CN116938374B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a time synchronization method, device, equipment, storage medium and vehicle. The method is applied to a controller of a time synchronization device, the time synchronization device further comprising a first crystal oscillator and a second crystal oscillator, and the method comprises: receiving a message transceiving time and a local time collected by the first crystal oscillator; calculating a delay time between the time synchronization device and a master clock device according to the message transceiving time; calculating a master clock time of the master clock device based on the delay time and the message transceiving time; and sending the master clock time and the local time to the second crystal oscillator, the second crystal oscillator being configured to synchronize the local time with the master clock time. The time collected by the first crystal oscillator is accurate time, and thus the master clock time obtained is of high accuracy. Therefore, the above-mentioned time synchronization method applies double crystal oscillators, improves the accuracy of the calculation of the master clock time, further improves the time synchronization accuracy, and meets the demand for precise control of the vehicle.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of communication technology, and in particular to a time synchronization method, apparatus, device, storage medium, and vehicle. Background Technology

[0002] With the development of vehicle intelligence, the complexity of vehicle control systems is gradually increasing, resulting in a gradual increase in the number of devices on vehicles.

[0003] To achieve precise vehicle control, time synchronization among multiple devices is essential. Current time synchronization methods typically rely on the Generalized Precision Time Protocol (gPTP). However, the accuracy of the synchronization time calculated using these methods is relatively low, ultimately failing to meet the demands for precise vehicle control. Summary of the Invention

[0004] To address the aforementioned technical problems, this disclosure provides a time synchronization method, apparatus, device, storage medium, and vehicle.

[0005] In a first aspect, this disclosure provides a time synchronization method, which is applied to the controller of a time synchronization device. The time synchronization device further includes a first crystal oscillator and a second crystal oscillator. The method includes:

[0006] Receive and transmit the message time and local time acquired by the first crystal oscillator;

[0007] Calculate the delay time between the time synchronization device and the master clock device based on the message sending and receiving time;

[0008] Calculate the master clock time of the master clock device based on the latency and message transmission / reception time.

[0009] The master clock time and local time are sent to the second crystal oscillator, which is used to synchronize the local time with the master clock time.

[0010] In a second aspect, this disclosure provides a time synchronization device, which is configured in the controller of a time synchronization equipment. The time synchronization equipment further includes a first crystal oscillator and a second crystal oscillator. The device includes:

[0011] The time receiving module is used to receive the message transmission and reception time and local time acquired by the first crystal oscillator;

[0012] The delay calculation module is used to calculate the delay between the time synchronization device and the master clock device based on the message sending and receiving time.

[0013] The master clock time calculation module is used to calculate the master clock time of the master clock device based on the delay time and message transmission and reception time.

[0014] The time transmission module is used to send the master clock time and local time to the second crystal oscillator, which is used to synchronize the local time according to the master clock time.

[0015] Thirdly, embodiments of this disclosure also provide a time synchronization device, the device comprising:

[0016] One or more processors;

[0017] Storage device for storing one or more programs.

[0018] When one or more programs are executed by one or more processors, the one or more processors implement the time synchronization method provided in the first aspect.

[0019] Fourthly, embodiments of this disclosure also provide a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the time synchronization method provided in the first aspect.

[0020] Fifthly, embodiments of this disclosure also provide a vehicle, wherein the vehicle includes at least one of the following:

[0021] The time synchronization device, time synchronization equipment, and computer-readable storage medium described in the above embodiments.

[0022] The technical solution provided in this disclosure has the following advantages compared with the prior art:

[0023] This disclosure discloses a time synchronization method, apparatus, device, storage medium, and vehicle. The controller of the time synchronization device is applied, and the time synchronization device further includes a first crystal oscillator and a second crystal oscillator. Specifically, the controller receives the message transmission and reception time and local time collected by the first crystal oscillator, calculates the delay time between the time synchronization device and the master clock device based on the message transmission and reception time, then calculates the master clock time of the master clock device based on the delay time and the message transmission and reception time, and finally sends the master clock time and local time to the second crystal oscillator. The second crystal oscillator is used to synchronize the local time according to the master clock time. Because the time is collected by the first crystal oscillator and synchronized by the second crystal oscillator, the time collection process and the time synchronization process are independent and do not interfere with each other. Therefore, the time collected by the first crystal oscillator is accurate, resulting in a highly accurate master clock time. Thus, the above-described time synchronization method utilizes dual crystal oscillators, improving the accuracy of master clock time calculation and further enhancing time synchronization accuracy, meeting the requirements for precise vehicle control. Attached Figure Description

[0024] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0025] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0026] Figure 1 This is a schematic diagram of the structure of a time synchronization device provided in this embodiment;

[0027] Figure 2 A flowchart illustrating a time synchronization method provided in an embodiment of this disclosure;

[0028] Figure 3 A schematic diagram of interaction logic provided for an embodiment of this disclosure;

[0029] Figure 4 Another interactive logic diagram provided for embodiments of this disclosure;

[0030] Figure 5 This is yet another interactive logic diagram provided in the embodiments of this disclosure;

[0031] Figure 6 This is another schematic diagram of the interaction logic provided in the embodiments of this disclosure;

[0032] Figure 7 A flowchart illustrating another time synchronization method provided in this embodiment of the disclosure;

[0033] Figure 8 This is a schematic diagram of the structure of a time synchronization device provided in an embodiment of the present disclosure;

[0034] Figure 9 This is a schematic diagram of another time synchronization device provided in an embodiment of the present disclosure. Detailed Implementation

[0035] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0036] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.

[0037] With the development of vehicle intelligence, more and more vehicles are using Time-Sensitive Networking (TSN) for communication. TSN is also known as Ethernet AVB 2.0. AVB technology is based on traditional Ethernet networks and uses precise time synchronization methods to limit transmission latency by ensuring bandwidth, thereby improving service quality and supporting the normal operation of applications on the vehicle.

[0038] Current time synchronization methods typically utilize a single crystal oscillator to acquire and update the time. However, when using a single crystal oscillator for both acquisition and update, slight jumps during the update process can lead to inaccuracies in the acquired time. Consequently, the master clock time calculated by the synchronization device based on these inaccurate times is also inaccurate, further causing deviations in the final time synchronization result. Therefore, the disadvantage of current time synchronization methods is their low accuracy, which fails to meet the requirements for precise vehicle control.

[0039] To address the aforementioned problems, embodiments of this disclosure provide a time synchronization method, apparatus, device, storage medium, and vehicle.

[0040] Figure 1 A schematic diagram of the structure of a time synchronization device provided in an embodiment of this disclosure is shown.

[0041] like Figure 1 As shown, the time synchronization device may include a controller 10, a first crystal oscillator 20, and a second crystal oscillator 30.

[0042] The first crystal oscillator 20 can be used to collect message sending and receiving times and local time, and send the message sending and receiving times and local time to the controller 10.

[0043] The controller 10 can be used to receive the message transmission and reception time and local time collected by the first crystal oscillator 20, calculate the delay time between the time synchronization device and the master clock device based on the message transmission and reception time, calculate the master clock time of the master clock device based on the delay time and the message transmission and reception time, and send the master clock time and local time to the second crystal oscillator 30.

[0044] The second crystal oscillator 30 can be used to synchronize the local time according to the master clock time.

[0045] Therefore, this embodiment of the present disclosure can complete the time synchronization process by acquiring the time through the first crystal oscillator and updating the time through the second crystal oscillator, ensuring that the first and second crystal oscillators do not interfere with each other. In this way, the time acquired by the first crystal oscillator is accurate, thus obtaining a highly accurate master clock time. Therefore, the accuracy of master clock time calculation is improved, further enhancing time synchronization accuracy and meeting the requirements for precise vehicle control.

[0046] Based on the above structure, the following is combined with Figures 2 to 7 The time synchronization method provided in the embodiments of this disclosure will be described. In the embodiments of this disclosure, the time synchronization method can be executed by the controller of a time synchronization device, which may further include a first crystal oscillator and a second crystal oscillator.

[0047] Figure 2 A flowchart illustrating a time synchronization method provided in an embodiment of this disclosure is shown.

[0048] like Figure 2 As shown, the time synchronization method may include the following steps.

[0049] S210, Receive the message transmission and reception time and local time acquired by the first crystal oscillator.

[0050] In this embodiment of the disclosure, after the time synchronization device is started, the first crystal oscillator in the time synchronization device can collect message transmission and reception times and local time at regular intervals according to the interaction with the master clock device, and send the message transmission and reception times to the controller of the time synchronization device, so that the time synchronization device can obtain the aforementioned message transmission and reception times and local time.

[0051] It should be noted that the first crystal oscillator can be used only for data acquisition.

[0052] In this embodiment of the disclosure, the message transmission and reception time may include the time carried in the interaction messages between the time synchronization device and the master clock device. Optionally, the interaction messages may include synchronization request and response messages.

[0053] In this embodiment of the disclosure, the local time can be the local timestamp of the time synchronization device.

[0054] For message transmission and reception time, the first crystal oscillator can extract the time from the synchronization request sent by the controller to the master clock device, and from the response message received from the master clock device, and the extracted time constitutes the message transmission and reception time.

[0055] To extract different times, prior to S110, the time synchronization method may also include the following steps:

[0056] S101. Send two consecutive synchronization requests to the master clock device, each synchronization request carrying the request sending time of the first crystal oscillator acquisition.

[0057] S102. Receive two consecutive response messages corresponding to two consecutive synchronization requests fed back by the master clock device. Each response message carries the request reception time, response sending time, and response reception time collected by the first crystal oscillator. The message transmission and reception time consists of the request sending time and request reception time of the two consecutive synchronization requests, as well as the response sending time and response reception time of the two consecutive response messages.

[0058] Specifically, firstly, the controller in the time synchronization device can periodically send two consecutive synchronization requests to the master clock device. Each synchronization request can carry the request transmission time acquired by the first crystal oscillator. Then, in response to the two consecutive synchronization requests, the master clock device can periodically send corresponding response messages back to the master clock device. Simultaneously, the first crystal oscillator can acquire the time carried in the response messages, specifically the request reception time, response transmission time, and response reception time. Through this process, the first crystal oscillator can obtain the message transmission and reception time composed of the aforementioned times.

[0059] The synchronization request can be a request message sent by the time synchronization device to the master clock device for time synchronization. Specifically, the synchronization request can be a peer-to-peer delay request message (Pdelay_Req). The time synchronization device can use its free-running local clock to capture the request sending time carried in Pdelay_Req, denoted as t1.

[0060] It should be noted that the time synchronization device can be regarded as the requester, and the master clock device can be regarded as the responder.

[0061] The response message can be a response message generated by the master clock device for each synchronization request. Specifically, the response message can include a peer delay response message (Pdelay_Resp) and a peer delay response follow-up message (Pdelay_Resp_Follow_Up).

[0062] Among them, Pdelay_Resp can carry the request reception time of the synchronization request of Pdelay_Req, denoted as t2; Pdelay_Resp_Follow_Up can carry the response sending time, denoted as t3.

[0063] When Pdelay_Resp arrives at the Media Access Control (MAC) layer of the time synchronization device, the controller of the time synchronization device triggers the first crystal oscillator to acquire the response reception time of Pdelay_Resp, denoted as t4.

[0064] In one example, to facilitate understanding of the interaction logic between the time synchronization device and the master clock device, Figure 3 A schematic diagram of an interaction logic provided by an embodiment of this disclosure is shown.

[0065] like Figure 3 As shown, the time synchronization device and the master clock device perform a single interaction. Specifically, the interaction process may include the following steps:

[0066] First, the time synchronization device sends a Pdelay_Req to the master clock device, carrying the request transmission time t1. Then, when the Pdelay_Req reaches the MAC layer of the master clock device, the master clock device can capture the request reception time t2. Next, in response to the Pdelay_Req, the master clock device sends a Pdelay_Resp and a Pdelay_Resp_Follow_Up to the time synchronization device, where the Pdelay_Resp carries t2 and the Pdelay_Resp_Follow_Up carries the acknowledgment transmission time t3. Finally, when the Pdelay_Resp reaches the MAC layer of the time synchronization device, the time synchronization device can capture the acknowledgment reception time t4.

[0067] In the above manner, for a single interaction between the time synchronization device and the master clock device, the message sending and receiving time can be composed of the request sending time and request receiving time of a single synchronization request, as well as the response sending time and response receiving time of a single response message.

[0068] In another example, to further understand the interaction logic between the time synchronization device and the master clock device, Figure 4 This illustration shows another interactive logic diagram provided by an embodiment of the present disclosure.

[0069] like Figure 4 As shown, the master clock device sends two response messages to the time synchronization device. Specifically, the interaction process may include the following steps:

[0070] During the initial interaction, the time synchronization device first sends a Pdelay_Req to the master clock device, carrying the request sending time t. 1,1 Then, when Pdelay_Req arrives at the MAC layer of the master clock device, the master clock device can capture the first request reception time t of Pdelay_Req. 2,1 Next, the master clock device can send Pdelay_Resp and Pdelay_Resp_Follow_Up to the time synchronization device, where Pdelay_Resp carries t 2,1Pdelay_Resp_Follow_Up carries t 3,1 Finally, when Pdelay_Resp reaches the MAC layer of the time synchronization device, the time synchronization device can capture the first acknowledgment reception time t of Pdelay_Resp. 4,1 .

[0071] During the second interaction, firstly, the time synchronization device sends Pdelay_Req to the master clock device, with Pdelay_Req carrying the request sending time t. 1,2 Then, when Pdelay_Req arrives at the MAC layer of the master clock device, the master clock device can capture the first request reception time t of Pdelay_Req. 2,2 Next, the master clock device can send Pdelay_Resp and Pdelay_Resp_Follow_Up to the time synchronization device, where Pdelay_Resp carries t 2,2 Pdelay_Resp_Follow_Up carries t 3,2 Finally, when Pdelay_Resp reaches the MAC layer of the time synchronization device, the time synchronization device can capture the first acknowledgment reception time t of Pdelay_Resp. 4,2 .

[0072] In the above manner, for the two interaction processes between the time synchronization device and the master clock device, the message sending and receiving time can be composed of the request sending time and request receiving time of the two synchronization requests, as well as the response sending time and response receiving time of the two response messages.

[0073] Therefore, in this embodiment of the disclosure, the time synchronization device can collect message transmission and reception time and local time through the first crystal oscillator, so that the controller of the time synchronization device can receive the message transmission and reception time and local time collected by the first crystal oscillator, which facilitates the subsequent calculation of the master clock time based on the collected time.

[0074] S220. Calculate the delay time between the time synchronization device and the master clock device based on the message sending and receiving time.

[0075] In this embodiment of the disclosure, after obtaining the message transmission and reception time, the controller in the time synchronization device can determine the delay time between the time synchronization device and the master clock device based on the message transmission and reception time, so that time synchronization can be further performed based on the delay time.

[0076] The delay time may include at least one of the following: propagation delay time, response delay time, etc.

[0077] In this embodiment of the disclosure, optionally, the frequency offset ratio between the time synchronization device and the master clock device can be calculated based on the message sending and receiving time, and then the delay time can be calculated based on the frequency offset ratio.

[0078] S230. Calculate the master clock time of the master clock device based on the delay time and message transmission / reception time.

[0079] In this embodiment of the disclosure, after obtaining the delay time, the controller in the time synchronization device can calculate the master clock time based on the delay time and the response sending time corresponding to the response message in the message transmission and reception time.

[0080] Specifically, the delay time can be added to the response sending time in the message sending and receiving time to obtain the master clock time.

[0081] In this embodiment of the disclosure, the master clock time can be a reference time used by the time synchronization device for time synchronization. Specifically, the master clock time can be the precise time of the master clock device.

[0082] S240: Send the master clock time and local time to the second crystal oscillator, which is used to synchronize the local time according to the master clock time.

[0083] In this embodiment of the disclosure, after obtaining the master clock time, the controller in the time synchronization device can send the master clock time and the local time to the second crystal oscillator, so that the second crystal oscillator adjusts the local time according to the master clock time.

[0084] It should be noted that the second crystal oscillator can be used solely for time synchronization. One of the first and second crystal oscillators can serve as the master crystal oscillator, and the other as the slave crystal oscillator.

[0085] The time synchronization method provided in this disclosure is applied to the controller of a time synchronization device, which further includes a first crystal oscillator and a second crystal oscillator. Specifically, the controller receives the message transmission and reception time and local time collected by the first crystal oscillator, calculates the delay time between the time synchronization device and the master clock device based on the message transmission and reception time, then calculates the master clock time of the master clock device based on the delay time and the message transmission and reception time, and finally sends the master clock time and local time to the second crystal oscillator. The second crystal oscillator is used to synchronize the local time according to the master clock time. Because the time is collected by the first crystal oscillator and synchronized by the second crystal oscillator, the time collection process and the time synchronization process are independent and do not interfere with each other. Therefore, the time collected by the first crystal oscillator is accurate, resulting in a highly accurate master clock time. Thus, the above time synchronization method utilizes dual crystal oscillators, improving the accuracy of master clock time calculation and further enhancing time synchronization accuracy, meeting the requirements for precise vehicle control.

[0086] In another embodiment of this disclosure, the frequency offset ratio between the time synchronization device and the master clock device can be calculated first based on the message sending and receiving time, then the delay time can be calculated based on the frequency offset ratio, and finally the master clock time can be calculated based on the delay time and the message sending and receiving time.

[0087] As can be seen from the description of the above embodiments, the message sending and receiving time consists of the request sending time and request receiving time of two consecutive synchronization requests, and the response sending time and response receiving time of two consecutive response messages.

[0088] Based on the above time, in this embodiment of the disclosure, optionally, S220 may specifically include the following steps:

[0089] S2201. Calculate the frequency offset ratio based on the acknowledgment sending time and acknowledgment receiving time in the message sending and receiving time.

[0090] S2202. Calculate the delay time based on the frequency offset ratio.

[0091] The frequency offset ratio can be the frequency ratio between the master clock device and the time synchronization device. Specifically, the frequency offset ratio can be used to calibrate the timing frequency.

[0092] Optionally, in this embodiment of the disclosure, S2201 may specifically include the following steps:

[0093] S22011. Calculate the first time difference between the response sending times of two consecutive response messages;

[0094] S22012. Calculate the second time difference between the response reception times of two consecutive response messages;

[0095] S22013. Calculate the quotient of the first time difference and the second time difference to obtain the frequency offset ratio.

[0096] Among them, two consecutive response messages can be response messages corresponding to two consecutively sent synchronization requests.

[0097] To facilitate understanding of the frequency offset ratio calculation method, combined with Figure 4 Explain the calculation process of frequency offset ratio.

[0098] Figure 4 Two response messages are given, each containing `Pdelay_Resp` and `Pdelay_Resp_Follow_Up`. The first response message carries the response sending time `t`. 3,1 The second response message carries a response sending time of t. 3,2 The first response message carries a response reception time of t. 4,1 The second response message carries a response reception time of t.4,2 .

[0099] based on Figure 4 The frequency offset ratio can be expressed as follows in the interactive logic diagram shown:

[0100] RateRatio = f i-1 / f i =(t 3,2 -t 3,1 ) / (t 4,2 -t 4,1 )

[0101] Among them, t 3,2 -t 3,1 For the first time difference, t 4,2 -t 4,1 This is the second time difference.

[0102] In this embodiment of the disclosure, optionally, the delay time includes propagation delay time and response delay time; correspondingly, S2202 may specifically include the following steps:

[0103] S22021. Calculate the propagation delay time based on the frequency offset ratio and the request sending time, request receiving time, response sending time, and response receiving time in the message sending and receiving time.

[0104] S22022. Based on the local time, the acknowledgment reception time in the message sending and receiving time, and the frequency offset ratio, obtain the acknowledgment delay time.

[0105] The propagation delay time can be the delay caused by the propagation of message information on a link.

[0106] The response delay time can be the delay time after receiving the response message.

[0107] Specifically, S22021 may include the following steps:

[0108] Step 1: Obtain the response sending time and response receiving time of one of the two consecutive response messages, and obtain the request sending time and request receiving time of the synchronization request corresponding to that response message;

[0109] Step 2: Calculate the third time difference between the time the response was received and the time the request was sent;

[0110] Step 3: Calculate the fourth time difference between the time the response was sent and the time the request was received;

[0111] Step 4: Calculate the product of the third time difference and the frequency offset ratio;

[0112] Step 5: Take half of the difference between the product and the fourth time difference as the propagation delay time.

[0113] One of the response messages can be either one of two consecutively sent response messages.

[0114] To facilitate understanding of the calculation method for propagation delay time, combined with Figure 3 Explain the calculation process of the propagation delay time.

[0115] See also Figure 3 , Figure 3 A synchronization request and its corresponding response message are provided. The synchronization request is Pdelay_Req, and the response message contains Pdelay_Resp and Pdelay_Resp_Follow_Up.

[0116] based on Figure 3 The propagation delay time shown in the interaction logic diagram can be expressed as:

[0117] Pdelay=(RateRatio*(t4-t1)-(t3-t2)) / 2

[0118] Among them, t4-t1 is the third time difference, and t3-t2 is the fourth time difference.

[0119] Therefore, in this embodiment of the disclosure, the propagation delay time between the time synchronization device and the master clock device can be calculated based on the message sending and receiving time.

[0120] Specifically, S22022 may include the following steps:

[0121] Step 1: Calculate the time difference between local time and response reception time;

[0122] Step 2: Multiply the time difference by the frequency offset ratio to obtain the response delay time.

[0123] To facilitate understanding of the calculation method for response delay time, Figure 5 This illustration shows yet another interactive logic diagram provided by an embodiment of the present disclosure.

[0124] like Figure 5 As shown, the master clock device sends a response message based on the synchronization request Pdelay_Req sent by the time synchronization device. This response message can include Pdelay_Resp, Pdelay_Resp_Follow_Up, a synchronization message (Sync), and a follow message (Follow_Up).

[0125] based on Figure 5 The interaction logic diagram shown below illustrates that the response delay time can be represented as:

[0126] Syncdelay = Rateratio * (t - t6)

[0127] Where t is the local time, t6 is the response reception time, and t6 is specifically the time when Sync arrives at the synchronization device.

[0128] Therefore, in this embodiment of the disclosure, the response delay time between the time synchronization device and the master clock device can be calculated based on the message sending and receiving time.

[0129] Furthermore, in some embodiments, the time synchronization device can interact directly with the master clock device; that is, the master clock device communicates directly with the time synchronization device without needing to forward messages through other devices. Therefore, for the case where the time synchronization device can interact with the master clock device, S230 may specifically include the following steps:

[0130] S2301. Add the propagation delay time, the response delay time, and the response sending time in the message sending and receiving time to obtain the master clock time.

[0131] Specifically, after obtaining the local time, response delay time, and message transmission and reception time, the controller in the time synchronization device can directly add the propagation delay time, response delay time, and response sending time in the message transmission and reception time to obtain the master clock time.

[0132] To facilitate understanding of the above method for calculating the master clock time, combined with... Figure 5 A detailed explanation of the calculation process for the master clock time.

[0133] like Figure 5 As shown, Follow_Up can carry a PreciseOriginTimestamp field, a CorrectionField field, and a RateRatio. The PreciseOriginTimestamp field carries the time Sync left the master clock device, and the CorrectionField field carries a time correction value. This correction value is used to correct t5. For the master clock device, t5 has a precision of nanoseconds (ns), and the CorrectionField value is the fractional part of t5 that is less than a nanosecond (ns). The specific precision of the CorrectionField is 2^n. 16 ns.

[0134] based on Figure 5 The interaction logic diagram shown below indicates that the master clock time can be represented as:

[0135] GlobalTime(t)=t5+t`+Pdelay+Syncdelay

[0136] Where t is the local time, t` is the time correction value carried by the CorrectionField, t5 is the time when Sync leaves the master clock device, and t6 is the time when Sync arrives at the time synchronization device.

[0137] In other embodiments, the time synchronization device can interact with the master clock device through the time sensing device; that is, the master clock device can communicate indirectly with the time synchronization device through the time sensing device. Based on this communication method, in order to further improve the calculation accuracy of the master clock, the message transmission and reception time also includes the correction time corresponding to the time sensing device. Therefore, S230 may specifically include the following steps:

[0138] The master clock time is obtained by adding the propagation delay time, the response delay time, the response sending time in the message sending and receiving time, and the correction time.

[0139] The correction time can include a first correction time from the master clock device to the time-aware device and a second correction time from the time-aware device to the time synchronization device. Specifically, the first correction time can include a first delay time for the response message to travel from the master clock device to the time-aware device and the dwell time of the response message on the time-aware device, and the second correction time can include a second delay time for the response message to travel from the time-aware device to the time synchronization device.

[0140] Therefore, in this embodiment of the disclosure, after calculating the propagation delay time and the response delay time, the master clock time can be determined based on the propagation delay time, the response delay time, and the response sending time in the message sending and receiving time.

[0141] To facilitate understanding of the above method for calculating the master clock time, Figure 6 A schematic diagram of another interaction logic provided by an embodiment of this disclosure is shown.

[0142] like Figure 6As shown, the master clock device responds with a response message based on the synchronization request Pdelay_Req sent by the time synchronization device. This response message can include Pdelay_Resp, Pdelay_Resp_Follow_Up, Sync, and Follow_Up. Specifically, first, the master clock device sends Sync and Follow_Up to the slave clock port of the time-aware device. Sync leaves the master clock device at time t5 and arrives at the slave clock port of the time-aware device at time t7. Then, the slave clock port of the time-aware device forwards Sync and Follow_Up to the master clock port of the time-aware device. Next, the master clock port of the time-aware device forwards Sync to the time synchronization device. Sync leaves the time-aware device at time t8 and arrives at the time synchronization device at time t9, completing the indirect interaction process between the master clock device and the time synchronization device. It should be noted that the master clock device, the time-aware device, and the time synchronization device can be simulated as nodes i-1, i, and i+1, respectively.

[0143] based on Figure 6 The interactive logic diagram shown below indicates that the master clock time can be represented as:

[0144] GlobalTime(t) = t5 + t' + Pdelay i+1 +CorrectionField i +Rateratio*(t-t9)

[0145] Among them, Pdelay i+1 The second correction time, or the second delay time, is represented by the CorrectionField. i The first correction time t9 is the time when Sync arrives at the time synchronization device. Rateratio*(t-t9) can also be understood as the response delay time.

[0146] Among them, CorrectionField i =OldCorrection+Pdelay i +residence_time, where OldCorrection is the initialization delay time, and Pdelay is the delay time. i The first delay time is `residence_time`, and the residence time is `residence_time`.

[0147] Therefore, in this embodiment of the disclosure, after calculating the propagation delay time and the response delay time, the master clock time can be determined based on the propagation delay time, the response delay time, the correction time, and the response sending time in the message sending and receiving time.

[0148] In summary, different methods can be used to calculate the master clock time based on the communication between the master clock device and the time synchronization device.

[0149] In another embodiment of this disclosure, after calculating the frequency offset ratio, the controller in the time synchronization device can also calculate the correction period of the local time period based on the frequency offset ratio and the local crystal oscillator frequency, so that the second crystal oscillator corrects the local time period according to the correction period.

[0150] Figure 7 A flowchart illustrating another time synchronization method provided in an embodiment of this disclosure is shown.

[0151] like Figure 7 As shown, the time synchronization method may include the following steps.

[0152] S710 receives the message transmission and reception time and local time acquired by the first crystal oscillator.

[0153] S720. Calculate the frequency offset ratio between the time synchronization device and the master clock device based on the acknowledgment sending time and acknowledgment receiving time in the message sending and receiving time.

[0154] S730, calculates the delay time based on the frequency offset ratio;

[0155] S740: Calculate the master clock time of the master clock device based on the delay time and message transmission / reception time.

[0156] The specific implementation of S710 to S740 can be referred to the description of the foregoing embodiments, and will not be repeated here.

[0157] S750: Calculate the correction period of the local time period based on the frequency offset ratio and the local crystal oscillator frequency.

[0158] In this embodiment of the disclosure, the controller can multiply the frequency offset ratio and the local crystal oscillator frequency to obtain the correction period of the local time period.

[0159] In this embodiment of the disclosure, the correction period can be a period deviation of the local time period.

[0160] S760 sends the master clock time, local time, and correction period to the second crystal oscillator, which is used to synchronize the local time according to the master clock time and to correct the local time period according to the correction period.

[0161] In this embodiment of the present disclosure, the second crystal oscillator can correct the local time according to the master clock time, so that the local time is synchronized with the master clock time; at the same time, the second crystal oscillator can adjust the local time period according to the correction period, so that the local time period is synchronized with the time period of the master clock device.

[0162] In this embodiment of the disclosure, the local time period can be the local period of the time synchronization device.

[0163] Therefore, in this embodiment of the present disclosure, the second crystal oscillator can also correct the local time period during time synchronization, ultimately achieving ultra-high time synchronization accuracy.

[0164] This disclosure also provides a time synchronization device for implementing the above-described time synchronization method, which is described below in conjunction with... Figure 8 The following explanation is provided. In this embodiment, the time synchronization device can be a time synchronization equipment. This time synchronization equipment may include devices with communication functions such as mobile terminals, tablet computers, and vehicle-mounted terminals.

[0165] Figure 8 A schematic diagram of a time synchronization device according to an embodiment of the present disclosure is shown. This time synchronization device can be configured in the controller of a time synchronization equipment, which further includes a first crystal oscillator and a second crystal oscillator.

[0166] like Figure 8 As shown, the time synchronization device 800 may include: a time receiving module 810, a delay time calculation module 820, a master clock time calculation module 830, and a time sending module 840.

[0167] The time receiving module 810 can be used to receive the message transmission and reception time and local time acquired by the first crystal oscillator;

[0168] The delay time calculation module 820 can be used to calculate the delay time between the time synchronization device and the master clock device based on the message sending and receiving time.

[0169] The master clock time calculation module 830 can be used to calculate the master clock time of the master clock device based on the delay time and message transmission and reception time.

[0170] The time transmission module 840 can be used to send the master clock time and local time to the second crystal oscillator, which is used to synchronize the local time according to the master clock time.

[0171] In this embodiment, the device can be configured in the controller of a time synchronization device, which further includes a first crystal oscillator and a second crystal oscillator. Specifically, the controller receives the message transmission and reception time and local time collected by the first crystal oscillator, calculates the delay time between the time synchronization device and the master clock device based on the message transmission and reception time, then calculates the master clock time of the master clock device based on the delay time and the message transmission and reception time, and finally sends the master clock time and local time to the second crystal oscillator. The second crystal oscillator is used to synchronize the local time according to the master clock time. Because the time is collected by the first crystal oscillator and synchronized by the second crystal oscillator, the time acquisition process and the time synchronization process are independent and do not interfere with each other. Therefore, the time collected by the first crystal oscillator is accurate, resulting in a highly accurate master clock time. Thus, the above time synchronization method utilizes dual crystal oscillators, improving the accuracy of master clock time calculation and further enhancing time synchronization accuracy, meeting the requirements for precise vehicle control.

[0172] In some optional embodiments, the delay time calculation module 820 may include:

[0173] The frequency offset ratio calculation unit can be used to calculate the frequency offset ratio between the time synchronization device and the master clock device based on the acknowledgment sending time and acknowledgment receiving time in the message transmission and reception time.

[0174] The delay time calculation unit can be used to calculate the delay time based on the frequency offset ratio.

[0175] In some alternative embodiments, the delay time includes propagation delay time and response delay time;

[0176] Accordingly, the delay time calculation unit can be used to calculate the propagation delay time based on the frequency offset ratio and the request sending time, request receiving time, response sending time and response receiving time in the message sending and receiving time.

[0177] The response delay time is obtained based on the local time, the response reception time in the message sending and receiving time, and the frequency offset ratio.

[0178] In some optional embodiments, the master clock time calculation module 830 can be specifically used to add the propagation delay time, the response delay time, and the response sending time in the message sending and receiving time to obtain the master clock time.

[0179] In some optional embodiments, the message sending and receiving time also includes a correction time corresponding to the time-aware device, which is used to enable the master clock device to communicate indirectly with the time synchronization device;

[0180] Accordingly, the master clock time calculation module 830 can be used to add the propagation delay time, the response delay time, the response sending time in the message sending and receiving time, and the correction time to obtain the master clock time.

[0181] In some alternative embodiments, the device further includes:

[0182] The correction period calculation module can be used to calculate the correction period of the local time period based on the frequency offset ratio and the local crystal oscillator frequency.

[0183] The local time period correction module can be used to send the correction period to the second crystal oscillator, which is used to correct the local time period according to the correction period.

[0184] It should be noted that, Figure 9 The time synchronization device 900 shown can perform... Figures 2 to 7 The various steps in the method embodiment shown are implemented. Figures 2 to 7 The processes and effects in the method embodiments shown are not described in detail here.

[0185] Figure 9 A schematic diagram of another time synchronization device provided in an embodiment of this disclosure is shown.

[0186] like Figure 9 As shown, the time synchronization device may include a controller 901 and a memory 902 storing computer program instructions.

[0187] Specifically, the controller 901 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0188] Memory 902 may include a large-capacity storage for information or instructions. For example, and not limitingly, memory 902 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 902 may include removable or non-removable (or fixed) media. Where appropriate, memory 902 may be internal or external to the integrated gateway device. In a particular embodiment, memory 902 is a non-volatile solid-state memory. In a particular embodiment, memory 902 includes read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (Electrically Programmable ROM, EPROM), an electrically erasable programmable PROM (EEPROM), an electrically alterable ROM (EAROM), or flash memory, or a combination of two or more of these.

[0189] The controller 901 performs the steps of the time synchronization method provided in the embodiments of this disclosure by reading and executing computer program instructions stored in the memory 902.

[0190] In one example, the time synchronization device may also include a transceiver 903 and a bus 904. Wherein, as... Figure 9 As shown, the controller 901, memory 902 and transceiver 903 are connected via bus 904 and communicate with each other.

[0191] Bus 904 includes hardware, software, or both. For example, and not limitingly, a bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industrial Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 904 may include one or more buses. Although specific buses are described and illustrated in the embodiments of this application, this application considers any suitable bus or interconnection.

[0192] In some embodiments, the time synchronization device may further include: a first crystal oscillator and a second crystal oscillator;

[0193] The first crystal oscillator is used to collect message sending and receiving times and local time.

[0194] The second crystal oscillator is used to synchronize the local time with the master clock time.

[0195] It should be noted that, Figure 9 The first and second crystal oscillators are not shown. The specific functions of the first and second crystal oscillators can be referred to the description of the foregoing embodiments, and will not be repeated here.

[0196] The following are embodiments of a computer-readable storage medium provided in this disclosure. This computer-readable storage medium and the time synchronization methods of the above embodiments belong to the same inventive concept. For details not described in detail in the embodiments of the computer-readable storage medium, please refer to the embodiments of the above time synchronization methods.

[0197] This embodiment provides a storage medium containing computer-executable instructions. When executed by a computer processor, the computer-executable instructions are used to perform a time synchronization method. This method is applied to a controller of a time synchronization device, which further includes a first crystal oscillator and a second crystal oscillator. The method includes:

[0198] Receive and transmit the message time and local time acquired by the first crystal oscillator;

[0199] Calculate the delay time between the time synchronization device and the master clock device based on the message sending and receiving time;

[0200] Calculate the master clock time of the master clock device based on the latency and message transmission / reception time.

[0201] The master clock time and local time are sent to the second crystal oscillator, which is used to synchronize the local time with the master clock time.

[0202] Of course, the computer-executable instructions provided in the embodiments of this disclosure are not limited to the above-described method operations, but can also perform related operations in the time synchronization method provided in any embodiment of this disclosure.

[0203] Based on the above description of the implementation methods, those skilled in the art can clearly understand that this disclosure can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer cloud platform (which may be a personal computer, server, or network cloud platform, etc.) to execute the time synchronization methods provided in the various embodiments of this disclosure.

[0204] The following are embodiments of a vehicle provided in this disclosure. This vehicle may include the time synchronization device, time synchronization equipment, and computer-readable storage medium described in the above embodiments. It should be noted that the vehicle embodiments and the time synchronization methods described in the above embodiments belong to the same inventive concept. Details not described in detail in the vehicle embodiments can be found in the embodiments of the time synchronization methods described above.

[0205] Note that the above description is merely a preferred embodiment and the technical principles employed in this disclosure. Those skilled in the art will understand that this disclosure is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of this disclosure. Therefore, although this disclosure has been described in detail through the above embodiments, it is not limited to the above embodiments. Many other equivalent embodiments may be included without departing from the concept of this disclosure, and the scope of this disclosure is determined by the scope of the appended claims.

Claims

1. A time synchronization method, characterized in that, A controller for a time synchronization device, the time synchronization device further comprising a first crystal oscillator and a second crystal oscillator, the method comprising: Receive the message transmission and reception time and local time acquired by the first crystal oscillator; Calculate the delay time between the time synchronization device and the master clock device based on the message transmission and reception time; Calculate the master clock time of the master clock device based on the delay time and the message transmission and reception time; The master clock time and the local time are sent to the second crystal oscillator, which is used to synchronize the local time with the master clock time.

2. The method according to claim 1, characterized in that, The step of calculating the delay time between the time synchronization device and the master clock device based on the message transmission and reception time includes: Calculate the frequency offset ratio between the time synchronization device and the master clock device based on the response sending time and response receiving time in the message sending and receiving time. The delay time is calculated based on the frequency offset ratio.

3. The method according to claim 2, characterized in that, The delay time includes propagation delay time and response delay time; The step of calculating the delay time based on the frequency offset ratio includes: The propagation delay time is calculated based on the frequency offset ratio and the request sending time, request receiving time, response sending time, and response receiving time in the message sending and receiving time. The response delay time is obtained based on the local time, the response reception time in the message sending and receiving time, and the frequency offset ratio.

4. The method according to claim 3, characterized in that, The step of calculating the master clock time of the master clock device based on the delay time and the message transmission and reception time includes: The master clock time is obtained by adding the propagation delay time, the response delay time, and the response sending time in the message sending and receiving time.

5. The method according to claim 3, characterized in that, The message transmission and reception time also includes the correction time corresponding to the time sensing device, which is used to enable the master clock device to communicate indirectly with the time synchronization device. The step of calculating the master clock time of the master clock device based on the delay time and the message transmission and reception time includes: The master clock time is obtained by adding the propagation delay time, the response delay time, the response sending time in the message sending and receiving time, and the correction time.

6. The method according to claim 2, characterized in that, After calculating the frequency offset ratio between the time synchronization device and the master clock device based on the acknowledgment sending time and acknowledgment receiving time in the message transmission and reception time, the method further includes: The correction period of the local time period is calculated based on the frequency offset ratio and the local crystal oscillator frequency. The correction period is sent to the second crystal oscillator, which is used to correct the local time period according to the correction period.

7. A time synchronization device, characterized in that, A controller configured in a time synchronization device, the time synchronization device further comprising a first crystal oscillator and a second crystal oscillator, the device comprising: The time receiving module is used to receive the message transmission and reception time and local time collected by the first crystal oscillator; The delay time calculation module is used to calculate the delay time between the time synchronization device and the master clock device based on the message sending and receiving time; The master clock time calculation module is used to calculate the master clock time of the master clock device based on the delay time and the message transmission and reception time; A time transmission module is used to send the master clock time and the local time to the second crystal oscillator, and the second crystal oscillator is used to synchronize the local time according to the master clock time.

8. A time synchronization device, characterized in that, include: Controller; Memory, used to store executable instructions; The controller is configured to read the executable instructions from the memory and execute the executable instructions to implement the time synchronization method according to any one of claims 1-6.

9. The device according to claim 8, characterized in that, The time synchronization device further includes: a first crystal oscillator and a second crystal oscillator; The first crystal oscillator is used to collect message sending and receiving times and local time; The second crystal oscillator is used to synchronize the local time according to the master clock time.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, The storage medium stores a computer program that, when executed by a processor, causes the processor to implement the time synchronization method described in any one of claims 1-6.

11. A vehicle, characterized in that, Includes at least one of the following: The time synchronization device as described in claim 7; The time synchronization device as described in claim 8 or 9; The computer-readable storage medium as claimed in claim 10.

Citation Information

Patent Citations

  • Clock synchronization system

    CN113794529A

  • Clock Distribution in a Distributed System with Multiple Clock Domains Over a Switched Fabric

    US20120030495A1