Crystal oscillator counting determination method based on crystal oscillator aging characteristic correlation, high-precision time keeping method and device thereof

By generating and matching the counting curves before and after crystal oscillator aging, the target crystal oscillator count is determined, which solves the punctual accuracy deviation caused by insufficient crystal oscillator aging in the power system, and achieves high-precision time synchronization.

CN120386167APending Publication Date: 2025-07-29XJ ELECTRIC CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510384547.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-28
Publication Date
2025-07-29

AI Technical Summary

Technical Problem

When the crystal oscillator is insufficient and the external reference timing signal is lost, the existing power system time synchronization device has a problem of long-term punctual accuracy deviation.

Method used

By generating the count curves of the crystal oscillator before and after aging, select the curve segment with the highest correlation as the target count curve segment, determine several target crystal oscillator counts, and perform punctual operations based on these counts, and use the stored count curves to match to achieve high-precision punctuality.

Benefits of technology

In the case of losing the external reference timing signal, the accuracy and punctuality of the crystal oscillator counting are improved, effectively avoiding the counting deviation caused by insufficient aging of the crystal oscillator.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120386167A_ABST
    Figure CN120386167A_ABST
Patent Text Reader

Abstract

The invention relates to a crystal oscillator counting determination method based on crystal oscillator aging characteristic correlation, a high-precision time keeping method and a device thereof, and the method comprises the steps: obtaining crystal oscillator counting at a set interval when an external reference time synchronization signal exists, and generating a first counting curve of a crystal oscillator in a first time period; after the first counting curve is generated, before the aging of the crystal oscillator is completed, and when the crystal oscillator loses an external reference time synchronization signal, selecting a newly acquired crystal oscillator count in a set range from all acquired crystal oscillator counts, and generating a second counting curve; selecting a curve segment having the highest correlation with the second counting curve from the first counting curve as a target counting curve segment; and determining a plurality of target crystal oscillator counts according to the target counting curve segment, and executing time keeping operation according to the plurality of target crystal oscillator counts, so that highly accurate time keeping actuarial is realized, the time keeping performance is improved, and the problem of crystal oscillator counting deviation caused by insufficient aging of the crystal oscillator and loss of an external reference time setting signal is effectively avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for determining crystal oscillator counting based on the correlation of crystal oscillator aging characteristics, a high-precision timekeeping method and a device thereof, and belongs to the field of power equipment. Background Art

[0002] To ensure the safe and stable operation of the power system, power equipment such as relay protection devices and substation integrated automation systems have corresponding time synchronization and timekeeping requirements, among which the timekeeping requirements of substation clock synchronization devices and merging units are the highest.

[0003] At present, the timekeeping method of the time synchronization device applied to the power system mainly depends on the performance of the oven-controlled crystal oscillator. The technical solution is as follows: when the external reference time synchronization signal of the device is normal, the frequency of the crystal oscillator is measured and recorded; when the device loses the external reference time synchronization signal, the device outputs a clock signal by adopting an adaptive crystal oscillator frequency timekeeping method according to the crystal oscillator frequency measured during synchronization. The adaptive crystal oscillator frequency timekeeping method has a high timekeeping accuracy for short time periods of minutes, but there is a large deviation in the timekeeping accuracy for long time periods of hours. Especially when the operation time of the device is short and the aging time of the crystal oscillator is insufficient, when the external reference time synchronization signal is lost, the output frequency will deviate over time, resulting in the timekeeping deviation often not meeting the relevant standard requirements. Summary of the Invention

[0004] The purpose of the present invention is to provide a method for determining crystal oscillator counting based on the correlation of crystal oscillator aging characteristics, a high-precision timekeeping method and a device thereof, so as to accurately determine the crystal oscillator counting and perform high-precision timekeeping operations when the crystal oscillator has not completed aging.

[0005] To achieve the above purpose, on the one hand, the present invention provides a high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics, including:

[0006] When there is an external reference time synchronization signal, obtain crystal oscillator counting at a set interval and generate a first counting curve of the crystal oscillator within a first time period;

[0007] After generating the first counting curve and before the crystal oscillator completes aging, when the crystal oscillator loses the external reference time synchronization signal, select the latest obtained crystal oscillator counting within a set range from all the obtained crystal oscillator counting to generate a second counting curve; select the curve segment with the highest correlation with the second counting curve from the first counting curve as the target counting curve segment; determine a number of target crystal oscillator counting according to the target counting curve segment, and perform timekeeping operations according to the number of target crystal oscillator counting.

