Time synchronization method and apparatus, time synchronization device and readable storage medium
By using 1PPS+TOD protocol messages for time synchronization between wireless base stations, the high operation and maintenance costs and complex engineering site construction problems in the existing technology are solved, and precise time synchronization between devices is achieved.
Patent Information
- Application Number
- PCT/CN2024/073861
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-22
- Filing Date
- 2024-01-24
- Publication Date
- 2024-09-26
AI Technical Summary
Existing technology requires the deployment of NTP time synchronization servers and GNSS feeders for time synchronization of wireless base stations, resulting in high technical requirements for operator engineering and site construction and high later operation and maintenance costs.
By using 1PPS+TOD protocol messages for time synchronization between the device to be synchronized and the time synchronized device, and using the 1PPS+TOD clock reference source and the 1PPS+TOD protocol, time synchronization between devices is achieved without the need to deploy an NTP time synchronization server. and GNSS feeders.
It reduces the technical requirements for operators' engineering and website construction, saves later operation and maintenance costs, and achieves precise time synchronization between devices.
Smart Images

Figure CN2024073861_26092024_PF_FP
Abstract
Description
Time synchronization method, device, time synchronization device and readable storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to Chinese patent application No. 202310319092.9 filed on March 22, 2023, the contents of which are incorporated herein by reference in their entirety. Technical Field
[0003] The embodiments of the present disclosure relate to the field of time synchronization technology, and in particular to a time synchronization method, apparatus, time synchronization device, and readable storage medium. Background Art
[0004] The Network Time Protocol (NTP) is a network protocol for clock synchronization between system devices on a data network through packet exchange. NTP can typically maintain an error of several seconds over the public Internet and achieve an accuracy of no more than 1 millisecond in an ideal local area network environment. The protocol is often described as a master-slave architecture, but can also use broadcast or multicast, with clients on the local area network passively listening for time updates after an initial round-trip calibration exchange.
[0005] For wireless base stations, especially LTE (Long Term Evolution)-TDD (Time Division Duplexing) and 5G TNR (Time-Division Duplexing) base stations, the vast majority are deployed with GNSS (Global Navigation Satellite System) feeders and equipped with NTP time synchronization servers for time synchronization. This networking scenario places very high demands on operators' engineering site construction technology and also incurs significant operational and maintenance costs.
[0006] Summary of the Invention
[0007] Embodiments of the present disclosure provide a time synchronization method, apparatus, time synchronization device, and readable storage medium.
[0008] In a first aspect, an embodiment of the present disclosure provides a time synchronization method, wherein the method is applied to a device to be synchronized, the device to be synchronized is configured with a 1PPS+TOD clock reference source and a 1PPS+TOD protocol, and the device to be synchronized is communicatively connected with the synchronization device; the method includes: sending a pulse synchronization request message to the synchronization device, and recording the first sending time of sending the pulse synchronization request message, the pulse synchronization request message including a synchronization period and a frequency deviation; wherein the frequency deviation is used to characterize the timing deviation of the device to be synchronized; receiving a pulse synchronization response message triggered by the synchronization device according to the synchronization period; wherein the pulse synchronization response message and the pulse synchronization request message are both 1PPS+TOD protocol messages; determining a message transmission time difference based on the frequency deviation, the first sending time and the pulse synchronization response message; and synchronizing the device to be synchronized based on the message transmission time difference to achieve time synchronization between the device to be synchronized and the synchronization device.
[0009] In a second aspect, an embodiment of the present disclosure provides a time synchronization device, wherein the device is applied to a device to be synchronized, the device to be synchronized is configured with a 1PPS+TOD clock reference source and a 1PPS+TOD protocol, and the device to be synchronized is communicatively connected to the synchronization device; the device includes: a sending recording module, configured to send a pulse synchronization request message to the synchronization device, and record the first sending time of sending the pulse synchronization request message, the pulse synchronization request message includes a synchronization period and a frequency deviation, wherein the frequency deviation is used to characterize the timing deviation degree of the device to be synchronized; a receiving module, configured to receive a pulse synchronization response message triggered by the synchronization device according to the synchronization period, wherein the pulse synchronization response message and the pulse synchronization request message are both 1PPS+TOD protocol messages; a determination module, configured to determine the message transmission time difference based on the frequency deviation, the first sending time and the pulse synchronization response message; a synchronization module, configured to synchronize the device to be synchronized based on the message transmission time difference, so as to achieve time synchronization between the device to be synchronized and the synchronization device.
[0010] In a third aspect, an embodiment of the present disclosure provides a time synchronization device, which includes: a processor and a memory, and the processor is used to execute a time synchronization program stored in the memory to implement the above-mentioned time synchronization method.
[0011] In a fourth aspect, an embodiment of the present disclosure provides a readable storage medium, wherein the readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned time synchronization method. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] FIG1 is a schematic diagram of bidirectional port intercommunication provided by an embodiment of the present disclosure;
[0013] FIG2 is a schematic diagram of another bidirectional port interconnection provided by an embodiment of the present disclosure;
[0014] FIG3 is a flow chart of an embodiment of a time synchronization method provided by an embodiment of the present disclosure;
[0015] FIG4 is a flow chart of another time synchronization method according to an embodiment of the present disclosure;
[0016] FIG5 is a time diagram of a message interaction time provided by an embodiment of the present disclosure;
[0017] FIG6 is a block diagram of an embodiment of a time synchronization device provided by an embodiment of the present disclosure;
[0018] FIG7 is a schematic structural diagram of a time synchronization device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.
[0020] To facilitate understanding of the embodiments of the present disclosure, further explanation will be given below with reference to specific embodiments in conjunction with the accompanying drawings. The embodiments do not constitute a limitation on the embodiments of the present disclosure.
[0021] An embodiment of the present disclosure provides a time synchronization method, wherein the method is applied to a device to be synchronized, the device to be synchronized is configured with a 1PPS+TOD clock reference source and a 1PPS+TOD protocol, and the device to be synchronized is communicatively connected with a synchronization device.
[0022] The aforementioned device to be synchronized can be a wireless base station, or a clock or transmission device, etc., which is not limited here; the 1PPS+TOD clock reference source deployed on the device to be synchronized provides a clock standard for the entire device. Since the device to be synchronized is also configured with the 1PPS+TOD protocol, the device to be synchronized can synchronize time with the synchronization device via 1PPS+TOD protocol messages. By utilizing the method of performing time synchronization via 1PPS+TOD protocol messages provided in the embodiments of the present disclosure, there is no need to deploy NTP synchronization servers and GNSS feeders, which can effectively reduce the technical requirements for operator engineering site construction and subsequent operation and maintenance costs.
[0023] In actual applications, the device to be synchronized and the synchronization device communicate through the device ports to transmit 1PPS+TOD protocol messages. This can be understood as directly connecting the ports of the device to be synchronized and the synchronization device through a network cable (or optical fiber) to achieve bidirectional port intercommunication. For ease of understanding, Figure 1 shows a schematic diagram of bidirectional port intercommunication. In Figure 1, the device to be synchronized is wireless base station A, and the synchronization device is wireless base station B. Both wireless base stations include a connection port 10, which can be a clock electrical port or an optical port. The connection ports 10 of the two wireless base stations are directly connected via a common network cable or optical fiber to achieve bidirectional port intercommunication.
[0024] Figure 2 shows a schematic diagram of another bidirectional port interconnection. In Figure 2, the device to be synchronized is a clock or transmission device C, and the synchronization device is still a wireless base station B as an example. Both devices include a clock electrical port 20, and the clock electrical ports 20 of the two devices are directly connected through an ordinary network cable to achieve bidirectional port interconnection.
[0025] 3 is a flowchart of a time synchronization method according to an embodiment of the present disclosure. The method is applied to a device to be synchronized. The process shown in FIG3 may include the following steps 301 to 304.
[0026] In step 301, a pulse time synchronization request message is sent to a time synchronization device, and a first sending time of the pulse time synchronization request message is recorded. The pulse time synchronization request message includes a time synchronization period and a frequency deviation.
[0027] To facilitate the description of the pulse timing request message, Table 1 shows an exemplary message structure of the pulse timing request message:
[0028] Table 1
[0029] As shown in Table 1:
[0030] 1) The frame header consists of two bytes, fixed as 0x43 0x4D, indicating that the 1PPS+TOD protocol is used.
[0031] 2) Message type and message ID
[0032] It consists of two bytes, fixed as 0x04 0x40, indicating a time synchronization request message, sent by the device to be synchronized.
[0033] 3) Message length
[0034] The valid range of message length calculation includes only the message content, excluding the frame header, message type and ID (Identification), message length and checksum.
[0035] 4) Message content
[0036] The message content consists of 16 bytes, including the above-mentioned time synchronization period and frequency deviation.
[0037] In the present disclosure, frequency deviation (or frequency deviation coefficient) is used to characterize the timing deviation degree of the device to be synchronized. It can be understood that frequency deviation is caused by the long-term accumulation of clock timing and the actual frequency of the crystal oscillator being affected by various external factors (temperature, voltage, aging, etc.). In this embodiment, if the frequency deviation is a preset frequency deviation (preferably the preset frequency deviation is 1), it means that there is no timing deviation in the device to be synchronized. At this time, there is no time deviation between the device to be synchronized and the synchronization device, and the protocol message transmission delay is the same. If the frequency deviation is not the preset frequency deviation, it means that there is a timing deviation in the device to be synchronized. At this time, there is a time deviation between the device to be synchronized and the synchronization device, and the protocol message transmission delay is different. The different results of the comparison between the frequency deviation and the preset frequency deviation will directly affect the determination of the message transmission time difference in step 303. Step 303 will be introduced in detail below and will not be described in detail here.
[0038] The timing cycle enables the timing device to send a pulse timing response message to the device to be synchronized according to the timing cycle. The timing cycle and frequency deviation can be configured according to actual needs.
[0039] 5) Verification domain
[0040] Consists of one byte. The check range includes the message header, message length, and frame check field, excluding the frame header. It is padded with zeros when not used. In actual use, the check field can be included or omitted in the message according to actual needs.
[0041] In step 302, a pulse timing response message is received, which is sent by the timing device according to the timing cycle trigger.
[0042] Since both the pulse timing response message and the pulse timing request message are 1PPS+TOD protocol messages, both the device to be synchronized and the timing device trigger the sending of messages every second.
[0043] To facilitate the description of the pulse timing response message, Table 2 shows a message structure of a pulse timing response message:
[0044] Table 2
[0045] As shown in Table 2:
[0046] 1) Frame header
[0047] It consists of two bytes. It is fixed as 0x43 0x4D, indicating that the 1PPS+TOD protocol is used.
[0048] 2) Message type and message ID
[0049] It consists of two bytes, fixed as 0x05 0x50, indicating a time synchronization response message, sent by the time synchronization device.
[0050] 3) Message length
[0051] It consists of two bytes. The effective range of message length calculation includes only the message content, excluding the frame header, message type and ID, message length and check field.
[0052] 4) Message content
[0053] The message content consists of 48 bytes, which mainly includes the time when the timing device receives the pulse timing request message and the time when it sends the pulse timing response message.
[0054] 5) Verification domain
[0055] Consists of one byte. The check range includes the message header, message length, and frame check field, excluding the frame header. It is padded with zeros when not used. In actual use, the check field can be included or omitted in the message according to actual needs.
[0056] In step 303, the message transmission time difference is determined based on the frequency deviation, the first sending time and the pulse timing response message.
[0057] In actual use, the message transmission time difference includes the first transmission delay of the pulse timing response message and the first time offset between the device to be synchronized and the synchronization device. The specific process of determining the message transmission time difference is detailed in the following embodiments and is not repeated here.
[0058] In step 304, the time of the device to be synchronized is synchronized based on the message transmission time difference, so as to achieve time synchronization between the device to be synchronized and the synchronization device.
[0059] The time difference of message transmission can be used to correct the time when the device to be synchronized receives the pulse timing response message, so that the corrected time of the device to be synchronized is synchronized with the current time of the synchronization device.
[0060] The time synchronization method provided by the embodiment of the present disclosure includes: sending a pulse time synchronization request message to a time synchronization device, and recording a first sending time of sending the pulse time synchronization request message, the pulse time synchronization request message including a time synchronization period and a frequency deviation, wherein the frequency deviation is used to characterize the timing deviation degree of the device to be synchronized; receiving a pulse time synchronization response message triggered by the time synchronization device according to the time synchronization period, wherein the pulse time synchronization response message and the pulse time synchronization request message are both 1PPS+TOD protocol messages; determining a message transmission time difference based on the frequency deviation, the first sending time and the pulse time synchronization response message; and synchronizing the device to be synchronized based on the message transmission time difference to achieve time synchronization between the device to be synchronized and the time synchronization device. The above-mentioned device to be synchronized is configured with a 1PPS+TOD clock reference source and a 1PPS+TOD protocol. When the device to be synchronized is synchronized with the synchronization device, accurate time synchronization of the device to be synchronized can be achieved by only using the 1PPS+TOD protocol message transmitted between the devices. This application does not require the deployment of an NTP synchronization server and a GNSS feeder to achieve time synchronization between devices, which can reduce the technical requirements for the operator's engineering site construction and save subsequent operation and maintenance costs.
[0061] 4 is a flowchart of another time synchronization method according to an embodiment of the present disclosure. The process shown in FIG4 is also applicable to the device to be synchronized, and based on the process shown in FIG3 above, may include the following steps 401 to 409.
[0062] In step 401, a pulse time synchronization request message is sent to a time synchronization device, and a first sending time of the pulse time synchronization request message is recorded. The pulse time synchronization request message includes a time synchronization period and a frequency deviation.
[0063] In step 402, a pulse timing response message is received, which is sent by the timing device according to the timing cycle trigger.
[0064] In step 403, the first receiving time of the received pulse timing response message is recorded.
[0065] The first receiving time is the current time of the 1PPS+TOD clock reference source configured on the device to be synchronized.
[0066] In step 404, the pulse timing response message is parsed to obtain the second receiving time and the second sending time included in the pulse timing response message.
[0067] The second receiving time is the time when the timing device receives the pulse timing request message, and the second sending time is the time when the timing device sends the pulse timing response message.
[0068] In step 405 , it is determined whether the frequency deviation is a preset frequency deviation.
[0069] Optionally, the preset frequency deviation is 1. Of course, the preset value may also be other values, which are not specifically limited here, and it is understood that the closer the preset frequency deviation is to 1, the lower the timing deviation of the device to be synchronized is, that is, the higher the timing accuracy is.
[0070] If it is determined that the frequency deviation is not the preset frequency deviation, it means that the device to be synchronized has a timing deviation, and the frequency deviation needs to be considered in the process of determining the message transmission time difference. Therefore, step 406 needs to be executed; if it is determined that the frequency deviation is the preset frequency deviation, it means that the device to be synchronized has no timing deviation, and the frequency deviation does not need to be considered in the process of determining the message transmission time difference. Therefore, step 407 needs to be executed.
[0071] In step 406, a message transmission time difference is determined based on the frequency deviation, the first sending time, the first receiving time, the second receiving time, and the second sending time.
[0072] When frequency deviation is considered in determining the message transmission time difference, the message transmission time difference can be calculated using the following formula: Δt cμ =(t1+t3)-(t0+t2)-(d cs -d sc )-Δt sμ ; d sc =(t1-t3)+(t2-t0)-d cs ;
[0073] Among them, d cs =d sc +Δd μ ;Δt sμ =f dn *Δt cμ ;Δt sμ Indicates the second time deviation between the synchronization device and the device to be synchronized; Δt cμ Indicates the first time deviation; d cs Indicates the second transmission delay of the pulse timing request message; d sc represents the first transmission delay; Δd μ Indicates the transmission delay error between the device to be synchronized and the synchronization device; f dn represents the frequency deviation (also called the frequency deviation coefficient); t0 represents the first sending time; t1 represents the second receiving time; t2 represents the second sending time; and t3 represents the first receiving time.
[0074] In order to facilitate understanding of the first sending time t0, the second receiving time t1, the second sending time t2, and the first receiving time t3, Figure 5 shows a time diagram of the message interaction time. As shown in Figure 5, the first sending time t0 and the first receiving time t3 are both the device time of the device to be synchronized, and the second receiving time t1 and the second sending time t2 are both the device time of the synchronization device.
[0075] In step 407, the message transmission time difference is determined based on the first sending time, the first receiving time, the second receiving time, and the second sending time.
[0076] When the frequency deviation is not considered in the process of determining the message transmission time difference, the message transmission time difference can be calculated by the following formula: Δt cμ =[(t1-t0)+(t3-t2)] / 2; d sc =[(t1-t3)+(t2-t0)] / 2;
[0077] Where Δt cμ Indicates the first time deviation; d sc represents the first transmission delay; t0 represents the first sending time; t1 represents the second receiving time; t2 represents the second sending time; and t3 represents the first receiving time.
[0078] In step 408, a synchronization time is determined based on the second sending time and the message transmission time difference.
[0079] The synchronization time is the current time of the synchronization device, which can be calculated by the following formula: t=t2+Δt cμ -d sc ;
[0080] Where t represents the synchronization time; t2 represents the second sending time; Δt cμ Indicates the first time deviation; d sc Indicates the first transmission delay.
[0081] In step 409, the first receiving time is corrected to the synchronized time.
[0082] The first receiving time of the device to be synchronized is modified to the current time of the synchronization device, that is, the synchronization time, so as to achieve time synchronization between the device to be synchronized and the synchronization device.
[0083] During the above time synchronization process, if the device to be synchronized detects that it has not received a pulse synchronization response message within a preset time period, it generates a synchronization exception message.
[0084] The timing abnormality information can be sent to maintenance personnel to perform abnormality detection and repair on the timing equipment to ensure normal timing.
[0085] In actual use, the preset time period can be set based on actual needs. Specifically, if the device to be synchronized fails to receive a pulse synchronization response message from the synchronization device three times in a row, it generates a synchronization exception message. It then attempts to receive a pulse synchronization response message three more times, using the synchronization period x 2. If it still fails to receive a pulse synchronization response message, it no longer processes the pulse synchronization response message. To restart the time synchronization process, you need to re-trigger the pulse synchronization request message by modifying the configuration or other means.
[0086] In actual process, when the termination of the time synchronization operation is detected, the waiting time synchronization device sends a termination time synchronization request message to the time synchronization device to trigger the time synchronization device to stop sending the pulse time synchronization response message.
[0087] Terminating time synchronization involves deleting the 1PPS+TOD clock reference source, terminating bidirectional port communication between the device to be synchronized and the synchronization device, or deleting the 1PPS+TOD protocol. Terminating bidirectional port communication between the device to be synchronized and the synchronization device involves unplugging the network cable used to transmit 1PPS+TOD protocol messages between the device to be synchronized and the synchronization device, or if the network cable is damaged.
[0088] To facilitate the description of the terminate time synchronization request message, Table 3 shows a message structure of the terminate time synchronization request message:
[0089] Table 3
[0090] From Table 3 we can see that:
[0091] 1) Frame header
[0092] It consists of two bytes. It is fixed as 0x43 0x4D, indicating that the 1PPS+TOD protocol is used.
[0093] 2) Message type and message ID
[0094] It consists of two bytes, fixed as 0x06 0x60. This combination represents the termination of the time synchronization request and is issued by the device to be synchronized.
[0095] 3) Message length
[0096] It consists of two bytes. The effective range of message length calculation includes only the message content, excluding the frame header, message type and ID, message length and check field.
[0097] 4) Message content
[0098] The message content is 0 bytes.
[0099] 5) Verification domain
[0100] Consists of one byte. The check range includes the message header, message length, and frame check field, excluding the frame header. It is padded with zeros when not used. Similarly, the check field can be included or omitted in the message as needed.
[0101] This application does not require the deployment of NTP timing servers and GNSS feeders, and can achieve accurate timing of the equipment to be synchronized by only using the 1PPS+TOD protocol messages transmitted between devices. While reducing the technical requirements for operator engineering site construction, it can also save subsequent operation and maintenance costs. In addition, this application can also generate timing exception information when no pulse timing response message is received to remind maintenance personnel to maintain the timing equipment in time and quickly resume timing use. In addition, this application can also trigger the timing equipment to stop sending pulse timing response messages when the timing operation is terminated, stop the timing equipment from working in time, and reduce the loss of the timing equipment.
[0102] The present disclosure provides a time synchronization device, wherein the device is applied to a device to be synchronized, the device to be synchronized is configured with a 1PPS+TOD clock reference source and a 1PPS+TOD protocol, and the device to be synchronized is in communication with the synchronization device. FIG6 is a block diagram of an embodiment of the time synchronization device provided by the present disclosure. As shown in FIG6 , the device may include:
[0103] A sending recording module 601 is configured to send a pulse synchronization request message to a synchronization device and record a first sending time of the pulse synchronization request message, wherein the pulse synchronization request message includes a synchronization period and a frequency deviation; wherein the frequency deviation is used to represent the timing deviation of the device to be synchronized;
[0104] The receiving module 602 is configured to receive a pulse timing response message sent by the timing device according to the timing cycle trigger; wherein the pulse timing response message and the pulse timing request message are both 1PPS+TOD protocol messages;
[0105] A determination module 603 is configured to determine a message transmission time difference based on the frequency deviation, the first sending time, and the pulse timing response message;
[0106] The time synchronization module 604 is configured to synchronize the time of the device to be synchronized based on the message transmission time difference, so as to achieve time synchronization between the device to be synchronized and the synchronization device.
[0107] The time synchronization device provided by the embodiment of the present disclosure includes: sending a pulse time synchronization request message to a time synchronization device, and recording a first sending time of sending the pulse time synchronization request message, the pulse time synchronization request message including a time synchronization period and a frequency deviation; wherein the frequency deviation is used to characterize the timing deviation degree of the device to be synchronized; receiving a pulse time synchronization response message triggered by the time synchronization device according to the time synchronization period; wherein the pulse time synchronization response message and the pulse time synchronization request message are both 1PPS+TOD protocol messages; determining a message transmission time difference based on the frequency deviation, the first sending time and the pulse time synchronization response message; synchronizing the device to be synchronized based on the message transmission time difference to achieve time synchronization between the device to be synchronized and the time synchronization device. The above-mentioned device to be synchronized is configured with a 1PPS+TOD clock reference source and a 1PPS+TOD protocol. When the device to be synchronized is synchronized with the synchronization device, accurate time synchronization of the device to be synchronized can be achieved by only using the 1PPS+TOD protocol message transmitted between the devices. This application does not require the deployment of an NTP synchronization server and a GNSS feeder to achieve time synchronization between devices, which can reduce the technical requirements for the operator's engineering site construction and save subsequent operation and maintenance costs.
[0108] Figure 7 is a schematic diagram of the structure of a time synchronization device provided by an embodiment of the present disclosure. The electronic device 700 shown in Figure 7 includes: at least one processor 701, memory 702, at least one network interface 704, and other user interfaces 703. The various components in the time synchronization device 700 are coupled together via a bus system 705. It will be understood that the bus system 705 is used to enable connection and communication between these components. In addition to including a data bus, the bus system 705 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, in Figure 7, all various buses are labeled as bus system 705.
[0109] The user interface 703 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touchpad, or a touch screen).
[0110] It is understood that the memory 702 in the embodiment of the present disclosure may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DRRAM). The memory 702 described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0111] In some embodiments, the memory 702 stores the following elements, executable units, or data structures, or a subset thereof, or an extended set thereof: an operating system 7021 and application programs 7022 .
[0112] The operating system 7021 includes various system programs, such as a framework layer, a core library layer, and a driver layer, for implementing various basic services and handling hardware-based tasks. Application programs 7022 include various application programs, such as a media player and a browser, for implementing various application services. Programs implementing the methods of the embodiments of the present disclosure may be included in application programs 7022.
[0113] In the embodiment of the present disclosure, by calling the program or instruction stored in the memory 702, specifically, the program or instruction stored in the application 7022, the processor 701 is used to execute the method steps provided in each method embodiment:
[0114] Sending a pulse synchronization request message to the synchronization device and recording the first sending time of the pulse synchronization request message, wherein the pulse synchronization request message includes a synchronization period and a frequency deviation; wherein the frequency deviation is used to represent the timing deviation of the device to be synchronized;
[0115] Receive the pulse timing response message sent by the timing device according to the timing cycle. The pulse timing response message and the pulse timing request message are both 1PPS+TOD protocol messages.
[0116] Determining a message transmission time difference based on the frequency deviation, the first sending time, and the pulse timing response message;
[0117] The device to be synchronized is synchronized based on the message transmission time difference to achieve time synchronization between the device to be synchronized and the synchronization device.
[0118] In a possible implementation, after receiving the pulse timing response message sent by the timing device according to the timing cycle trigger, the method further includes: recording a first receiving time of the pulse timing response message.
[0119] In one possible implementation, determining the message transmission time difference based on the frequency deviation, the first sending time, and the pulse timing response message includes:
[0120] Parse the pulse timing response message to obtain a second receiving time and a second sending time included in the pulse timing response message; wherein the second receiving time is the time when the timing device receives the pulse timing request message, and the second sending time is the time when the timing device sends the pulse timing response message;
[0121] Determine whether the frequency deviation is a preset frequency deviation;
[0122] If it is determined that the frequency deviation is not the preset frequency deviation, the message transmission time difference is determined based on the frequency deviation, the first sending time, the first receiving time, the second receiving time, and the second sending time.
[0123] In one possible implementation, the method further includes:
[0124] If the frequency deviation is a preset frequency deviation, the message transmission time difference is determined based on the first sending time, the first receiving time, the second receiving time, and the second sending time.
[0125] In one possible implementation, the message transmission time difference includes a first transmission delay of the pulse timing response message and a first time offset from the device to be synchronized to the timing device;
[0126] The message transmission time difference is determined based on the frequency deviation, the first sending time, the first receiving time, the second receiving time, and the second sending time, and is calculated using the following formula: Δtcμ =(t1+t3)-(t0+t2)-(d cs -d sc )-Δt sμ ; d sc =(t1-t3)+(t2-t0)-d cs ;
[0127] Among them, d cs =d sc +Δd μ ;Δt sμ =f dn *Δt cμ ;Δt sμ Indicates the second time deviation between the synchronization device and the device to be synchronized; Δt cμ Indicates the first time deviation; d cs Indicates the second transmission delay of the pulse timing request message; d sc represents the first transmission delay; Δd μ Indicates the transmission delay error between the device to be synchronized and the synchronization device; f dn represents the frequency deviation; t0 represents the first sending time; t1 represents the second receiving time; t2 represents the second sending time; t3 represents the first receiving time.
[0128] In one possible implementation, the message transmission time difference is determined based on the first sending time, the first receiving time, the second receiving time, and the second sending time, and is calculated using the following formula: Δt cμ =[(t1-t0)+(t3-t2)] / 2; d sc =[(t1-t3)+(t2-t0)] / 2;
[0129] Where, Δt cμ Indicates the first time deviation; d sc represents the first transmission delay; t0 represents the first sending time; t1 represents the second receiving time; t2 represents the second sending time; and t3 represents the first receiving time.
[0130] In one possible implementation, synchronizing the time of the device to be synchronized based on the message transmission time difference includes:
[0131] Determining a time synchronization time based on a difference between the second sending time and the message transmission time;
[0132] Correct the first reception time to the synchronized time.
[0133] In one possible implementation, the synchronization time is obtained by the following formula: t=t2+Δt cμ -d sc ;
[0134] Where t represents the synchronization time; t2 represents the second sending time; Δt cμ Indicates the first time deviation; d sc Indicates the first transmission delay.
[0135] In one possible implementation, the method further includes:
[0136] When it is detected that no pulse timing response message is received within the preset time period, a timing abnormality message is generated.
[0137] In one possible implementation, the method further includes:
[0138] When the termination of the time synchronization operation is detected, a termination time synchronization request message is sent to the time synchronization device to trigger the time synchronization device to stop sending the pulse time synchronization response message; the termination time synchronization operation is to delete the 1PPS+TOD clock reference source or terminate the two-way port interconnection between the device to be synchronized and the time synchronization device, or delete the 1PPS+TOD protocol.
[0139] The methods disclosed in the above embodiments of the present disclosure can be applied to or implemented by processor 701. Processor 701 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in processor 701 or by software instructions. The above processor 701 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The methods, steps, and logic block diagrams disclosed in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in conjunction with the embodiments of the present disclosure can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software units in the decoding processor. The software units can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory 702 , and the processor 701 reads the information in the memory 702 and completes the steps of the above method in combination with its hardware.
[0140] It is understood that the embodiments described herein may be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or a combination thereof.
[0141] For software implementation, the technology described herein can be implemented by a unit that performs the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.
[0142] The time synchronization device provided in this embodiment can be the time synchronization device shown in Figure 7, which can execute all the steps of the time synchronization method shown in Figures 4-5, and thus achieve the technical effect of the time synchronization method shown in Figures 4-5. Please refer to the relevant description of Figures 4-5 for details. For the sake of brevity, it will not be repeated here.
[0143] The present disclosure also provides a storage medium (computer-readable storage medium). The storage medium stores one or more programs. The storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, hard disk, or solid-state drive; and the memory may also include a combination of the aforementioned types of memory.
[0144] When one or more programs in the storage medium can be executed by one or more processors, the above-mentioned time synchronization method can be implemented.
[0145] The processor is used to execute the time synchronization program stored in the memory to implement the steps of the time synchronization method:
[0146] Sending a pulse synchronization request message to the synchronization device and recording the first sending time of the pulse synchronization request message, wherein the pulse synchronization request message includes a synchronization period and a frequency deviation; wherein the frequency deviation is used to represent the timing deviation of the device to be synchronized;
[0147] Receive the pulse timing response message sent by the timing device according to the timing cycle. Among them, the pulse timing response message and the pulse timing request message are both 1PPS+TOD protocol messages;
[0148] Determining a message transmission time difference based on the frequency deviation, the first sending time, and the pulse timing response message;
[0149] The device to be synchronized is synchronized based on the message transmission time difference to achieve time synchronization between the device to be synchronized and the synchronization device.
[0150] In one possible implementation, after receiving the pulse timing response message sent by the timing device according to the timing cycle trigger, the method further includes:
[0151] Record the first receiving time of the received pulse timing response message.
[0152] In one possible implementation, determining the message transmission time difference based on the frequency deviation, the first sending time, and the pulse timing response message includes:
[0153] Parse the pulse timing response message to obtain a second receiving time and a second sending time included in the pulse timing response message; wherein the second receiving time is the time when the timing device receives the pulse timing request message, and the second sending time is the time when the timing device sends the pulse timing response message;
[0154] Determine whether the frequency deviation is a preset frequency deviation;
[0155] If it is determined that the frequency deviation is not the preset frequency deviation, the message transmission time difference is determined based on the frequency deviation, the first sending time, the first receiving time, the second receiving time, and the second sending time.
[0156] In one possible implementation, the method further includes:
[0157] If the frequency deviation is a preset frequency deviation, the message transmission time difference is determined based on the first sending time, the first receiving time, the second receiving time, and the second sending time.
[0158] In one possible implementation, the message transmission time difference includes a first transmission delay of the pulse timing response message and a first time offset from the device to be synchronized to the timing device;
[0159] The message transmission time difference is determined based on the frequency deviation, the first sending time, the first receiving time, the second receiving time, and the second sending time, and is calculated using the following formula: Δt cμ =(t1+t3)-(t0+t2)-(d cs -d sc )-Δt sμ ; dsc =(t1-t3)+(t2-t0)-d cs ;
[0160] Among them, d cs =d sc +Δd μ ;Δt sμ =f dn *Δt cμ ;Δt sμ Indicates the second time deviation between the synchronization device and the device to be synchronized; Δt cμ Indicates the first time deviation; d cs Indicates the second transmission delay of the pulse timing request message; d sc represents the first transmission delay; Δd μ Indicates the transmission delay error between the device to be synchronized and the synchronization device; f dn represents the frequency deviation; t0 represents the first sending time; t1 represents the second receiving time; t2 represents the second sending time; t3 represents the first receiving time.
[0161] In one possible implementation, the message transmission time difference is determined based on the first sending time, the first receiving time, the second receiving time, and the second sending time, and is calculated using the following formula: Δt cμ =[(t1-t0)+(t3-t2)] / 2; d sc =[(t1-t3)+(t2-t0)] / 2;
[0162] Where Δt cμ Indicates the first time deviation; d sc represents the first transmission delay; t0 represents the first sending time; t1 represents the second receiving time; t2 represents the second sending time; and t3 represents the first receiving time.
[0163] In one possible implementation, synchronizing the time of the device to be synchronized based on the message transmission time difference includes:
[0164] Determining a time synchronization time based on a difference between the second sending time and the message transmission time;
[0165] Correct the first reception time to the synchronized time.
[0166] In one possible implementation, the synchronization time is obtained by the following formula: t=t2+Δt cμ -d sc ;
[0167] Where t represents the synchronization time; t2 represents the second sending time; Δt cμ Indicates the first time deviation; d sc Indicates the first transmission delay.
[0168] In one possible implementation, the method further includes:
[0169] When it is detected that no pulse timing response message is received within the preset time period, a timing abnormality message is generated.
[0170] In one possible implementation, the method further includes:
[0171] When the termination of the time synchronization operation is detected, a termination time synchronization request message is sent to the time synchronization device to trigger the time synchronization device to stop sending the pulse time synchronization response message; the termination time synchronization operation is to delete the 1PPS+TOD clock reference source or terminate the two-way port interconnection between the device to be synchronized and the time synchronization device, or delete the 1PPS+TOD protocol.
[0172] Professionals should also be further aware that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this disclosure.
[0173] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0174] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present disclosure in detail. It should be understood that the above description is only a specific implementation method of the present disclosure and is not intended to limit the scope of protection of the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure should be included in the scope of protection of the present disclosure.
Claims
1. A time synchronization method, the method is applied to a device to be synchronized, the device to be synchronized is configured with a 1PPS+TOD clock reference source and a 1PPS+TOD protocol, and the device to be synchronized is in communication connection with the synchronization device; the method comprises: Sending a pulse time synchronization request message to the time synchronization device, and recording a first sending time of sending the pulse time synchronization request message, wherein the pulse time synchronization request message includes a time synchronization period and a frequency deviation; wherein the frequency deviation is used to characterize the timing deviation degree of the device to be synchronized; Receive a pulse timing response message sent by the timing device according to the timing cycle; wherein the pulse timing response message and the pulse timing request message are both 1PPS+TOD protocol messages; Determine a message transmission time difference based on the frequency deviation, the first sending time and the pulse timing response message; The device to be synchronized is synchronized based on the message transmission time difference to achieve time synchronization between the device to be synchronized and the synchronization device.
2. The method according to claim 1, wherein: After receiving the pulse timing response message sent by the timing device according to the timing cycle trigger, the method further includes: The first receiving time of receiving the pulse timing response message is recorded.
3. The method according to claim 2, wherein: The determining of the message transmission time difference based on the frequency deviation, the first sending time and the pulse timing response message comprises: Parse the pulse timing response message to obtain a second receiving time and a second sending time included in the pulse timing response message; wherein the second receiving time is the time when the timing device receives the pulse timing request message, and the second sending time is the time when the timing device sends the pulse timing response message; Determining whether the frequency deviation is a preset frequency deviation; If it is determined that the frequency deviation is not the preset frequency deviation, based on the frequency deviation, the first sending time, the first receiving time, the second receiving time and the second sending time The sending time determines the message transmission time difference.
4. The method according to claim 3, wherein: The method further comprises: If the frequency deviation is the preset frequency deviation, a message transmission time difference is determined based on the first sending time, the first receiving time, the second receiving time, and the second sending time.
5. The method according to claim 4, wherein: The message transmission time difference includes the first transmission delay of the pulse timing response message and the first time deviation from the device to be synchronized to the synchronization device; The message transmission time difference is determined based on the frequency deviation, the first sending time, the first receiving time, the second receiving time and the second sending time, and is calculated by the following formula: Δt cμ =(t1+t3)-(t0+t2)-(d cs -d sc )-Δt sμ ; <h2 style=";text-align:left;direction:ltr">d<h2 style=";text-align:left;direction:ltr"> sc <h2 style=";text-align:left;direction:ltr"> (t1-t3)+(t2-t0)-d<h2 style=";text-align:left;direction:ltr"> cs <h2 style=";text-align:left;direction:ltr"> ; Among them, d cs =d sc +Δd μ ; Δt sμ =f dn *Δt cμ ; Δt sμ represents the second time deviation from the time synchronization device to the device to be synchronized; Δt cμ represents the first time deviation; d cs represents the second transmission delay of the pulse timing request message; d sc represents the first transmission delay; Δd μ represents the transmission delay error between the device to be synchronized and the synchronization device; f dn represents the frequency deviation; t0 represents the first sending time; t1 represents the second receiving time; t2 represents the second sending time; t3 represents the first receiving time.
6. The method according to claim 5, wherein: The message transmission time difference is determined based on the first sending time, the first receiving time, the second receiving time and the second sending time, and is calculated by the following formula: Δt cμ =[(t1-t0)+(t3-t2)] / 2; d sc =[(t1-t3)+(t2-t0)] / 2; Among them, t0 represents the first sending time; t1 represents the second receiving time; t2 represents the second sending time; and t3 represents the first receiving time.
7. The method according to claim 5, wherein: The step of synchronizing the device to be synchronized based on the message transmission time difference includes: Determine a synchronization time based on the second sending time and the message transmission time difference; The first receiving time is corrected to the synchronization time.
8. The method according to claim 7, wherein: The synchronization time is obtained by the following formula: t = t2 + Δt cμ -d sc ; Wherein, t represents the synchronization time; t2 represents the second sending time; Δt cμ represents the first time deviation; d sc Indicates the first transmission delay.
9. The method according to claim 1, wherein: The method further comprises: When it is detected that the pulse timing response message is not received within a preset time period, timing abnormality information is generated.
10. The method according to claim 1, wherein: The method further comprises: When the termination of the time synchronization operation is detected, a termination time synchronization request message is sent to the time synchronization device to trigger the time synchronization device to stop sending the pulse time synchronization response message; wherein, the termination time synchronization operation is to delete the 1PPS+TOD clock reference source or terminate the two-way port interconnection between the device to be synchronized and the time synchronization device or delete the 1PPS+TOD protocol.
11. A time synchronization device, the device being applied to a device to be synchronized, the device to be synchronized being configured with a 1PPS+TOD clock reference source and a 1PPS+TOD protocol, the device to be synchronized being in communication connection with the synchronization device; the device comprising: A sending record module, configured to send a pulse time synchronization request message to the time synchronization device, and record a first sending time of sending the pulse time synchronization request message, wherein the pulse time synchronization request message includes a time synchronization period and a frequency deviation; wherein the frequency deviation is used to characterize the timing deviation degree of the device to be synchronized; A receiving module configured to receive a pulse timing response message sent by the timing device according to the timing cycle; wherein the pulse timing response message and the pulse timing request message are both 1PPS+TOD protocol messages; A determination module, configured to determine a message transmission time difference based on the frequency deviation, the first sending time and the pulse timing response message; The time synchronization module is configured to synchronize the time of the device to be synchronized based on the message transmission time difference, so as to achieve time synchronization between the device to be synchronized and the synchronization device.
12. A time synchronization device, comprising: A processor and a memory, wherein the processor is used to execute a time synchronization program stored in the memory to implement the time synchronization method according to any one of claims 1 to 10.
13. A readable storage medium storing one or more programs, wherein the one or more programs can be executed by one or more processors to implement the time synchronization method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Time compensation method, device and system
CN102082655A
Time synchronization method, client and computer readable storage medium
CN108737006A
System time synchronization device and method in packet transport network
WO2014048167A1
