CN-122027068-A - Time service synchronization method, computer readable storage medium and electronic equipment
Abstract
The invention discloses a time service synchronization method, a computer readable storage medium and electronic equipment, wherein a slave machine starts a high-frequency SPXO clock source based on the timing of the low-frequency SPXO clock source in each preset period and is aligned to the low-frequency clock time after buffering, a high-frequency clock receiving window, a synchronization packet sending time length, a preset TOF correction window timing value and a latest TOF value are combined to calculate the planned output time of a pulse time service signal, a synchronization packet sent by a host machine is received before the planned time, the correction output time is determined according to the receiving time, the TOF correction window timing value and the TOF value, the host machine sends a pulse to the slave machine after the synchronization packet is sent and passes through the TOF correction window, correction and planning time deviation is calculated, the low-frequency SPXO clock source and the high-frequency SPXO clock source are respectively subjected to clock discipline through the multi-period deviation values, the time service synchronization of the slave machine and the host machine is realized, and the high-frequency SPXO clock source is closed after the completion.
Inventors
- Tong Yabo
- ZHOU WANFENG
- XU HAI
- CHEN YONGWEI
- WANG YANKAI
- HUA GAOJIAN
- BAI WEIWEI
- JIANG LEI
- LIN FENGYAN
- Fan Lianghong
Assignees
- 杭州海联物联科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260414
Claims (10)
- 1. The time service synchronization method is used for a slave in a LoRa time service synchronization network, wherein the slave comprises a low-frequency SPXO clock source and a high-frequency SPXO clock source, and is characterized by comprising the following steps: In each preset period, responding to a timing signal of the low-frequency SPXO clock source, starting the high-frequency SPXO clock source, and aligning the high-frequency SPXO clock source to the low-frequency SPXO clock source after starting a preset buffer time; determining the planned output time of the pulse time service signal according to the receiving window timing value of the high-frequency SPXO clock source, the sending duration time value of the synchronous information packet, the preset ToF correction window timing value and the latest measured ToF value of the slave; Responding to a synchronous information packet sent by a host in the LoRa time service synchronous network before the planned output time, and determining the corrected output time of a pulse time service signal according to the receiving time of the synchronous information packet, the ToF corrected window timing value and the ToF value, wherein the ToF is the one-way transmission time between the slave and the host, and the host also sends the pulse time service signal to the slave after the ToF corrected window timing value after the synchronous information packet is sent; Determining a time deviation value of the corrected output time and the planned output time in the current period; According to the time deviation values determined in a preset number of periods, respectively carrying out clock taming on the low-frequency SPXO clock source and the high-frequency SPXO clock source so as to synchronize time service of the slave machine and the master machine; and closing the high-frequency SPXO clock source.
- 2. The time service synchronization method according to claim 1, wherein the synchronization packet further carries temperature data, and the clock training is performed on the low-frequency SPXO clock source and the high-frequency SPXO clock source according to the time offset value determined in the preset number of periods, so that the slave and the master are time service synchronized, respectively, including: And respectively carrying out clock taming on the low-frequency SPXO clock source and the high-frequency SPXO clock source according to the time deviation value determined in a preset number of periods and the temperature data carried in the synchronous information packet so as to synchronize the time service of the slave machine and the master machine.
- 3. The time service synchronization method according to claim 1, wherein the clock taming the low frequency SPXO clock source according to the time offset value determined in the preset number of periods includes: screening effective time deviation values from the time deviation values determined in a preset number of periods; Calculating an SPXO clock source offset value according to the average value of the effective time offset values and the output period of the pulse time service signal; And correcting the trigger time value of the timing signal of the low-frequency SPXO clock source according to the SPXO clock source offset value.
- 4. The time service synchronization method according to claim 1, wherein the clock taming the high frequency SPXO clock source according to the time offset value determined in the preset number of periods includes: screening effective time deviation values from the time deviation values determined in a preset number of periods; and performing second-order hysteresis control on the timing value of the receiving window of the high-frequency SPXO clock source according to the average value of the effective time deviation values and the average value of the effective time deviation values which are determined for many times in the history period.
- 5. The timing synchronization method according to claim 1, wherein the corrected output time of the pulse timing signal is determined by the following formula: (1); in the case of the formula (1), Indicating a corrected output time of the pulse time service signal, Indicating the time of receipt of the synchronization packet, Indicating the preset ToF correction window timing value.
- 6. The timing synchronization method of claim 1, wherein the planned output time of the pulse timing signal is determined by the following formula: (2); (3); in the formulas (2) and (3), Representing the planned output time of the pulse time service signal, Representing the receive window timing value, A transmission duration value representing the synchronization packet With the preset The sum of the timing values of the windows is corrected, Indicating the preset ToF correction window timing value.
- 7. The time service synchronization method according to any one of claims 1 to 6, wherein before the clock disciplining is performed on the low frequency SPXO clock source and the high frequency SPXO clock source respectively according to the time deviation values determined in the preset number of periods so that the slave and the master are time service synchronized, the method further comprises outputting a pulse time service signal according to the corrected output time; The method further comprises outputting a pulse time service signal according to the planned output time under the condition that the synchronous information packet sent by a host in the LoRa time service synchronous network is not received before the planned output time.
- 8. The time service synchronization method according to any one of claims 1-6, wherein the slave further comprises a ranging engine, the method further comprising: and measuring the current ToF value by the ranging engine according to a preset measurement period.
- 9. An electronic device comprising one or more processors having one or more computer programs stored thereon, which when executed by the one or more processors, cause the one or more processors to implement the time service synchronization method of any of claims 1-8.
- 10. A computer readable medium on which a computer program is stored, characterized in that the computer program, when executed by a processor, implements the time service synchronization method of any one of claims 1 to 8.
Description
Time service synchronization method, computer readable storage medium and electronic equipment Technical Field The invention relates to the technical field of wireless time service, in particular to a time service synchronization method, a computer readable storage medium and electronic equipment. Background The wireless time service technology aims at realizing high-precision time synchronization among distributed devices, and transmits time information in a wireless communication mode, so that local clocks of a plurality of devices or systems distributed at different positions in space keep consistent time references, technical support is provided for cooperative work of the distributed devices or systems, the problem of time synchronization requirement is solved, and in recent years, the wireless time service technology is widely applied in scenes of industrial detection, fault indication and the like, and important application value is shown. The common wireless time service method is mainly based on a global navigation satellite system (Global Navigation SATELLITE SYSTEM, GNSS), a global positioning system (Global Positioning System, GPS) receiving module with a time service function is arranged at the equipment end, high-precision time signals broadcast by satellites are received, nanosecond high-precision time synchronization is achieved, in addition, a method based on a high-precision local clock source combined with a wireless communication module is also provided, a high-precision local clock source such as a temperature compensation crystal oscillator (Temperature Compensated Crystal Oscillator, TCXO) (precision <2 pmm) and a constant temperature crystal oscillator (Oven Controlled Crystal Oscillator, OCXO) (precision <0.1 ppm) is arranged at each network node, a host periodically transmits messages with known length through a wireless module, and delay is deducted after the messages are received by a slave to complete time synchronization. However, due to the comprehensive requirements of the wireless timing scene on low power consumption, low cost, environmental adaptability and high precision time synchronization, the above technical schemes have the problem that multiple requirements are difficult to be considered, so the wireless timing technology still faces serious challenges in diversified scene application. Disclosure of Invention The present invention aims to solve one of the technical problems in the related art to a certain extent. Therefore, the invention provides a time service synchronization method, a computer readable storage medium and electronic equipment, which have the advantages of ensuring high-precision time service and simultaneously realizing effective reduction of power consumption and cost. In order to achieve the above purpose, the invention adopts the following technical scheme: a time service synchronization method for a slave in a LoRa time service synchronization network, the slave including a low frequency SPXO clock source and a high frequency SPXO clock source, the time service synchronization method comprising: In each preset period, responding to a timing signal of the low-frequency SPXO clock source, starting the high-frequency SPXO clock source, and aligning the high-frequency SPXO clock source to the low-frequency SPXO clock source after starting a preset buffer time; determining the planned output time of the pulse time service signal according to the receiving window timing value of the high-frequency SPXO clock source, the sending duration time value of the synchronous information packet, the preset ToF correction window timing value and the latest measured ToF value of the slave; Responding to a synchronous information packet sent by a host in the LoRa time service synchronous network before the planned output time, and determining the corrected output time of a pulse time service signal according to the receiving time of the synchronous information packet, the ToF corrected window timing value and the ToF value, wherein the ToF is the one-way transmission time between the slave and the host, and the host also sends the pulse time service signal to the slave after the ToF corrected window timing value after the synchronous information packet is sent; Determining a time deviation value of the corrected output time and the planned output time in the current period; According to the time deviation values determined in a preset number of periods, respectively carrying out clock taming on the low-frequency SPXO clock source and the high-frequency SPXO clock source so as to synchronize time service of the slave machine and the master machine; and closing the high-frequency SPXO clock source. Optionally, the synchronization packet further carries temperature data, and clock taming is performed on the low-frequency SPXO clock source and the high-frequency SPXO clock source according to time deviation values determined in a preset number of periods, so that the