[0008] Further, starting from the starting position of the first counting curve, curve segments having the same length as the second counting curve are sequentially intercepted on the first counting curve at the set interval as the step size; the correlation coefficient between each curve segment and the second counting curve is calculated, and the curve segment with the highest correlation coefficient is determined as the target counting curve segment.

[0009] Further, starting from the starting position of the target counting curve segment, a plurality of target oscillator counts are selected in chronological order.

[0010] Further, after the oscillator completes aging, when the oscillator loses the external reference pair signal, several latest obtained target oscillator counts are selected from all the obtained oscillator counts, and a timekeeping operation is performed according to the several target oscillator counts.

[0011] Further, the several target oscillator counts are 120 oscillator counts.

[0012] On the other hand, the present invention proposes a high-precision timekeeping device based on the correlation of oscillator aging characteristics, and the device includes a processor for performing the above-mentioned high-precision timekeeping method based on the correlation of oscillator aging characteristics.

[0013] On the other hand, the present invention also proposes a method for determining oscillator counts based on the correlation of oscillator aging characteristics, including:

[0014] When there is an external reference pair signal, oscillator counts are obtained at a set interval, and a first counting curve of the oscillator within a first time period is generated;

[0015] After generating the first counting curve and before the oscillator completes aging, when the oscillator loses the external reference pair signal, the latest obtained oscillator counts within a set range are selected from all the obtained oscillator counts to generate a second counting curve; the curve segment with the highest correlation with the second counting curve is selected from the first counting curve as the target counting curve segment; several target oscillator counts are determined according to the target counting curve segment.

[0016] Further, starting from the starting position of the first counting curve, curve segments having the same length as the second counting curve are sequentially intercepted on the first counting curve at the set interval as the step size; the correlation coefficient between each curve segment and the second counting curve is calculated, and the curve segment with the highest correlation coefficient is determined as the target counting curve segment.

[0017] Further, starting from the starting position of the target counting curve segment, a plurality of target oscillator counts are selected in chronological order.

[0018] Further, after the oscillator completes aging, when the oscillator loses the external reference pair signal, several latest obtained target oscillator counts are selected from all the obtained oscillator counts.

[0019] The beneficial effects of the present invention are as follows: when there is an external reference timing signal, crystal oscillator counts are acquired at set intervals, and a first count curve of the crystal oscillator within a first time period is generated; after generating the first count curve and before the crystal oscillator completes aging, when the crystal oscillator loses the external reference timing signal, the most recently acquired crystal oscillator counts within a set range are selected from all the acquired crystal oscillator counts to generate a second count curve; the curve segment with the highest correlation with the second count curve is selected from the first count curve as the target count curve segment; several target crystal oscillator counts are determined according to the target count curve segment, and a timing operation is performed according to the several target crystal oscillator counts, realizing the matching of the current count curve (i.e., the second count curve) with the stored count curve with an external reference timing signal, and then determining the target crystal oscillator counts from the matched target count curve segment, so as to obtain highly accurate crystal oscillator counts even without an external reference timing signal, thereby completing highly accurate timing calculations according to the crystal oscillator counts, improving the timing performance, and effectively avoiding the problem of crystal oscillator count deviation caused by insufficient crystal oscillator aging and the loss of the external reference timing signal. Description of the Drawings

[0020] Figure 1 is a schematic flow chart of a high-precision timing method based on the correlation of crystal oscillator aging characteristics proposed by the present invention;

[0021] Figure 2 is a schematic flow chart of a high-precision timing method based on the correlation of crystal oscillator aging characteristics in an actual application scenario proposed by the present invention. Detailed Embodiments

[0022] To make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below with reference to the drawings and embodiments.

[0023] The inventive concept of the present invention is as follows: in order to avoid the problem of crystal oscillator count deviation in the case where the external reference timing signal disappears before the crystal oscillator completes aging, a relevant first count curve of the crystal oscillator is generated when there is an external reference timing signal, so as to perform curve segment matching on the second count curve generated later when the external reference timing signal is lost, determine the curve segment with the highest correlation in the matching result as the target count curve segment, and then determine several target crystal oscillator counts for performing the timing operation from the target count curve segment, improving the accuracy of the crystal oscillator count and the accuracy of timing when the external reference timing signal disappears.

[0024] Example 1 of a high-precision timing method based on the correlation of crystal oscillator aging characteristics:

