The present application relates to the field of time synchronization, and in particular to a clock quartz oscillator synchronization method, apparatus and system for calculation, estimation, correction, compensation of time deviation caused by the clock quartz oscillator.
Before the calculation unit is used for some works such as data analysis, an external apparatus like a sensor is usually used to collect data to be processed, and transmit it to the calculation unit to save and wait for processing. All hardware of sensors are provided with clock, as well as the calculation unit are provided with its own clock, when a connection is established between the sensor and the calculation unit, it cannot be avoided that the clock of them will be naturally asynchronous so that the time deviation occurs, which results in large delay or advance of data transmission between the sensor and the calculation unit.
A commonly used solution is that the sensor adjusts its clock according to the clock in calculation unit, which synchronizes the clock in the sensor to the clock in the calculation unit to reduce the time deviation between the sensor and the calculation unit.
However, with the gradual development of the use demand and technology of the project, when a plurality of sensors are in data exchange with a plurality of calculation units, or different calculation units are needed to be replaced in a project to calculate, it is hard to ensure that all clocks in each calculation unit can be entirely identical, if the sensor is synchronous with its connected calculation unit, finally the time of measurement data collected by sensors connected with different calculation units occurs corresponding deviation, which causes a difficulty in subsequent processing of measurement data collected by all of the sensors.
To reduce the time deviation when one or more sensors and one or more calculation units are in data exchange together, the present application provides a clock quartz oscillator synchronization method, system and apparatus for calculation, estimation, correction, compensation of time deviation caused by the clock quartz oscillator.
In a first aspect, a clock quartz oscillator synchronization method provided in the present application adopts the following technical solution:
A lock quartz oscillator synchronization method, comprising:
By adopting the above technical solution, firstly the calculation unit time is synchronized with the network clock time to ensure the accuracy of the calculation unit time, then the sensor time is synchronized with the calculation unit time to ensure that all sensor times are kept in synchronization with the network clock time, which can reduce the time deviation when one or more sensor exchange data via one or more calculation unit, improve the accuracy and applicability of measurement data, and facilitate the integration and processing of measurement data.
Optionally, calculating a first deviation between a calculation unit time and a network clock time comprises:
Optionally, calculating and recording a network delay at intervals of a first preset time comprises:
Optionally, calculating the first deviation between the calculation unit time and the network clock time according to the network delay at intervals of a second preset time comprises:
-th network delay d, continuously acquiring
values of the network delays in the delay data set;
Optionally, calculating a second deviation between the calculation unit time and a sensor time comprising:
Optionally, at intervals of a fourth preset time, according to each maximum value of the first difference value in the third preset time and the data sending time corresponding to the maximum value of the first difference value, calculating the second deviation between the sensor time and the calculation unit time comprising:
Optionally, calculating an actual interruption frequency of the sensor comprising:
In a second aspect, a clock quartz oscillator synchronization apparatus provided in the present application adopts the following technical solution:
By adopting the above technical solution, the apparatus separately synchronizes with the time of calculation unit and the sensor, after the synchronization, the sensor is able to upload the data to be processed, collected by itself, to the calculation unit, providing the clock quartz oscillator synchronization apparatus separately can also facilitate the management of the apparatus to complete the method in the first aspect.
In a third aspect, a clock quartz oscillator synchronization system provided in the present application adopts the following technical solution:
By adopting the above technical solution, the clock quartz oscillator synchronization apparatus in the system separately synchronizes its time with the calculation unit and the sensor. After the synchronization, the sensor is able to upload the data to be processed, collected by itself, to the calculation unit, which makes all sensor and calculation unit be in time synchronization and have no time deviation, so that the reliability of clock synchronization is improved, and the complexity of calculation is reduced.
In summary, the present application includes at least one of the following beneficial technical effects:
1. All calculation units participated in the project are in time synchronization with network clock, then the sensor and the calculation unit are in time synchronization, to ensure all sensor times and the network times are in synchronization, which reduces the deviation between each of the sensor measurement data.
2. After the time synchronization between the calculation unit and the sensor, the actual refresh frequency in the apparatus and the actual interruption frequency in the sensor are adjusted, and the updated actual refresh frequency and the actual interruption frequency will be used in next synchronization to synchronize, so that the stability of the whole system is improved, and the calculation complexity is reduced.
For a clear understanding of purpose, technical solution and advantage in present application, the present application will be further described in detail in combination with
The embodiment in present application provides a clock quartz oscillator synchronization method, including:
Referring to
S100: when a calculation unit is in network connection, establishing a connection between the calculation unit and the network clock, calculating a network delay between the calculation unit and the network clock and recording it at intervals of a first preset time.
Network clock, taking a Network Time Protocol Server as an example, is an agreement configured to synchronize the calculation unit, which makes the calculation unit synchronize its server or clock source and provides a high precision time correction.
S200: calculating the first deviation x1 between the calculation unit time and the network clock time according to the network delay at intervals of a second preset time. In particular, a second preset time includes a plurality of first preset time.
S300: updating a fundamental deviation x0 according to the first deviation x1 and calculating an actual refresh frequency h1.
The initial value of the fundamental deviation is zero, after the calculation of first deviation, if the absolute value of the first deviation is smaller than or equal to a preset threshold value (for example 100), the value of the first deviation is reasonable, the value of the first deviation is used to update the fundamental deviation. If the calculated absolute value of the first deviation is larger than the preset threshold value, the value of the first deviation is unreasonable, which is not used for update of the fundamental deviation. Tick frequency is an index of clock, which represents a refresh frequency of clock within one second in the calculation unit, and an interruption frequency of clock within one second in the sensor.
S400: updating a fundamental deviation according to the first deviation, particularly the updated calculation unit time is equal to the sum of the calculation unit time and fundamental deviation before update.
S500: when being connected with the sensor, continuously obtaining a data sending time of the sensor and a data receiving time when the calculation unit receive the corresponding data, calculating a first difference value between each of the data receiving time and the data sending time, determining a maximum value of the first difference value within a third preset time at intervals of the third preset time.
The data receiving time represents to the time when the sensor sends the data, which is measured by itself and to be processed, to the calculation unit, the data receiving time represents to the time when the calculation unit receives the data to be processed from the sensor.
S600: at intervals of a fourth preset time, according to each maximum value of the first difference value in the third preset time and the corresponding data sending time, calculating the second deviation x2 between the sensor time and the calculation unit time; in particular the fourth preset time includes a plurality of the third preset times.
S700: according to the second deviation x2, updating the sensor time. In particular, the updated sensor time is equal to the sum of the sensor time and the second deviation before update.
S800: according to the second deviation, calculating an actual interruption frequency f1 of the sensor.
The interruption frequency f of the sensor represents to an interruption frequency of signal transmission within one second in the sensor, a fundamental interruption frequency is saved in the sensor.
In present embodiment, S800 includes:
In S100 of embodiment in present application, a network delay calculation method includes:
Referring to
S210, sorting all network delays d in the second preset time in an ascending order to determine a delay data set, and counting a total amount of all network delays d in the second preset time as n.
S220, establishing a fundamental data set by, starting from the
-th network delay d, continuously acquiring
values of the network delays in the delay data set.
S230, according to the fundamental data set, calculating values of operation tick and drift tick corresponding to each network delay d in fundamental data set, and determining an operation tick difference set and a drift tick difference set. In particular, tick is a kind of relative time unit, which corresponds to a specific time related to the calculation unit.
S240: determining a first deviation fitting line according to the operation tick difference set and the drift tick difference set, calculating a first gradient of the first deviation fitting line, multiplying the first gradient by 106 to obtain the first deviation x1 between the calculation unit time and the network clock time.
Every data in the operation tick difference set are taken as an abscissa, the data corresponding to the operation tick difference set in the drift tick difference set are taken as an ordinate to be in linear fitting, the first deviation fitting line is determined, the first gradient of the first deviation fitting line reflects the ratio between the drift tick variation and the operation tick variation, which is the first deviation between the calculation unit time and the network clock time.
In embodiment of present application, the S230 includes:
In particular, the operation tick is equal to the sum of T3 and the fundamental time difference, particularly:
The drift tick is equal to the difference between T4 and operation tick, particularly,
Each data in operation tick set and drift tick set is correspondingly made difference with the first data in operation tick set and the drift tick set, to determine an operation rick difference set and a drift tick difference set.
In S300 of embodiment in present application, a method for calculating an actual refresh frequency includes:
the initial refresh frequency h0 is a preset value;
Referring to
S610: in an interval of the fourth preset time, according to the maximum value of the first difference value in each third preset time and the data sending time corresponding to the maximum value of the first difference, correspondingly determining a first difference value set and a data sending time set.
Each data in the first difference set is equal to the product of corresponding first difference value and 106, each data in the data sending time set is a data sending time when the sensor corresponding to each first difference value sends data to be processed to the calculation unit.
S620: determining a second deviation fitting line according to the first difference value set and the data sending time set, calculating a second gradient of the second deviation fitting line, in particular, the second deviation x2 between the sensor time and the calculation time is equal to the second gradient.
Every data in the data sending time set are taken as an abscissa, the data corresponding to the data sending time set in the first difference set are taken as an ordinate to be in linear fitting, the first deviation fitting line is determined, the second gradient of the second deviation fitting line reflects the ratio between the data sending time and the first difference value, which is the first deviation between the sensor and the calculation unit.
The embodiment in present application further provides a clock quartz oscillator synchronization apparatus, referring to
The embodiment in present application provides a clock quartz oscillator synchronization system, referring to
In embodiment of present application, the clock quartz oscillator synchronization apparatus 10 can be provided on the calculation unit 30, the memory 11 and processor 12 of the clock quartz oscillator synchronization apparatus 10 is the memory and processor of the calculation unit 30.
The above are the preferred embodiments of the present application, and do not limit the protection scope of the present application, any one of the features disclosed in present description (including the abstract and the FIGs), unless specially described, can be replaced with other equivalent or similar alternative features. It means that, unless specially described, each feature is only an example within a series of equivalent or similar features.
Number | Date | Country | Kind |
---|---|---|---|
202111343650.2 | Nov 2021 | CN | national |
The present application is a continuation of PCT application No. PCT/CN2022/097367, filed on Jun. 7, 2022, which claims the priority benefit of China patent application No. 202111343650.2, filed on Nov. 13, 2021. The entireties of PCT application No. PCT/CN2022/097367 and China patent application No. 202111343650.2 are incorporated herein by reference and made a part of this specification.
Number | Name | Date | Kind |
---|---|---|---|
20160352388 | Lane | Dec 2016 | A1 |
Number | Date | Country |
---|---|---|
101588628 | Nov 2009 | CN |
102833062 | Dec 2012 | CN |
113055117 | Jun 2021 | CN |
113645683 | Nov 2021 | CN |
114035740 | Feb 2022 | CN |
2021220034 | Nov 2021 | WO |
Entry |
---|
Machine translation of CN-113055117A (Year: 2021). |
Supplementary European Search Report cited in European Patent Application No. 22822258.4, mailed Dec. 11, 2023, 4 pages. |
Number | Date | Country | |
---|---|---|---|
20230155807 A1 | May 2023 | US |
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2022/097367 | Jun 2022 | WO |
Child | 18086928 | US |