Real-time clock crystal compensation method and system based on orthogonal least square curve fitting
By using the orthogonal least squares curve fitting method, a temperature compensation function was constructed and a temperature sensor was used for frequency correction. This solved the frequency deviation problem of the timing module of multi-rate smart meters within the temperature variation range, achieving high-precision and stable clock output and reducing production costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HENAN UNIVERSITY
- Filing Date
- 2022-10-31
- Publication Date
- 2026-04-17
AI Technical Summary
The frequency deviation of the timing module in existing multi-rate smart meters cannot meet the accuracy requirements within the temperature variation range. In particular, the lack of temperature compensation mechanism and frequency deviation correction method in the on-chip system leads to poor clock stability.
An orthogonal least squares curve fitting method is used to construct a temperature compensation function. A temperature sensor is used to measure the ambient temperature, and the frequency is corrected by adjusting the number of clocks through a compensation register, thereby realizing temperature compensation and frequency offset correction of the crystal oscillator.
Within the temperature range of -40℃ to 65℃, the timing error is controlled within ±0.1s/d (1.15ppm), meeting the accuracy requirements, reducing production costs, and improving the stability and accuracy of the clock module.
Smart Images

Figure CN115904000B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of smart meter technology, and specifically relates to a real-time clock crystal oscillator compensation method and system based on orthogonal least squares curve fitting. Background Technology
[0002] Multi-rate smart meters, as a crucial component of the power grid, perform a variety of complex functions, including storing electricity consumption data, time-of-use billing, and recording critical events. Therefore, the accuracy of the timing unit in a multi-rate smart meter is paramount, serving as the benchmark for various time-related data calculations. The timing module of a multi-rate smart meter must maintain a deviation within a specified range across its entire operating temperature range. Thus, researching the accuracy of the timing module in multi-rate smart meters is of significant research importance. Domestic multi-rate smart meter solutions fall into two categories: independent clock chips and microcontroller-integrated clock modules, with the latter offering a greater cost advantage.
[0003] The main component of the clock module's clock source is the clock crystal oscillator. Therefore, studying the characteristics of the clock crystal oscillator is crucial for improving the accuracy of the clock module. Crystal oscillators are mainly classified into three types based on their cutting process: tuning fork, AT-cut, and surface acoustic wave (SAW) type, each with its own unique frequency range and temperature characteristics. Smart meters currently use tuning fork type crystal oscillators, whose temperature characteristic curve exhibits a parabolic pattern, and its characteristics are significantly affected by temperature within a specific temperature range. Furthermore, in a system-on-a-chip (SoC), the RTC module is integrated on the MCU (microcontroller) chip. Since there is neither an on-chip temperature compensation mechanism nor a preset temperature compensation fitting curve, temperature compensation and frequency offset correction are necessary to meet clock accuracy requirements. Currently, most methods for clock crystal oscillator frequency offset compensation use least squares curve fitting. However, with the least squares method, the higher the order of the function used to fit the curve function, the higher the accuracy of the fit. As the order increases, the equation system becomes ill-conditioned, leading to unstable fitting results and consequently affecting clock stability. Summary of the Invention
[0004] Therefore, this invention provides a real-time crystal oscillator compensation method and system based on orthogonal least squares curve fitting. The temperature compensation curve is fitted by orthogonal least squares curve fitting to compensate for the frequency deviation of the crystal oscillator caused by temperature, thereby reducing the crystal oscillator frequency fitting error and improving the accuracy of crystal oscillator frequency fitting.
[0005] According to the design scheme provided by this invention, a real-time clock crystal oscillator compensation method based on orthogonal least squares curve fitting is provided for real-time clock (RTC) correction of multi-rate smart meters, comprising the following contents:
[0006] Construct temperature compensation functions for crystal oscillators of the same type, batch, or with the same temperature characteristic curves for smart meters, and use the orthogonal least squares method to fit the temperature compensation curves to obtain the corresponding temperature compensation fitting curves for smart meter crystal oscillators.
[0007] The ambient temperature is measured using a temperature sensor, and the temperature compensation value and frequency offset compensation value are obtained by fitting a temperature compensation curve based on the ambient temperature.
[0008] Temperature compensation values and frequency offset compensation values are written into the compensation register. The real-time clock (RTC) of the smart meter is corrected by increasing or decreasing the number of clock cycles within a fixed time interval through the compensation register.
[0009] As a real-time clock crystal oscillator compensation method based on orthogonal least squares curve fitting in this invention, a temperature compensation function is further constructed for smart meter crystal oscillators of the same type, batch, or with the same temperature characteristic curve, and the temperature compensation curve is fitted using orthogonal least squares method. This includes: first, constructing a temperature compensation function for the magnitude of the crystal oscillator deviation using Taylor formula; then, obtaining error data of the crystal oscillator RTC affected by the crystal oscillator frequency at different temperatures through actual measurement; and obtaining the temperature compensation fitting curve by fitting the difference curve between the temperature function and the measured error data.
[0010] As a real-time crystal oscillator compensation method based on orthogonal least squares curve fitting in this invention, the temperature compensation function is further expressed as: f(t)=a0+a1t+a2t 2 +…+a n t n , where the coefficient Both are constants, where t represents temperature; (t0, f(t0)) is a point on the function f(t), and t0 is the inflection temperature.
[0011] As a real-time clock oscillator compensation method based on orthogonal least squares curve fitting in this invention, further, for the temperature compensation function, the third-order Taylor formula is used and its quadratic polynomial function is solved by orthogonal squares to find the temperature compensation function f(t) at some discrete points {(t i ,y i Find a function p(t) such that f(t)≈p(t) and obtain the temperature compensation fitting curve by fitting a cubic function curve.
[0012] As a real-time crystal oscillator compensation method based on orthogonal least squares curve fitting of the present invention, in the temperature compensation curve fitting using orthogonal least squares, for the case of anomalies caused by external factors, corresponding discrete points are constructed using measured values, and the rate of change of adjacent discrete points is used to determine whether the current discrete point is an anomaly point. If it is an anomaly point, the least squares weighting value of the point is set to 0. The external factors include, but are not limited to, instrument and equipment failure and external noise disturbance.
[0013] As a real-time crystal oscillator compensation method based on orthogonal least squares curve fitting of the present invention, further, when solving the quadratic polynomial function of the temperature compensation function by orthogonal squares, the discrete point orthogonal function point set and the minimum solution of the discrete point in the function space are first obtained, and then the temperature compensation fitting curve is obtained by combining the orthogonal polynomial of the minimum solution.
[0014] As a real-time crystal oscillator compensation method based on orthogonal least squares curve fitting according to the present invention, the temperature compensation fitting curve is further expressed as: in, α0(t), α1(t), ..., α n (t) represents the discrete point {(t) i ,y i The set of orthogonal function points P of )} n (t) represents the discrete point {t i The orthogonal polynomials of}, k = 0, 1, ..., n, and n ≤ m, where m is the number of discrete points.
[0015] Furthermore, this invention also provides a real-time clock crystal oscillator compensation system based on orthogonal least squares curve fitting for real-time clock (RTC) correction of multi-rate smart meters, comprising: a data fitting module, a data acquisition module, and a clock correction module, wherein...
[0016] The data fitting module is used to construct the temperature compensation function for smart meter crystal oscillators of the same type, batch, or with the same temperature characteristic curve, and to use the orthogonal least squares method to fit the temperature compensation curve to obtain the corresponding smart meter crystal oscillator temperature compensation fitting curve.
[0017] The data acquisition module is used to measure the ambient temperature using a temperature sensor, and obtain the temperature compensation value and frequency offset compensation value based on the ambient temperature through a temperature compensation fitting curve.
[0018] The clock correction module is used to write temperature compensation values and frequency offset compensation values into the compensation register. The real-time clock (RTC) of the smart meter is corrected by increasing or decreasing the number of clock cycles within a fixed time interval through the compensation register.
[0019] The beneficial effects of this invention are:
[0020] This invention uses orthogonal least squares curve fitting to fit the temperature compensation curve, compensating for the frequency deviation of the crystal oscillator caused by temperature effects. This reduces the crystal oscillator frequency fitting error and improves the accuracy of the fitting, achieving the stable and high-precision real-time clock output requirements of smart meters. This reduces costs and increases efficiency, providing assistance to smart meter and other instrument manufacturers in selecting custom RTC calibration solutions. Furthermore, through actual testing, the compensated daily timing error of this solution is controlled within ±0.1s / d (1.15ppm) within the range of -40℃ to 65℃, fully meeting the accuracy and mass production requirements of relevant standards. It demonstrates significant effects on both the accuracy of the clock module and production costs. Attached image description:
[0021] Figure 1 This is a schematic diagram of the real-time crystal oscillator compensation process based on orthogonal least squares curve fitting in the embodiment.
[0022] Figure 2 This is a schematic diagram of the characteristic curve of a typical 32.768kHz crystal oscillator frequency as a function of temperature in the embodiment.
[0023] Figure 3 This is a schematic diagram of the quadratic function fitting curve in the embodiment;
[0024] Figure 4 This is a schematic diagram of the orthogonal least squares cubic function fitting curve in the embodiment;
[0025] Figure 5 This is a schematic diagram illustrating the comparison of orthogonal least squares curve fitting errors in the embodiments. Detailed implementation method:
[0026] To make the objectives, technical solutions, and advantages of this invention clearer and more understandable, the invention will be further described in detail below with reference to the accompanying drawings and technical solutions.
[0027] For an example of this case, see [link / reference]. Figure 1 As shown, a real-time clock crystal oscillator compensation method based on orthogonal least squares curve fitting is provided for real-time clock (RTC) correction of multi-rate smart meters, comprising:
[0028] S101. Construct temperature compensation functions for smart meter crystal oscillators of the same type, batch, or with the same temperature characteristic curves, and use the orthogonal least squares method to fit the temperature compensation curves to obtain the corresponding smart meter crystal oscillator temperature compensation fitting curves.
[0029] S102. Measure the ambient temperature using a temperature sensor, and obtain the temperature compensation value and frequency offset compensation value based on the ambient temperature through a temperature compensation fitting curve.
[0030] S103. Write the temperature compensation value and frequency offset compensation value into the compensation register. The real-time clock (RTC) of the smart meter is corrected by increasing or decreasing the number of clock cycles within a fixed time interval through the compensation register.
[0031] Temperature compensation curves are fitted to the crystal oscillators of smart meters of the same type, batch, or with identical temperature characteristic curves, and the fitted curves are pre-set in the software. A temperature sensor measures the ambient temperature, and compensation values are calculated based on the pre-set fitted curves. The temperature compensation value is then added to the frequency offset compensation value and written to a designated compensation register to complete the smart meter RTC calibration. In conjunction with a SoC, digital compensation is divided into temperature compensation and frequency offset compensation. An orthogonal least squares method and a fixed software algorithm are proposed to fit the crystal temperature characteristic curves to achieve ideal temperature compensation results, facilitating practical applications.
[0032] As a preferred embodiment, further, a temperature compensation function is constructed for smart meter crystal oscillators of the same type, batch, or with the same temperature characteristic curve, and the temperature compensation curve is fitted using the orthogonal least squares method, including: first, constructing a temperature compensation function for the magnitude of the crystal oscillator deviation using the Taylor formula; then, obtaining error data of the crystal oscillator RTC affected by the crystal oscillator frequency at different temperatures through actual measurement; and obtaining the temperature compensation fitting curve by fitting the difference curve between the temperature function and the measured error data.
[0033] A typical characteristic curve of a 32.768kHz crystal oscillator frequency versus temperature is shown below. Figure 2 As shown, the frequency deviation follows a parabola across the entire temperature range, indicating that the crystal cannot provide high accuracy over a wide temperature range. Table 1 shows that the accuracy of the RTC is affected by the crystal frequency, based on collected experimental data. It can be analyzed that the typical accuracy at room temperature (+25℃) is ±20ppm, while the accuracy deteriorates in high and low temperature regions, falling below 150ppm (typical value).
[0034] Table 1. Influence of RTC accuracy on changes in crystal frequency
[0035]
[0036]
[0037] According to the principle of curve fitting polynomials, the Taylor formula can fit the value of a function near a certain point. Therefore, the function of crystal deviation and temperature within a certain range can be expressed by the Taylor formula as shown in equation (1):
[0038]
[0039] Where t represents temperature; (t0, f(t0)) is a point on the function f(t); R n (t)=(o(t-t0) n Since f(t) ≈ 0, it is a higher-order infinitesimal of f(t). Therefore, f(t) can be simplified to the form of an nth-degree polynomial as shown in Equation 2:
[0040] f(t) = a0 + a1t + a2t 2 +…+a n t n (2)
[0041] Where the coefficient All are constants.
[0042] When n = 2, it can be written as a quadratic function as shown in equation (3).
[0043] f(t)=k(t-t0) 2 +f0 (3)
[0044] make Equation (3) can be written as shown in equation (4):
[0045]
[0046] in, Δf is the crystal deviation magnitude (ppm); f is the typical crystal frequency deviation; k is the crystal nominal frequency 32.768kHz; k is the curvature constant; t is the temperature; t0 is the transition temperature; f0 is the crystal deviation at the transition temperature.
[0047] Table 1 shows the numerical values of the influence of crystal frequency change on RTC accuracy measured at different temperatures ranging from 40℃ to 65℃. From the Taylor formula and the difference curve obtained from the measured error data and the fitted first-order curve, it can be concluded that the temperature-frequency influence curve should also include third-order or higher-order terms. Therefore, the univariate polynomial function curve f(t) = a0 + a1t + a2t fitted based on the difference curve can be obtained. 2 +…+a n t n As can be seen from Taylor's formula, the higher the order of the expansion of a univariate polynomial function, the higher its accuracy. When achieving high-precision real-time clock crystal oscillator compensation, a temperature compensation function model for the smart meter crystal oscillator can be constructed using a higher-order Taylor formula. Then, the temperature compensation curve can be fitted using the orthogonal least squares method to obtain the temperature compensation fitting curve for the smart meter crystal oscillator.
[0048] In a preferred embodiment, further, in fitting the temperature compensation curve using the orthogonal least squares method, for cases where anomalies are caused by external factors, corresponding discrete points are constructed using measured values. The rate of change of adjacent discrete points is used to determine whether the current discrete point is an anomaly. If it is an anomaly, the least squares weighting value of that point is set to 0. External factors include, but are not limited to, instrument malfunctions and external noise disturbances. When solving the quadratic polynomial function of the temperature compensation function using the orthogonal least squares method, the orthogonal function point set of discrete points and the minimum solution of the discrete points in the function space can be obtained. Then, the orthogonal polynomial of the minimum solution is used to obtain the temperature compensation fitting curve.
[0049] Taking the third-order Taylor formula as the research object, when calibrating the clock crystal oscillator frequency, the quadratic polynomial function is solved by the weighted least squares method, and the cubic function curve is fitted. Equation (3) is rewritten as Equation (5):
[0050] f(t) = a0 + a1t + a2t 2 +a3t 3 (5)
[0051] If we know some discrete points {(t) of the function f(t) i ,y i To find the approximate antiderivative of the function, polynomial interpolation is proposed as a processing method. However, in actual production practice, the measured function values at discrete points are not very accurate. Because these points are data obtained from experiments or actual observations, measurement errors are inevitable. If the approximate function curve is required to pass through all discrete points {(t}, then...} i ,y i If the function f(t) is not properly defined, then the obtained function curve will contain all measurement errors. However, the least squares method precisely compensates for this shortcoming. The least squares method solves for polynomial function curves: The function f(t) is obtained at some discrete points {(t...}... i ,y i Find a function p(t) such that f(t) ≈ p(t). This usually requires a large number of discrete data points and a deviation ε. i =p(t) i )-y i Overall, it should be as small as possible. That is, it should be:
[0052]
[0053] Where m is the number of discrete points; p(t) is the polynomial function to be found; ω i For temperature t i The weight of the location.
[0054] Instrument malfunctions, external disturbances, and noise can cause abnormal measurement values output by sensors and other devices. Therefore, the detection and handling of these anomalies are crucial. This section presents a method for detecting anomalies in clock crystal frequencies that vary with temperature.
[0055] Let the rates of change of two adjacent discrete points be respectively
[0056]
[0057] The average rate of change between the two discrete points before and after the i-th discrete point is:
[0058]
[0059] The mean rate of change of all adjacent discrete points is:
[0060]
[0061] Criterion for determining whether the i-th discrete point is an outlier:
[0062]
[0063]
[0064] mz i ≤λ1*Amz i
[0065] Where λ and λ1 are the detection weights, satisfying λ and λ1 ≥ 1. If the i-th discrete point does not satisfy the above conditions, it is considered an outlier, and the weighted least squares weight of that point is set to 0 (ω). i =0). In this embodiment, the ambient temperature is measured using a temperature sensor. An abnormal data processing model can be designed to remove abnormal data collected by the sensor, thereby improving data processing efficiency and accuracy.
[0066] Given discrete points {(t) i ,y i Solve for p in the function space Φ. * (t), satisfying equation (10).
[0067]
[0068] For any available Then finding is equivalent to solving p. * (t) The minimum value problem of the multivariate function (11) below.
[0069]
[0070] That is to ask
[0071]
[0072] Where k = 0, 1, ..., n. The least squares weighted sum of squares is:
[0073]
[0074] Its discrete weighted inner product can be written as:
[0075]
[0076]
[0077] From the above equation, we can write the normal equation:
[0078]
[0079] Where the matrix
[0080] The solution to equation (13) is: therefore, Then p*(t) is the least squares of f(t) in Φ.
[0081] If Φ = span{1,t,…,t} n}Right now Equation (13) can be rearranged into the form of Equation (17):
[0082]
[0083] but It is the polynomial fitted to the function f(t) by the least squares method of the nth order.
[0084] Since the parameter matrix of the least squares equation system (12) is an ill-conditioned coefficient matrix, in this embodiment, an improved least squares function is used. If α0(t), α1(t), ..., α n (t) is a discrete point {t i The set of orthogonal function points of (i = 0, 1, ..., m), i.e.
[0085]
[0086] The solution to the least squares equation (12) is:
[0087]
[0088] In the formula, k = 0, 1, ..., n.
[0089] Discrete point {t i The orthogonal polynomial {P0(t)}, (n≤m) is shown in equation (19):
[0090]
[0091] Where k = 1, 2, ..., n-1.
[0092] According to P k The orthogonal theory of (t) yields
[0093]
[0094] Where k = 0, 1, 2, ..., n-1. The final expression for the fitted curve is:
[0095]
[0096] Based on experimentally measured data, the embodiment of this case uses the orthogonal polynomial least squares method to fit the quadratic and cubic polynomials to obtain the following function:
[0097] Fitting a quadratic polynomial: f(t) = -0.0344t 2 +1.6077t-5.5806
[0098] Fitting a cubic polynomial: f(t) = -0.000041t 3 -0.0315t 2 +1.6642t-8.5475
[0099] A meter was randomly selected, and the discrete points measured in the experiment are shown in Table 2. These points were then substituted into the quadratic and cubic polynomials fitted using the orthogonal least squares method, respectively. The resulting polynomial function curves are shown below. Figure 3 , 4 As shown in the figure, it can be analyzed that due to external disturbances and measurement errors, both the quadratic and cubic polynomial function curves deviate from the measured values. Figure 5 It can be seen that the deviation analysis between each fitted curve and the measured data points shows that the cubic fitted curve is better than the quadratic fitted curve.
[0100] Table 2 Measured values of RTC frequency deviation as a function of temperature
[0101]
[0102] Clock compensation measures can be implemented using two methods: analog compensation and digital compensation. This invention achieves RTC correction through digital compensation. Digital compensation involves adjusting the number of clock cycles by increasing or decreasing the number of cycles within a fixed time interval using a compensation register (trim-register), thereby achieving the compensation purpose. Common methods include adjusting the number of high-frequency oscillation clock cycles and the number of low-frequency 32768Hz clock cycles.
[0103] Furthermore, based on the above method, this embodiment of the invention also provides a real-time clock crystal oscillator compensation system based on orthogonal least squares curve fitting, used for real-time clock (RTC) correction of multi-rate smart meters, comprising: a data fitting module, a data acquisition module, and a clock correction module, wherein,
[0104] The data fitting module is used to construct the temperature compensation function for smart meter crystal oscillators of the same type, batch, or with the same temperature characteristic curve, and to use the orthogonal least squares method to fit the temperature compensation curve to obtain the corresponding smart meter crystal oscillator temperature compensation fitting curve.
[0105] The data acquisition module is used to measure the ambient temperature using a temperature sensor, and obtain the temperature compensation value and frequency offset compensation value based on the ambient temperature through a temperature compensation fitting curve.
[0106] The clock correction module is used to write temperature compensation values and frequency offset compensation values into the compensation register. The real-time clock (RTC) of the smart meter is corrected by increasing or decreasing the number of clock cycles within a fixed time interval through the compensation register.
[0107] Unless otherwise specifically stated, the relative steps, numerical expressions, and values of the components and steps described in these embodiments do not limit the scope of the invention.
[0108] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.
[0109] The units and method steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations are not considered to be beyond the scope of this invention.
[0110] Those skilled in the art will understand that all or part of the steps in the above methods can be implemented by a program instructing related hardware, and the program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk. Optionally, all or part of the steps in the above embodiments can also be implemented using one or more integrated circuits. Accordingly, each module / unit in the above embodiments can be implemented in hardware or as a software functional module. This invention is not limited to any particular combination of hardware and software.
[0111] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A real-time clock crystal compensation method based on orthogonal least squares curve fitting for multi-rate smart meter real-time clock (RTC) correction, characterized in that, Includes the following content: A temperature compensation function for the deviation of crystal oscillators in smart meters of the same type, batch, or with the same temperature characteristic curve is constructed using the Taylor formula. Error data of the crystal oscillator RTC affected by the crystal oscillator frequency at different temperatures are obtained through actual measurements. The temperature compensation curve is fitted using the difference curve between the fitted temperature function and the measured error data, resulting in the corresponding temperature compensation fitting curve for the smart meter crystal oscillator. In the temperature compensation curve fitting, a third-order Taylor formula is used, and a quadratic polynomial function is solved using the orthogonal square method to find the temperature compensation function f(t) at some discrete points. a function , making The temperature compensation fitting curve is obtained by fitting a cubic function curve; and for the case of anomalies caused by external factors, the corresponding discrete points are constructed using the measured values. The rate of change of adjacent discrete points is used to determine whether the current discrete point is an anomaly. If it is an anomaly, the least squares weighting value of the point is set to 0. The external factors include: instrument and equipment failure and external noise disturbance. The ambient temperature is measured using a temperature sensor, and the temperature compensation value and frequency offset compensation value are obtained by fitting a temperature compensation curve based on the ambient temperature. Temperature compensation values and frequency offset compensation values are written into the compensation register. The real-time clock (RTC) of the smart meter is corrected by increasing or decreasing the number of clock cycles within a fixed time interval through the compensation register.
2. The real-time clock crystal compensation method based on orthogonal least squares curve fitting according to claim 1, characterized in that, The temperature compensation function is expressed as: , where the coefficient , All are constants, where t represents temperature; Let f(t) be a point on the function f(t). The transition temperature.
3. The real-time clock crystal oscillator compensation method based on orthogonal least squares curve fitting according to claim 1, characterized in that, When solving the quadratic polynomial function of the temperature compensation function using the orthogonal square method, we first obtain the discrete point orthogonal function point set and the minimum solution of the discrete points in the function space. Then, we combine the orthogonal polynomial of the minimum solution to obtain the temperature compensation fitting curve.
4. The real-time clock crystal compensation method based on orthogonal least squares curve fitting of claim 3, wherein, The temperature-compensated fitting curve is represented as follows: ,in, , For discrete points The set of orthogonal function points, For discrete points orthogonal polynomials, ,and , where m is the number of discrete points.
5. A real-time clock crystal compensation system based on orthogonal least squares curve fitting for multi-rate smart meter real-time clock (RTC) correction, characterized in that, The method described in claim 1 includes: a data fitting module, a data acquisition module, and a clock correction module, wherein... The data fitting module is used to construct the temperature compensation function for smart meter crystal oscillators of the same type, batch, or with the same temperature characteristic curve, and to use the orthogonal least squares method to fit the temperature compensation curve to obtain the corresponding smart meter crystal oscillator temperature compensation fitting curve. The data acquisition module is used to measure the ambient temperature using a temperature sensor, and obtain the temperature compensation value and frequency offset compensation value based on the ambient temperature through a temperature compensation fitting curve. The clock correction module is used to write temperature compensation values and frequency offset compensation values into the compensation register. The real-time clock (RTC) of the smart meter is corrected by increasing or decreasing the number of clock cycles within a fixed time interval through the compensation register.
6. An electronic device, comprising: It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor is configured to execute a program stored in memory and, when the program is executed, implement the method described in any one of claims 1 to 4.
7. A computer readable storage medium characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1 to 4.
Citation Information
Patent Citations
Error analysis method for inhibiting track timestamp influence
CN114265056A
Temperature compensation method and crystal oscillator
US20140184344A1