[0025] As Figure 1As shown in the figure, it is a schematic flowchart of a high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics proposed by the present invention, which includes step S11 and step S12. Specifically:

[0026] After the crystal oscillator is installed in its operating device, the device is connected to an external reference time signal, and step S11 is executed. When there is an external reference time signal, the crystal oscillator count is obtained at a set interval, and a first count curve of the crystal oscillator within the first time period is generated. Here, the external reference time signal refers to an external reference source that provides precise time synchronization for a device or system to calibrate its internal clock. Common forms include physical signals, network protocols, and satellite signals. Among them, physical signals include, but are not limited to, IGIB (Inter-Range Instrumentation Group)-B code; network protocols include, but are not limited to, NTP (Network Time Protocol); satellite signals include, but are not limited to, GPS. The present invention preferably uses the B code as the external reference time signal. The obtaining of the crystal oscillator count at a set interval means obtaining the crystal oscillator count at a preset time interval. Specifically, the preset time interval will be set according to different timekeeping standards or different crystal oscillator count requirements, etc. In the present invention, it is preferably to obtain the crystal oscillator count at an interval of 1 second. Similarly, the setting of the first time period can also be independently set according to different timekeeping standards or different crystal oscillator count requirements. In the present invention, the first time period is preferably 24 hours. The generated first count curve is a curve with the abscissa being time and the ordinate being the crystal oscillator count.

[0027] At the same time, it should be noted that when there is an external reference time signal, the count megahertz of the crystal oscillator per second / minute can be analyzed according to the external reference time signal, that is, it can be analyzed how many megahertz the crystal oscillator frequency is within one second / one minute, so as to generate the first count curve within the first time period.

[0028] Next, the crystal oscillator has the characteristic that its service life is proportional to its stability, that is, the longer the service life, the more stable the crystal oscillator and it tends to age, that is, the older the crystal oscillator, the more stable it is. At the same time, when the device where the crystal oscillator is located stops powering on and running, the stability of the crystal oscillator will change. For example, the first power-on running time of the device where the crystal oscillator is located has made the crystal oscillator stable, but after the stable crystal oscillator stops running, its stability will gradually decrease. Therefore, in order to identify whether the crystal oscillator is aging, it can be analyzed and judged according to the crystal oscillator service life or crystal oscillator-related parameters. In this application, it is preferably to judge whether the crystal oscillator is aging by the crystal oscillator service life. A service life threshold for judging whether the crystal oscillator has completed aging is set. When the service life of the device where the crystal oscillator is located during power-on running reaches the service life threshold, it is determined that the crystal oscillator is a crystal oscillator that has completed aging, that is, the crystal oscillator is stable; when the service life of the device where the crystal oscillator is located during power-on running does not reach the service life threshold, it is determined that the crystal oscillator is a crystal oscillator that has not completed aging, that is, the crystal oscillator is unstable.

[0029] For an unstable crystal oscillator, if the external reference time signal is lost during the power-on operation of the device equipped with the unstable crystal oscillator, it will be impossible to know the crystal oscillator count situation of the unstable crystal oscillator in real time, and thus it will be impossible to perform the timekeeping operation. Therefore, step S12 is executed. After generating the first count curve and before the crystal oscillator completes aging, when the crystal oscillator loses the external reference time signal, select the latest obtained crystal oscillator counts within the set range from all the obtained crystal oscillator counts to generate the second count curve; select the curve segment with the highest correlation with the second count curve from the first count curve as the target count curve segment; determine a number of target crystal oscillator counts according to the target count curve segment, and perform the timekeeping operation according to the number of target crystal oscillator counts; it should be noted that the set range is a set time period range or a set number range of crystal oscillator counts; when the set range is 2 hours (i.e., the set time period range), select the latest obtained crystal oscillator counts for 2 hours from all the obtained crystal oscillator counts to generate the second count curve; when the set range is 3,600 (i.e., the set number range of crystal oscillator counts), select the latest obtained 3,600 crystal oscillator counts from all the obtained crystal oscillator counts to generate the second count curve; of course, whether it is the set time period range or the set number range of crystal oscillator counts, the length of the generated second count curve should be less than that of the first count curve, that is to say, the set time range is less than the first time period; the set number range of crystal oscillator counts is less than the total number of crystal oscillator counts obtained within the first time period (for example, if the first time period is 24 hours, then the set number range of crystal oscillators should be less than 86,400). In the actual application scenario, the "performing the timekeeping operation according to the number of target crystal oscillator counts" means calculating the average count value of the number of target crystal oscillator counts, and distributing the remainder generated when calculating the average count value among the number of target crystal oscillator counts, and then parsing and outputting the time for the distributed number of target crystal oscillator counts to complete the timekeeping operation and achieve the smoothing processing of the target crystal oscillator counts; at the same time, when determining the number of target crystal oscillator counts, the number of crystal oscillator counts will be selected according to different timekeeping standards or crystal oscillator requirements. In the present invention, it is preferred that the number of target crystal oscillator counts is 120 target crystal oscillator counts. In the actual reference scenario, 120 target crystal oscillator counts achieve the maximum selection of stable crystal oscillator counts, and achieve the execution requirement of accurate timekeeping operation under the condition of not occupying a large storage space.

[0030] At the same time, in the actual application scenario, the Pearson correlation coefficient will be used to calculate the correlation between the first count curve and the second count curve. Specifically, assume that the ordinate data of Curve2 (the second count curve) and Curve3 (the count curve intercepted from the first count curve with the same length as the second count curve) are data X = {X1,..., X 7200} and Y = {Y1,..., Y7200}, then the Pearson correlation coefficient can be calculated by the following formula:

[0031]

[0032] Where, X i is the ordinate value of the i-th data in Curve2; Y i is the ordinate value of the i-th data in Curve3.

[0033] In a preferred embodiment of the present invention, the device equipped with a crystal oscillator is initially powered on and running, receives the B-code signal (i.e., the external reference time synchronization signal), and parses the second pulse signal corresponding to the B-code signal; at the same time, starts to obtain the crystal oscillator count at 1-second intervals, stores the obtained crystal oscillator count in Buffer1 (the first buffer), preferably the first time period is 24 hours. When the crystal oscillator count data is full for 24 hours, 86,400 (24 * 60 * 60 = 86,400) crystal oscillator count data in Buffer1 is used to generate Curve1 (the first count curve); after generating Curve1, Buffer1 continues to store the crystal oscillator count at 1-second intervals; preferably, when the crystal oscillator has not completed aging, in response to the device losing the B-code signal, select the crystal oscillator count within the latest 2 hours (the set time range) obtained from Buffer1 to generate Curve2; use the Pearson correlation coefficient to select the curve segment Curve3 (i.e., the target count curve segment) with the highest correlation with Curve2 from Curve1; determine 120 ticks (the target crystal oscillator count) from Curve3, and then calculate the mean tick of the 120 ticks ave , and the generated remainder tick y ; Divide tick y equally among the 120 ticks; perform time parsing and output based on the 120 smoothed ticks after sharing the remainder to complete timekeeping.

[0034] Example 2 of the high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics:

[0035] In a high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics provided by the present invention, starting from the starting position of the first count curve, curve segments with the same length as the second count curve are sequentially intercepted on the first count curve at the set interval as the step size; calculate the correlation coefficient between each curve segment and the second count curve, and determine the curve segment with the highest correlation coefficient as the target count curve segment.

[0036] For example, it is preferred that Curve1 is a curve obtained by acquiring crystal oscillator counts once every 1 second interval and with the first time period being 24 hours, which contains 86,400 crystal oscillator counts; it is preferred that Curve2 is a curve with a set range of 7,200 crystal oscillator count numbers, which contains 7,200 crystal oscillator counts; a curve segment Curve3` with a length of 7,200 is intercepted point by point from the starting stage of the abscissa of Curve1, obtaining 79,200 Curve3`; the Pearson correlation coefficient is used to calculate the correlation coefficient between Curve2 and each Curve3`, obtaining a correlation coefficient sequence K = {k1, k2, ……, k 79199 , k 79200}; the maximum value k m is selected from K; k m corresponds to the position in Curve1 where Curve2 has the highest matching correlation, obtaining Curve3.

[0037] Example 3 of the high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics:

[0038] In the high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics provided by the present invention, a number of target crystal oscillator counts are selected in chronological order starting from the starting position of the target count curve segment.

[0039] Following the above embodiment of the present invention, a curve Curve3` with a length of 7,200 is intercepted point by point from the starting stage of the abscissa of Curve1; the Pearson correlation coefficient is used to calculate the correlation coefficient between Curve2 and each Curve3`, and the maximum value k m is selected from all the correlation coefficients; k m corresponds to the position in Curve1 where Curve2 has the highest matching correlation, obtaining Curve3; then 120 ticks are selected in chronological order from the starting position of Curve3 as the target ticks.

[0040] Example 4 of the high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics:

[0041] When the crystal oscillator is stable, in the high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics provided by the present invention, when the crystal oscillator loses the external reference pair time signal, a number of the latest obtained target crystal oscillator counts are selected from all the obtained crystal oscillator counts, and a timekeeping operation is performed according to the number of the target crystal oscillator counts.

[0042] For example, a device installed with a crystal oscillator is powered on and starts running, receiving the B code signal. At the same time, it begins to obtain the crystal oscillator count at 1-second intervals and stores the obtained crystal oscillator count in Buffer1. Preferably, the first time period is 24 hours. After 86,400 crystal oscillator count data in Buffer1 is stored for 24 hours, 86,400 crystal oscillator count data in Buffer1 is used to generate Curve1. After generating Curve1, Buffer1 continues to store the crystal oscillator count at 1-second intervals. Preferably, the crystal oscillator has completed aging, that is, the current crystal oscillator is a stable crystal oscillator. When the crystal oscillator loses the B code signal, the latest N ticks are obtained from Buffer1, and the average value of the N ticks is calculated. Then, the remainder generated by the calculation of the average value is distributed among the N ticks to obtain N tick`. Time parsing and output are performed using N tick` to complete timekeeping.

[0043] Example 5 of the high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics:

[0044] As Figure 2 shown, it is a schematic flowchart of a high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics proposed by the present invention in an actual application scenario. Among them, the device receives an external time synchronization signal, obtains the crystal oscillator count at 1-second intervals and puts it into the buffer area Buffer1; forms a curve Curve2 from the latest crystal oscillator count within a set range in the buffer area Buffer1; obtains the latest 120 crystal oscillator counts in the buffer area Buffer1 and calculates the average value and the remainder; evenly distributes and accumulates the remainder to the 120 average values and puts them into the timekeeping second pulse crystal oscillator buffer area Buffer2 to perform timekeeping operations based on the values in Buffer2.

[0045] When the device has not lost the signal, it continues to parse the external time synchronization signal and puts the crystal oscillator count into the buffer area Buffer1.

[0046] When the device loses the signal, it is judged whether the running time of the device does not exceed 24 hours. If not, it means that the crystal oscillator has aged, and timekeeping operations can be started based on the values in Buffer2. If so, the matching position S of Curve2 in Curve1 is obtained using the correlation algorithm; 120 ticks are obtained in chronological order at the matching position S, and the average value and the remainder of the 120 ticks are calculated; the remainder is distributed to the 120 ticks to obtain 120 tick`; the 120 tick` are put into Buffer2 to perform timekeeping operations based on the values in Buffer2.

[0047] Example 6 of the high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics:

[0048] In actual application scenarios, the present invention can be implemented as follows: 1) When the device is powered on by receiving an external reference time signal (such as B code, etc.), the set value of "storing the aging characteristic curve" of the device is modified from 0 to 1, thereby creating an external reference second pulse oscillator counting buffer Buffer1 and a timekeeping second pulse oscillator buffer Buffer2; 2) Obtain the oscillator count at 1-second intervals and put it into buffer Buffer1; 3) After the device has run for 24 hours, store the 86,400 data in buffer Buffer1 as curve Curve1; the abscissa of curve Curve1 is time, and the ordinate is the oscillator count value. That is, through steps 1) to 3), the generation of Curve1 under the reception of the external reference time signal is completed.

[0049] 4) The device is powered on and operates normally by receiving an external reference time signal, obtains the oscillator count at 1-second intervals and puts it into buffer Buffer1; 5) When the cumulative time exceeds 2 hours, form curve Curve2 from the latest oscillator count in buffer Buffer1, and the abscissa length of Curve2 is ΔT = 7200; 6) Obtain the latest N (N = 120) oscillator count tick values in buffer Buffer1 and calculate the average value as tick ave , and the remainder generated is tick y ; 7) Evenly distribute and accumulate the remainder tick y into the 120 average values tick ave and put them into the timekeeping second pulse oscillator buffer Buffer2 for timekeeping operations. That is, through steps 4) to 7), the timekeeping operation is realized when there is a normal external reference time signal.

[0050] 8) If the device loses the external clock and the device has run for more than 24 hours (i.e., the oscillator is stable), the device sequentially takes out the values in Buffer2 for timekeeping. That is, step 8) realizes directly selecting the oscillator count in Buffer2 to perform the timekeeping operation when losing the external reference time signal but with a stable oscillator.

[0051] 9) If the device loses the external clock and the running time is less than 24 hours (i.e., the oscillator is not stable), intercept a curve segment with a length of ΔT = 7200 from the starting stage of the abscissa of curve Curve1 as Curve3`, and calculate the correlation between curve Curve2 and multiple Curve3` using the Pearson correlation coefficient to obtain a correlation coefficient sequence k = {k1, k2,..., k 79199 , k 79200}; 10) Find the maximum value k 79199 , k 79200 of the correlation coefficient sequence k = {k1, k2,..., k 79199 , k 79200} m , km Determine the target counting curve segment Curve3 according to the matching position S of the corresponding curve Curve2 in the curve Curve1. 11) At the matching position S of the curve Curve1 (i.e., Curve3), obtain 120 oscillator counting tick values in chronological order, and perform the timekeeping operation according to steps 6) and 7). That is, steps 9) to 11) realize high-precision timekeeping calculation by using the matching of the highest correlation position in Curve1 and then using the software timekeeping algorithm when the external reference time signal is lost and the oscillator is unstable.

[0052] 12) As the oscillator runs, select the oscillator counting tick values in chronological order starting from curve3 and continuously slide along the Curve1 curve, so as to continuously obtain 120 oscillator counts. When the slide exceeds the range of the curve Curve1, use the latest oscillator count in Buffer1 to perform timekeeping.

[0053] On the other hand, the present invention also provides a high-precision timekeeping device based on the correlation of oscillator aging characteristics. Wherein, the device includes a processor for executing the above-mentioned high-precision timekeeping method based on the correlation of oscillator aging characteristics to achieve high-precision timekeeping. Here, for the embodiments of the high-precision timekeeping device based on the correlation of oscillator aging characteristics, please refer to Embodiments 1-6 of the above-mentioned high-precision timekeeping method based on the correlation of oscillator aging characteristics, and details will not be repeated here.

[0054] Embodiment 1 of the method for determining oscillator count based on the correlation of oscillator aging characteristics:

[0055] Another invention, the present invention also provides a method for determining crystal oscillator counting based on the correlation of crystal oscillator aging characteristics, which includes: when there is an external reference time signal, obtaining crystal oscillator counting at a set interval and generating a first counting curve of the crystal oscillator within a first time period; here, the external reference time signal refers to an external reference source that provides precise time synchronization for a device or system and is used to calibrate its internal clock. Common forms include physical signals, network protocols, and satellite signals; among them, physical signals include but are not limited to IGIB (Inter-Range Instrumentation Group)-B code; network protocols include but are not limited to NTP (Network Time Protocol); satellite signals include but are not limited to GPS. The present invention preferably uses the B code as the external reference time signal. The obtaining crystal oscillator counting at a set interval means obtaining crystal oscillator counting according to a preset time interval. The specific preset time interval will be set according to different timekeeping standards or different crystal oscillator counting requirements, etc. In the present invention, it is preferably to obtain crystal oscillator counting at an interval of 1 second; similarly, the setting of the first time period can also be independently set according to different timekeeping standards or different crystal oscillator counting requirements. In the present invention, the first time period is preferably 24 hours. The generated first counting curve is a curve with time as the abscissa and crystal oscillator counting as the ordinate.

[0056] At the same time, it should be noted that when there is an external reference time signal, the counting mega-times of the crystal oscillator per second / minute can be analyzed according to the external reference time signal, that is, it can be analyzed how many megahertz the crystal oscillator frequency is within one second / one minute, so as to generate the first counting curve within the first time period.

[0057] Next, the crystal oscillator has the characteristic that its service life is proportional to its stability, that is, the longer the service life, the more stable the crystal oscillator and it tends to age, that is to say, the more aged the crystal oscillator, the more stable it is; at the same time, when the device where the crystal oscillator is located stops powering on and running, the stability of the crystal oscillator will change. For example, the first power-on running time of the device where the crystal oscillator is located has made the crystal oscillator stable, but after the stable crystal oscillator stops running, its stability will gradually decrease. Therefore, in order to distinguish whether the crystal oscillator is aging, it can be analyzed and judged according to the service life of the crystal oscillator or the relevant parameters of the crystal oscillator; in this application, it is preferably to judge whether the crystal oscillator is aging by the service life of the crystal oscillator. Set a service life threshold for judging whether the crystal oscillator has completed aging. When the service life of the device where the crystal oscillator is located during power-on running reaches the service life threshold, it is determined that the crystal oscillator is a crystal oscillator that has completed aging, that is, the crystal oscillator is stable; when the service life of the device where the crystal oscillator is located during power-on running does not reach the service life threshold, it is determined that the crystal oscillator is a crystal oscillator that has not completed aging, that is, the crystal oscillator is unstable.

[0058] For an unstable crystal oscillator, if it loses the external reference time signal during the power-on operation of the device equipped with the unstable crystal oscillator, it will be impossible to know the crystal oscillator counting situation of the unstable crystal oscillator in real time. Therefore, after generating the first counting curve and before the crystal oscillator completes aging, when the crystal oscillator loses the external reference time signal, select the latest obtained crystal oscillator counts within the set range from all the obtained crystal oscillator counts, and generate a second counting curve; select the curve segment with the highest correlation with the second counting curve from the first counting curve as the target counting curve segment; determine several target crystal oscillator counts according to the target counting curve segment; here, starting from the starting position of the first counting curve, intercept curve segments with the same length as the second counting curve on the first counting curve at the set interval as the step size; calculate the correlation coefficient between each curve segment and the second counting curve, and determine the curve segment with the highest correlation coefficient as the target counting curve segment; select several target crystal oscillator counts in chronological order starting from the starting position of the target counting curve segment.

[0059] After the crystal oscillator completes aging, when the crystal oscillator loses the external reference time signal, select several latest obtained target crystal oscillator counts from all the obtained crystal oscillator counts.

[0060] It should be noted that the set range is a set time period range or a set number range of crystal oscillator counts; when the set range is 2 hours (i.e., the set time period range), select the latest obtained crystal oscillator counts for 2 hours from all the obtained crystal oscillator counts and generate a second counting curve; when the set range is 3600 (i.e., the set number range of crystal oscillator counts), select the latest obtained 3600 crystal oscillator counts from all the obtained crystal oscillator counts and generate a second counting curve; of course, whether it is the set time period range or the set number range of crystal oscillator counts, the length of the generated second counting curve should be less than that of the first counting curve, that is, the set time range is less than the first time period; the set number range of crystal oscillator counts is less than the total number of crystal oscillator counts obtained within the first time period (for example, if the first time period is 24 hours, then the set number range of crystal oscillators should be less than 86400). In the actual application scenario, the operation of keeping time according to the several target crystal oscillator counts means calculating the average count value of the several target crystal oscillator counts, distributing the remainder generated when calculating the average count value among the several target crystal oscillator counts, and then parsing and outputting the time of the distributed several target crystal oscillator counts to complete the operation of keeping time and achieve the smoothing processing of the target crystal oscillator counts; at the same time, when determining the several target crystal oscillator counts, the number will be selected according to different timekeeping standards or crystal oscillator requirements. In the present invention, it is preferred that the several target crystal oscillator counts are 120 target crystal oscillator counts.

[0061] Meanwhile, in actual application scenarios, the Pearson correlation coefficient will be used to calculate the correlation between the first count curve and the second count curve. Specifically, assume that the ordinate data of Curve2 (the second count curve) and Curve3 (the count curve intercepted from the first count curve with the same length as the second count curve) are data X = {X1,......, X 7200} and Y = {Y1,......, Y 7200}, then the Pearson correlation coefficient can be calculated by the following formula:

[0062]

[0063] where, X i is the ordinate value of the i-th data in Curve2; Y i is the ordinate value of the i-th data in Curve3.

[0064] In a preferred embodiment of the present invention, the device installed with the crystal oscillator is initially powered on and running, receives the B code signal (i.e., the external reference time synchronization signal), and parses the second pulse signal corresponding to the B code signal; meanwhile, starts to obtain the crystal oscillator count at 1-second intervals, stores the obtained crystal oscillator count in Buffer1 (the first buffer), preferably the first time period is 24 hours. When the crystal oscillator count data is full for 24 hours, 86,400 (24 * 60 * 60 = 86,400) crystal oscillator count data in Buffer1 are used to generate Curve1 (the first count curve); after generating Curve1, Buffer1 continues to store the crystal oscillator count at 1-second intervals.

[0065] When the crystal oscillator has not completed aging, in response to the device losing the B code signal, select the crystal oscillator count within the latest 2 hours (the set time range) obtained from Buffer1 to generate Curve2; use the Pearson correlation coefficient to intercept a curve Curve3` with a length of 7,200 points from the starting stage of the abscissa of Curve1, obtaining 79,200 Curve3`; use the Pearson correlation coefficient to calculate the correlation coefficient between Curve2 and each Curve3`, obtaining the correlation coefficient sequence K = {k1, k2, ……, k 79199 , k 79200}; select the maximum value k m from K; k m corresponds to the position with the highest correlation between Curve2 and Curve1, obtaining Curve3; determine 120 ticks (the target crystal oscillator count) from Curve3.

[0066] When the crystal oscillator has completed aging, in response to the device losing the B code signal, obtain the latest 120 ticks from Buffer1.

[0067] In summary, the present invention pre-measures the 24-hour aging characteristics of the hardware crystal oscillator to obtain curve Curve1 and stores it; when the device is running normally and receiving the external reference time signal, it measures the crystal oscillator count at regular intervals to obtain the 2-hour aging curve Curve2 and updates it in real time; after the external reference time signal of the device disappears and the device starts timing, the correlation algorithm is used to find the matching curve segment of Curve2 in Curve1, and the software timing algorithm uses the aging characteristics corresponding to the position S in Curve1 to obtain the crystal oscillator frequency, determines the high-precision crystal oscillator count by using the stored crystal oscillator count, and then performs the timing calculation by using the highly accurate crystal oscillator count to improve the timing performance of the device.

Claims

1. A high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics, characterized in that, Including: When there is an external reference pair signal, obtain oscillator counts at a set interval, and generate a first count curve of the oscillator within a first time period; After generating the first count curve and before the oscillator completes aging, when the oscillator loses the external reference pair signal, select the latest obtained oscillator counts within a set range from all the obtained oscillator counts to generate a second count curve; select the curve segment with the highest correlation with the second count curve from the first count curve as the target count curve segment; determine a number of target oscillator counts according to the target count curve segment, and perform a timing operation according to the number of target oscillator counts.

2. The high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics according to claim 1, characterized in that Starting from the starting position of the first count curve, sequentially intercept curve segments with the same length as the second count curve on the first count curve at the set interval as the step size; calculate the correlation coefficient between each curve segment and the second count curve, and determine the curve segment with the highest correlation coefficient as the target count curve segment.

3. The high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics according to claim 1, characterized in that Select a number of target oscillator counts in chronological order starting from the starting position of the target count curve segment.

4. The high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics according to claim 1, wherein After the oscillator completes aging, when the oscillator loses the external reference pair signal, select the latest obtained number of target oscillator counts from all the obtained oscillator counts, and perform a timing operation according to the number of target oscillator counts.

5. The high-precision timekeeping method based on the correlation of crystal oscillator aging characteristics according to any one of claims 1-4, characterized in that, The number of target oscillator counts is 120 oscillator counts.

6. A high-precision timekeeping device based on the correlation of crystal oscillator aging characteristics, characterized in that, The device includes a processor for executing the high-precision timing method based on the correlation of oscillator aging characteristics as described in any one of claims 1-5.

7. A method for determining crystal oscillator counting based on the correlation of crystal oscillator aging characteristics, characterized in that, Including: When there is an external reference pair signal, obtain oscillator counts at a set interval, and generate a first count curve of the oscillator within a first time period; After generating the first count curve and before the oscillator completes aging, when the oscillator loses the external reference pair signal, select the latest obtained oscillator counts within a set range from all the obtained oscillator counts to generate a second count curve; select the curve segment with the highest correlation with the second count curve from the first count curve as the target count curve segment; determine a number of target oscillator counts according to the target count curve segment.

8. The method for determining crystal oscillator counting based on the correlation of crystal oscillator aging characteristics according to claim 7, wherein Starting from the starting position of the first count curve, sequentially intercept curve segments with the same length as the second count curve on the first count curve at the set interval as the step size; calculate the correlation coefficient between each curve segment and the second count curve, and determine the curve segment with the highest correlation coefficient as the target count curve segment.

9. The method for determining crystal oscillator counting based on the correlation of crystal oscillator aging characteristics according to claim 7, wherein Select a number of target oscillator counts in chronological order starting from the starting position of the target count curve segment.

10. The method for determining crystal oscillator counting based on the correlation of crystal oscillator aging characteristics according to claim 7, wherein After the oscillator completes aging, when the oscillator loses the external reference pair signal, select the latest obtained number of target oscillator counts from all the obtained oscillator counts.