Error compensation method, device and equipment of intelligent electric meter and medium
By obtaining the functional relationship between crystal temperature and digital-to-analog conversion value, and between clock frequency error and crystal temperature, the oscillation frequency deviation of the target crystal is calculated, realizing high-precision clock compensation of smart meters under environmental changes, and solving the problem of poor clock crystal oscillation frequency deviation compensation effect.
Patent Information
- Application Number
- CN202511655333.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-12
- Publication Date
- 2026-02-27
AI Technical Summary
In existing technologies, the clock crystal oscillator frequency offset compensation effect of smart meters is poor, making it difficult to maintain high accuracy under environmental changes.
The current crystal temperature is determined by obtaining the first functional relationship between the crystal temperature and the digital-to-analog conversion value; the current clock frequency error is calculated by obtaining the second functional relationship between the clock frequency error and the crystal temperature; and the target crystal oscillation frequency deviation is calculated based on the peak clock frequency error when the smart meter is at its minimum, so as to automatically compensate for the crystal oscillation frequency.
This improves the clock compensation effect of smart meters in response to environmental changes, avoids interference from environmental changes on clock accuracy, and ensures the high accuracy of smart meters.
Smart Images

Figure CN121578221A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart meter technology, and in particular to a method, apparatus, device, and medium for error compensation of smart meters. Background Technology
[0002] Smart meters used in China all have real-time clocks, which, according to industry standards, must have an accuracy of less than 1 second / day (11.5 PPM) within their operating temperature range. In practical applications, factors such as crystal aging and calibration errors must also be considered. The clock error of a smart meter should ideally be below 8 PPM during manufacturer calibration. However, due to the instability of crystal oscillators, the clock demands extremely high crystal quality. Therefore, studying the characteristics of clock crystal oscillators is crucial for improving the accuracy of smart meters. Currently, most methods for clock crystal oscillator frequency offset compensation rely on least squares curve fitting. However, with the least squares method, the higher the order of the function used for fitting the curve, the higher the accuracy. As the order increases, the equations become ill-conditioned, affecting the clock compensation effect. Therefore, improving the clock compensation effect during frequency offset compensation is a pressing issue that needs to be addressed. Summary of the Invention
[0003] Therefore, it is necessary to address the aforementioned technical problems by providing an error compensation method, device, equipment, and medium for smart meters, in order to resolve the issue of poor compensation performance during clock crystal oscillator frequency offset compensation. Firstly, an error compensation method for a smart meter is provided, the error compensation method comprising: Obtain a first functional relationship between crystal temperature and digital-to-analog conversion value, and the current digital-to-analog conversion value; determine the current crystal temperature corresponding to the current digital-to-analog conversion value based on the first functional relationship and the current digital-to-analog conversion value. Obtain the second functional relationship between clock frequency error and crystal temperature, and determine the current clock frequency error at the current crystal temperature based on the current crystal temperature and the second functional relationship. Obtain the peak clock frequency error of the smart meter when the clock frequency error is at its minimum, and calculate the target crystal oscillation frequency deviation at the current crystal temperature based on the peak clock frequency error and the current clock frequency error. Based on the deviation of the target crystal's oscillation frequency, the oscillation frequency of the crystal is compensated to obtain the compensated oscillation frequency.
[0004] Secondly, an error compensation device for a smart meter is provided, the error compensation device comprising: The first determining module is used to obtain a first functional relationship between crystal temperature and digital-to-analog conversion value, and the current digital-to-analog conversion value, and to determine the current crystal temperature corresponding to the current digital-to-analog conversion value based on the first functional relationship and the current digital-to-analog conversion value. The second determining module is used to obtain a second functional relationship between clock frequency error and crystal temperature, and to determine the current clock frequency error at the current crystal temperature based on the current crystal temperature and the second functional relationship. The calculation module is used to obtain the peak clock frequency error of the smart meter when the clock frequency error is the smallest, and calculate the target crystal oscillation frequency deviation at the current crystal temperature based on the peak clock frequency error of the smart meter when the clock frequency error is the smallest and the current clock frequency error. The compensation module is used to compensate the oscillation frequency of the crystal according to the deviation of the target crystal oscillation frequency, so as to obtain the compensated oscillation frequency.
[0005] Thirdly, embodiments of the present invention provide a computer device, the computer device including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the error compensation method as described in the first aspect.
[0006] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the error compensation method as described in the first aspect.
[0007] The advantages of this application compared to the prior art are: The first functional relationship between crystal temperature and digital-to-analog conversion value is obtained, and the current crystal temperature is determined based on the first functional relationship, solving the problem of unmeasurable crystal temperature. The second functional relationship between clock frequency error and crystal temperature is obtained, and the current clock frequency error at the current crystal temperature is determined according to the second functional relationship. Based on the peak clock frequency error of the smart meter when the clock frequency error is at its minimum and the current clock frequency error, the target crystal oscillation frequency deviation at the current crystal temperature is calculated. This allows for automatic compensation of the crystal oscillation frequency according to changes in crystal temperature, avoiding interference caused by environmental changes and thus improving the compensation effect. Attached Figure Description
[0008] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0009] Figure 1 This is a flowchart illustrating an error compensation method for a smart meter according to an embodiment of this application; Figure 2 This is a schematic diagram illustrating the mapping relationship between digital-to-analog conversion values and crystal temperature according to an embodiment of this application; Figure 3 This is a schematic diagram illustrating the relationship between the oscillation frequency deviation of a target crystal and the crystal temperature, provided in an embodiment of this application. Figure 4 This is a schematic diagram of the structure of an error compensation device for a smart meter according to an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0010] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0011] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0012] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0013] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0014] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."
[0015] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0016] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0017] To illustrate the technical solution of this application, specific embodiments are described below.
[0018] See Figure 1 This is a flowchart illustrating an error compensation method for a smart meter according to an embodiment of this application. Figure 1 As shown, the error compensation method for the smart meter may include the following steps.
[0019] S101: Obtain the first functional relationship between the crystal temperature and the digital-to-analog conversion value, as well as the current digital-to-analog conversion value. Based on the first functional relationship and the current digital-to-analog conversion value, determine the current crystal temperature corresponding to the current digital-to-analog conversion value.
[0020] In step S101, Digital-to-Analog Conversion (DAC) is the process of converting discrete digital signals into continuous analog signals. This involves decoding digital codes (such as binary values) and reconstructing a continuous analog waveform according to specific rules, such as the sampling theorem. The DAC value is the numerical value obtained after the DAC. The first functional relationship is the mapping relationship between crystal temperature and the DAC value. The current DAC value is the DAC value at the crystal's current temperature. Based on the first functional relationship and the current DAC value, the current crystal temperature corresponding to the current DAC value is determined.
[0021] In this embodiment, a first functional relationship between crystal temperature and digital-to-analog conversion value is obtained. This first functional relationship is a quantitative correlation model established based on the influence of crystal temperature change on its physical properties, such as resistance, voltage, and optical parameters, combined with the signal conversion law of digital-to-analog conversion. Specifically, the first functional relationship between crystal temperature and digital-to-analog conversion value is determined based on the correspondence between multiple sets of crystal temperature and digital-to-analog conversion values.
[0022] It should be noted that the current analog-to-digital (ADC) value is the ADC value at the current temperature. This value can be obtained based on the voltage signal output by the temperature sensor (reflecting the crystal temperature). Select the ADC resolution (e.g., 12-bit, 16-bit) according to the required accuracy to ensure it can capture minute temperature changes. To improve the accuracy of the current ADC value, the sampling rate can be set to 1Hz~10Hz when the temperature change is slow. If the monitoring frequency shifts, the sampling rate needs to be increased (e.g., 1kHz). Read the converted digital value from the ADC data register; for example, a 12-bit ADC output range is 0~4095.
[0023] Substitute the current digital-to-analog conversion value into the corresponding first function relationship to calculate the current crystal temperature corresponding to the current digital-to-analog conversion value.
[0024] In this embodiment, a first functional relationship between the crystal temperature and the digital-to-analog conversion value is obtained so that the current crystal temperature corresponding to the current digital-to-analog conversion value can be quickly determined, thereby improving the real-time performance of crystal temperature measurement.
[0025] Optionally, obtaining a first functional relationship between the crystal temperature and the digital-to-analog conversion value includes: Obtain the first mapping relationship between crystal temperature and digital-to-analog conversion value; Obtain the first analog-to-digital conversion value and the crystal temperature when the crystal temperature is the first temperature. Based on the first temperature, the first analog-to-digital conversion value and the corresponding first mapping relationship, calculate the analog-to-digital conversion coefficient as the analog-to-digital conversion value changes with temperature. Based on the digital-to-analog conversion coefficients and the first mapping relationship, the first functional relationship between crystal temperature and digital-to-analog conversion value is determined.
[0026] In this embodiment, a first mapping relationship between crystal temperature and digital-to-analog conversion (D / A) values is obtained. This first mapping relationship is determined based on multiple sets of crystal temperature and D / A values. When obtaining these multiple sets of crystal temperature and D / A values, the smart meter is placed in a constant-temperature environment. This constant-temperature environment can be a constructed constant-temperature control experimental system. The smart meter under test is placed in a precisely temperature-controlled chamber, ensuring the temperature control accuracy of the chamber is ≤ ±0.1℃. The smart meter is placed in the chamber, different temperatures are set, and the D / A values at different temperatures are measured to obtain multiple sets of crystal temperature and D / A values. An appropriate function type is selected based on the trend of the multiple sets of data; for example, if the scatter plot approximates a linear distribution, a linear function is used. (See also...) Figure 2 This is a schematic diagram of the mapping relationship between digital-to-analog conversion value and crystal temperature provided in an embodiment of this application, wherein the horizontal axis is the crystal temperature, the vertical axis is the digital-to-analog conversion value (ADC), and A, B, and C are different types of crystals.
[0027] In this embodiment, the first mapping relationship between crystal temperature and digital-to-analog conversion value is as follows: in, The crystal temperature. This represents the digital-to-analog conversion value corresponding to the crystal temperature. This is the digital-to-analog conversion value at zero degrees Celsius.
[0028] To obtain the first analog-to-digital conversion value when the crystal temperature is set to a first temperature, the first temperature is set in a constant temperature chamber, and the corresponding analog-to-digital conversion value of the crystal sensor is measured at the first temperature to obtain the first analog-to-digital conversion value. Based on the first temperature, the first analog-to-digital conversion value, and the corresponding first mapping relationship, the analog-to-digital conversion coefficient of the analog-to-digital conversion value as a function of temperature is calculated. Based on the analog-to-digital conversion coefficient and the first mapping relationship, the first functional relationship between the crystal temperature and the analog-to-digital conversion value is determined.
[0029] It should be noted that, because the oscillation frequency of a crystal changes parabolically with temperature, there exists a peak crystal temperature corresponding to the minimum clock frequency error. The functional relationship between the crystal temperature and the digital-to-analog conversion (D / A) value may differ between temperatures above and below this peak crystal temperature. If the first temperature is below the peak crystal temperature, the calculated D / A coefficient is the D / A coefficient representing the D / A value at temperatures below the peak crystal temperature as a function of temperature. If the first temperature is above the peak crystal temperature, the calculated D / A coefficient is the D / A coefficient representing the D / A value at temperatures above the peak crystal temperature as a function of temperature.
[0030] S102: Obtain the second functional relationship between clock frequency error and crystal temperature, and determine the current clock frequency error at the current crystal temperature based on the current crystal temperature and the second functional relationship.
[0031] In step S102, the clock frequency error refers to the deviation between the actual clock signal frequency and the theoretical nominal frequency in the smart meter. The second functional relationship is the mapping relationship between the clock frequency error and the crystal temperature, meaning that the clock frequency error may be different at different crystal temperatures. Based on the current crystal temperature and the second functional relationship, the current clock frequency error at the current crystal temperature is determined.
[0032] In this embodiment, a second functional relationship between clock frequency error and crystal temperature is obtained. Based on the current crystal temperature and the second functional relationship, the current clock frequency error at the current crystal temperature is determined. The formula for the second functional relationship is as follows: in, This represents the current clock frequency error. For temperature coefficient, The current crystal temperature, This is the vertex crystal temperature corresponding to the minimum clock frequency error.
[0033] It should be noted that the vertex crystal temperature can be obtained through measurement or requested directly from the manufacturer; this embodiment does not impose any limitations. When the corresponding vertex crystal temperature is measured, the temperature corresponding to the minimum clock frequency error is determined as the crystal vertex temperature. When the corresponding vertex crystal temperature is measured, the calibration instrument and smart meter are placed in a constant temperature chamber, and tests are performed in 1℃ increments to determine which temperature has the minimum clock frequency error. Then, tests are performed in 0.1℃ increments to determine which temperature has the minimum clock frequency error. The vertex crystal temperature is then obtained, and the clock frequency error at that temperature is determined.
[0034] In this embodiment, the current clock frequency error at the current crystal temperature is determined based on the relationship between the current crystal temperature and the second function. This allows the current clock frequency error at the corresponding temperature to be automatically determined based on the current crystal temperature of the smart meter, thereby enabling automatic compensation based on the current clock frequency error and improving the accuracy of clock frequency error compensation.
[0035] Optionally, a second functional relationship between clock frequency error and crystal temperature is obtained, including: Obtain the vertex crystal temperature corresponding to the minimum clock frequency error; Obtain the temperature of a crystal to be compensated and the corresponding clock frequency error at the temperature of the crystal to be compensated; Obtain the second mapping relationship between clock frequency error and crystal temperature. Based on the clock frequency error to be compensated, the vertex crystal temperature, the crystal temperature to be compensated, and the second mapping relationship, calculate the temperature coefficient of the clock frequency error to be compensated as a function of crystal temperature. Based on the temperature coefficient and the second mapping relationship, the second functional relationship between clock frequency error and crystal temperature is determined.
[0036] In this embodiment, the vertex crystal temperature corresponding to the minimum clock frequency error is obtained. The vertex crystal temperature can be obtained through measurement or requested directly from the manufacturer; this embodiment does not impose any limitations. When the corresponding vertex crystal temperature is measured, the temperature corresponding to the minimum clock frequency error is determined as the crystal vertex temperature. When the corresponding vertex crystal temperature is measured, the calibration instrument and smart meter are placed in a constant temperature chamber. Testing is performed in 1℃ increments to determine which temperature has the minimum clock frequency error, and then testing is performed in 0.1℃ increments to determine which temperature has the minimum clock frequency error. The vertex crystal temperature is then obtained, and the clock frequency error at that vertex crystal temperature is determined.
[0037] After obtaining the vertex crystal temperature, the clock frequency error at that temperature is measured using a calibration instrument to obtain the corresponding clock frequency error to be compensated. A second mapping relationship between the clock frequency error and the crystal temperature is then established. This second mapping relationship characterizes the trend of clock frequency error with crystal temperature variation. Based on multiple scatter plots of clock frequency error versus crystal temperature, the trend of clock frequency error with crystal temperature variation can be determined. An appropriate function type is selected based on the trends of multiple data sets; for example, if the scatter plot approximates a parabolic distribution, a parabolic function is used.
[0038] Based on the clock frequency error to be compensated, the vertex crystal temperature, the crystal temperature to be compensated, and the second mapping relationship, the temperature coefficient of the clock frequency error to be compensated as a function of crystal temperature is calculated, i.e. The value of .
[0039] Substitute the temperature coefficient value into the corresponding second mapping relationship to determine the second functional relationship between clock frequency error and crystal temperature.
[0040] Optionally, the temperature coefficient includes a first temperature coefficient and a second temperature coefficient; Based on the clock frequency error to be compensated, the vertex crystal temperature, the crystal temperature to be compensated, and the second mapping relationship, the temperature coefficient of the clock frequency error to be compensated as a function of crystal temperature is calculated, including: If the temperature of the crystal to be compensated is lower than the temperature of the vertex crystal, then the first temperature coefficient of the clock frequency error to be compensated as a function of the crystal temperature is calculated based on the vertex crystal temperature, the temperature of the crystal to be compensated, and the second mapping relationship. If the temperature of the crystal to be compensated is not less than the vertex crystal temperature, then the second temperature coefficient of the clock frequency error to be compensated as a function of the crystal temperature is calculated based on the vertex crystal temperature, the temperature of the crystal to be compensated, and the second mapping relationship.
[0041] In this embodiment, since the oscillation frequency of the crystal exhibits a parabolic shape with temperature change, the trend of frequency change with temperature differs when the crystal temperature is below the peak crystal temperature compared to when the crystal temperature is not below the peak crystal temperature. The temperature coefficient is divided into a first temperature coefficient and a second temperature coefficient. The first temperature coefficient is for crystal temperatures below the peak crystal temperature, and the second temperature coefficient is for crystal temperatures not below the peak crystal temperature. If the crystal temperature to be compensated is below the peak crystal temperature, the first temperature coefficient of the clock frequency error to be compensated as a function of crystal temperature is calculated based on the peak crystal temperature, the crystal temperature to be compensated, and the second mapping relationship. If the crystal temperature to be compensated is not below the peak crystal temperature, the second temperature coefficient of the clock frequency error to be compensated as a function of crystal temperature is calculated based on the peak crystal temperature, the crystal temperature to be compensated, and the second mapping relationship.
[0042] In this embodiment, temperature coefficients are determined at different temperatures based on the temperature of the crystal to be compensated. This allows for the determination of the functional relationship between clock frequency error and crystal temperature under different temperature conditions. Consequently, different functional relationships can be selected to calculate the current clock frequency error based on the current crystal temperature, thereby improving the calculation accuracy of the current clock frequency error.
[0043] Optionally, the second functional relationship includes the first sub-functional relationship and the second sub-functional relationship; Based on the temperature coefficient and the second mapping relationship, the second functional relationship between clock frequency error and crystal temperature is determined as follows: If the temperature coefficient is the first temperature coefficient, then the first sub-function relationship between the clock frequency error and the crystal temperature is determined according to the first temperature coefficient and the second mapping relationship. If the temperature coefficient is the second temperature coefficient, then the second sub-function relationship between the clock frequency error and the crystal temperature is determined based on the second temperature coefficient and the second mapping relationship.
[0044] In this embodiment, the second functional relationship includes a first sub-functional relationship and a second sub-functional relationship. If the temperature coefficient is the first temperature coefficient, i.e., when the crystal temperature is less than the vertex crystal temperature, the clock frequency error changes with the crystal temperature. Substituting the first temperature coefficient into the corresponding second mapping relationship yields the first sub-functional relationship. If the temperature coefficient is the second temperature coefficient, i.e., when the crystal temperature is less than the vertex crystal temperature, the clock frequency error changes with the crystal temperature. Substituting the second temperature coefficient into the corresponding second mapping relationship yields the second sub-functional relationship.
[0045] In this embodiment, based on different temperature coefficients, the clock frequency error is determined as a function of crystal temperature within different temperature ranges, so as to select an appropriate functional relationship based on the current crystal temperature.
[0046] S103: Obtain the peak clock frequency error of the smart meter when the clock frequency error is at its minimum, and calculate the target crystal oscillation frequency deviation at the current crystal temperature based on the peak clock frequency error and the current clock frequency error.
[0047] In step S103, the peak clock frequency error of the smart meter when the clock frequency error is at its minimum, i.e. the clock frequency error of the smart meter at the peak crystal temperature, is calculated based on the peak clock frequency error of the smart meter when the clock frequency error is at its minimum and the current clock frequency error, to obtain the target crystal oscillation frequency deviation at the current crystal temperature.
[0048] In this embodiment, when the vertex clock frequency error of the smart meter is at its minimum, the calibration instrument and the smart meter are placed in a constant temperature chamber. The temperature in the chamber is adjusted to the corresponding vertex crystal temperature, and the corresponding vertex clock frequency error is measured using the calibration instrument. The vertex clock frequency error is added to the current clock frequency error to obtain the target crystal oscillation frequency deviation at the current crystal temperature. The calculation formula for the target crystal oscillation frequency deviation is as follows: in, For the target crystal oscillation frequency deviation, For the vertex clock frequency error, This represents the current clock frequency error. This represents the current crystal temperature.
[0049] See Figure 3 This is a schematic diagram illustrating the relationship between the oscillation frequency deviation of a target crystal and the crystal temperature, provided in an embodiment of this application. The horizontal axis represents the crystal temperature, and the vertical axis represents the oscillation frequency deviation of the target crystal. For the vertex clock frequency error, This represents the current clock frequency error. This represents the current crystal temperature.
[0050] In this embodiment, the target crystal oscillation frequency deviation at the current crystal temperature is calculated based on the peak clock frequency error of the smart meter when the clock frequency error is at its minimum and the current clock frequency error, so as to facilitate real-time compensation of the crystal's oscillation frequency.
[0051] S104: Based on the deviation of the target crystal oscillation frequency, the oscillation frequency of the crystal is compensated to obtain the compensated oscillation frequency.
[0052] In step S104, the oscillation frequency of the crystal is automatically compensated according to the deviation of the target crystal oscillation frequency to obtain the compensated oscillation frequency, so that the compensated oscillation frequency meets the corresponding ideal value of the crystal oscillator.
[0053] In this embodiment, the oscillation frequency of the crystal is adjusted according to the deviation of the target crystal oscillation frequency. If the deviation of the target crystal oscillation frequency is greater than zero, the oscillation frequency of the crystal is reduced. If the deviation of the target crystal oscillation frequency is less than zero, the oscillation frequency of the crystal is increased. This ensures that the compensated oscillation frequency meets the corresponding ideal crystal oscillator as much as possible, thereby improving the accuracy of the crystal oscillation frequency and thus improving the compensation effect of the smart meter.
[0054] It should be noted that after automatically compensating for the crystal's oscillation frequency deviation, even if the smart meter operates in extremely high and low temperature environments, it will not affect the compensation effect of the smart meter at room temperature. Table 1 shows the 1Hz error change of the smart meter at 25℃ after high and low temperature cycling. Table 1 Table 2 shows the variation of the 1Hz error of a smart meter at 25℃ after being left at room temperature for different periods of time.
[0055] Table 2 According to Tables 1 and 2, after cyclic impact and 7 days of storage at room temperature, the daily clock error of the smart meter tends to stabilize, and the error fluctuation decreases with time. The clock error after cyclic impact differs from that after 7 days of storage at room temperature by approximately 0.15 ppm, while the clock error after 7 days differs from that after 32 days by approximately 0.05 ppm. Rainy days may have some impact on the clock frequency or frequency meter due to increased humidity and decreased temperature, with an increase in clock error of approximately 0.02~0.05 ppm, which is negligible. Therefore, after automatic compensation of the crystal oscillation frequency, even if the smart meter operates in extremely high and low temperature environments, it will not affect the compensation effect of the smart meter at room temperature.
[0056] The first functional relationship between crystal temperature and digital-to-analog conversion value is obtained, and the current crystal temperature is determined based on the first functional relationship, solving the problem of unmeasurable crystal temperature. The second functional relationship between clock frequency error and crystal temperature is obtained, and the current clock frequency error at the current crystal temperature is determined according to the second functional relationship. Based on the peak clock frequency error of the smart meter when the clock frequency error is at its minimum and the current clock frequency error, the target crystal oscillation frequency deviation at the current crystal temperature is calculated. This allows for automatic compensation of the crystal oscillation frequency according to changes in crystal temperature, avoiding interference caused by environmental changes and thus improving the compensation effect.
[0057] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of an error compensation device for a smart meter according to an embodiment of this application. This error compensation device for a smart meter corresponds one-to-one with the error compensation method for smart meters in the above embodiments. Please refer to [link / reference] for details. Figure 1 The relevant descriptions in the corresponding embodiments are shown below. For ease of explanation, only the parts relevant to this embodiment are shown. See also... Figure 4 The error compensation device 40 of the smart meter includes: a first determining module 41, a second determining module 42, a calculation module 43, and a compensation module 44.
[0058] The first determining module 41 is used to obtain the first functional relationship between the crystal temperature and the digital-to-analog conversion value, as well as the current digital-to-analog conversion value, and to determine the current crystal temperature corresponding to the current digital-to-analog conversion value based on the first functional relationship and the current digital-to-analog conversion value.
[0059] The second determining module 42 is used to obtain the second functional relationship between the clock frequency error and the crystal temperature, and to determine the current clock frequency error at the current crystal temperature based on the current crystal temperature and the second functional relationship.
[0060] Calculation module 43 is used to obtain the peak clock frequency error of the smart meter when the clock frequency error is the smallest, and calculate the target crystal oscillation frequency deviation at the current crystal temperature based on the peak clock frequency error of the smart meter when the clock frequency error is the smallest and the current clock frequency error.
[0061] The compensation module 44 is used to compensate the oscillation frequency of the crystal according to the deviation of the target crystal oscillation frequency, so as to obtain the compensated oscillation frequency.
[0062] Optionally, the first determining module 41 includes: The acquisition unit is used to acquire the first mapping relationship between the crystal temperature and the digital-to-analog conversion value.
[0063] The calculation unit is used to obtain the first digital-to-analog conversion value and the crystal temperature when the crystal temperature is the first temperature, and to calculate the digital-to-analog conversion coefficient as the digital-to-analog conversion value changes with temperature based on the first temperature, the first digital-to-analog conversion value and the corresponding first mapping relationship.
[0064] The determining unit is used to determine the first functional relationship between the crystal temperature and the digital-to-analog conversion value based on the digital-to-analog conversion coefficients and the first mapping relationship.
[0065] Optionally, the second determining module 42 mentioned above includes: The second acquisition unit is used to acquire the vertex crystal temperature corresponding to the minimum clock frequency error.
[0066] The third acquisition unit is used to acquire the temperature of a crystal to be compensated and the clock frequency error to be compensated at the corresponding crystal temperature.
[0067] The second calculation unit is used to obtain the second mapping relationship between clock frequency error and crystal temperature. Based on the clock frequency error to be compensated, the vertex crystal temperature, the crystal temperature to be compensated, and the second mapping relationship, the temperature coefficient of the clock frequency error to be compensated as a function of crystal temperature is calculated.
[0068] The second determining unit is used to determine the second functional relationship between the clock frequency error and the crystal temperature based on the temperature coefficient and the second mapping relationship.
[0069] Optionally, the second computing unit mentioned above includes: The first calculation subunit is used to calculate the first temperature coefficient of the clock frequency error to be compensated as a function of the crystal temperature, based on the vertex crystal temperature, the crystal temperature to be compensated, and the second mapping relationship, if the temperature of the crystal to be compensated is less than the vertex crystal temperature.
[0070] The second calculation subunit is used to calculate the second temperature coefficient of the clock frequency error to be compensated as a function of the crystal temperature, based on the vertex crystal temperature, the crystal temperature to be compensated, and the second mapping relationship, if the temperature of the crystal to be compensated is not less than the vertex crystal temperature.
[0071] Optionally, the second determining unit mentioned above includes: The first determining sub-unit is used to determine the first sub-function relationship between the clock frequency error and the crystal temperature based on the first temperature coefficient and the second mapping relationship if the temperature coefficient is the first temperature coefficient.
[0072] The second determining subunit is used to determine the second sub-function relationship between the clock frequency error and the crystal temperature based on the second temperature coefficient and the second mapping relationship if the temperature coefficient is the second temperature coefficient.
[0073] Optionally, the second determining module 42 mentioned above includes: The first judgment unit is used to determine the current clock frequency error at the current crystal temperature based on the relationship between the current crystal temperature and the first sub-function if the current crystal temperature is less than the peak crystal temperature.
[0074] The second judgment unit is used to determine the current clock frequency error at the current crystal temperature based on the relationship between the current crystal temperature and the second sub-function if the current crystal temperature is not less than the vertex crystal temperature.
[0075] It should be noted that the information interaction and execution process between the above-mentioned units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.
[0076] Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 5 As shown, the computer device of this embodiment includes: at least one processor ( Figure 5 Only one is shown in the diagram), a memory, and a computer program stored in the memory and executable on at least one processor, which, when executed by the processor, implements the steps in the error compensation method embodiments of any of the above smart meters.
[0077] This computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 5 The examples of computer devices are merely examples and do not constitute a limitation on computer devices. Computer devices may include more or fewer components than shown in the illustration, or combinations of certain components, or different components, such as network interfaces, displays, and input devices.
[0078] The processor referred to can be a CPU, but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0079] Memory includes readable storage media, internal memory, etc., wherein internal memory can be the RAM of a computer device, providing an environment for the operation of the operating system and computer-readable instructions stored in the readable storage media. The readable storage media can be the hard drive of a computer device, or in other embodiments, it can be an external storage device of the computer device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, memory can include both internal storage units and external storage devices of the computer device. Memory is used to store the operating system, applications, bootloader, data, and other programs, such as program code for computer programs. Memory can also be used to temporarily store data that has been output or will be output.
[0080] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above device can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0081] The implementation of all or part of the processes in the methods of the above embodiments can also be accomplished by a computer program product. When the computer program product is run on a computer device, it enables the computer device to execute the steps in the above method embodiments.
[0082] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0083] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. 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 implementation should not be considered beyond the scope of this application.
[0084] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0085] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0086] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications 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 this application, and should all be included within the protection scope of this application.
Claims
1. An error compensation method for a smart meter, characterized in that, The error compensation method includes: Obtain a first functional relationship between crystal temperature and digital-to-analog conversion value, and the current digital-to-analog conversion value; determine the current crystal temperature corresponding to the current digital-to-analog conversion value based on the first functional relationship and the current digital-to-analog conversion value. Obtain the second functional relationship between clock frequency error and crystal temperature, and determine the current clock frequency error at the current crystal temperature based on the current crystal temperature and the second functional relationship. Obtain the peak clock frequency error of the smart meter when the clock frequency error is at its minimum, and calculate the target crystal oscillation frequency deviation at the current crystal temperature based on the peak clock frequency error and the current clock frequency error. Based on the deviation of the target crystal's oscillation frequency, the oscillation frequency of the crystal is compensated to obtain the compensated oscillation frequency.
2. The error compensation method as described in claim 1, characterized in that, The acquisition of the first functional relationship between the crystal temperature and the digital-to-analog conversion value includes: Obtain the first mapping relationship between crystal temperature and digital-to-analog conversion value; Obtain the first analog-to-digital conversion value and the crystal temperature when the crystal temperature is the first temperature. Based on the first temperature, the first analog-to-digital conversion value and the corresponding first mapping relationship, calculate the analog-to-digital conversion coefficient as the analog-to-digital conversion value changes with temperature. Based on the digital-to-analog conversion coefficients and the first mapping relationship, a first functional relationship between the crystal temperature and the digital-to-analog conversion value is determined.
3. The error compensation method as described in claim 1, characterized in that, The acquisition of the second functional relationship between clock frequency error and crystal temperature includes: Obtain the vertex crystal temperature corresponding to the minimum clock frequency error; Obtain the temperature of a crystal to be compensated and the corresponding clock frequency error at the temperature of the crystal to be compensated; Obtain the second mapping relationship between clock frequency error and crystal temperature, and calculate the temperature coefficient of the clock frequency error to be compensated as a function of crystal temperature based on the clock frequency error to be compensated, the vertex crystal temperature, the crystal temperature to be compensated, and the second mapping relationship. Based on the temperature coefficient and the second mapping relationship, a second functional relationship between clock frequency error and crystal temperature is determined.
4. The error compensation method as described in claim 3, characterized in that, The temperature coefficient includes a first temperature coefficient and a second temperature coefficient; The step of calculating the temperature coefficient of the clock frequency error to be compensated as a function of crystal temperature based on the clock frequency error to be compensated, the vertex crystal temperature, the crystal temperature to be compensated, and the second mapping relationship includes: If the temperature of the crystal to be compensated is lower than the temperature of the vertex crystal, then based on the vertex crystal temperature, the temperature of the crystal to be compensated, and the second mapping relationship, the first temperature coefficient of the clock frequency error to be compensated as a function of the crystal temperature is calculated. If the temperature of the crystal to be compensated is not less than the temperature of the vertex crystal, then the second temperature coefficient of the clock frequency error to be compensated as a function of the crystal temperature is calculated based on the vertex crystal temperature, the temperature of the crystal to be compensated, and the second mapping relationship.
5. The error compensation method as described in claim 4, characterized in that, The second functional relationship includes the first sub-functional relationship and the second sub-functional relationship; The step of determining the second functional relationship between clock frequency error and crystal temperature based on the temperature coefficient and the second mapping relationship includes: If the temperature coefficient is the first temperature coefficient, then based on the first temperature coefficient and the second mapping relationship, the first sub-function relationship between the clock frequency error and the crystal temperature is determined; If the temperature coefficient is the second temperature coefficient, then based on the second temperature coefficient and the second mapping relationship, the second sub-function relationship between the clock frequency error and the crystal temperature is determined.
6. The error compensation method as described in claim 5, characterized in that, The step of determining the current clock frequency error at the current crystal temperature based on the current crystal temperature and the second functional relationship includes: If the current crystal temperature is less than the vertex crystal temperature, then the current clock frequency error at the current crystal temperature is determined based on the relationship between the current crystal temperature and the first sub-function. If the current crystal temperature is not less than the vertex crystal temperature, then the current clock frequency error at the current crystal temperature is determined based on the relationship between the current crystal temperature and the second sub-function.
7. An error compensation device for a smart meter, characterized in that, The error compensation device includes: The first determining module is used to obtain a first functional relationship between crystal temperature and digital-to-analog conversion value, and the current digital-to-analog conversion value, and to determine the current crystal temperature corresponding to the current digital-to-analog conversion value based on the first functional relationship and the current digital-to-analog conversion value. The second determining module is used to obtain a second functional relationship between clock frequency error and crystal temperature, and to determine the current clock frequency error at the current crystal temperature based on the current crystal temperature and the second functional relationship. The calculation module is used to obtain the peak clock frequency error of the smart meter when the clock frequency error is the smallest, and calculate the target crystal oscillation frequency deviation at the current crystal temperature based on the peak clock frequency error of the smart meter when the clock frequency error is the smallest and the current clock frequency error. The compensation module is used to compensate the oscillation frequency of the crystal according to the deviation of the target crystal oscillation frequency, so as to obtain the compensated oscillation frequency.
8. The error compensation device for a smart meter as described in claim 7, characterized in that, The first determining module includes: The acquisition unit is used to acquire the first mapping relationship between the crystal temperature and the digital-to-analog conversion value; The calculation unit is used to obtain the first digital-to-analog conversion value and the crystal temperature when the crystal temperature is the first temperature, and to calculate the digital-to-analog conversion coefficient of the digital-to-analog conversion value as a function of temperature based on the first temperature, the first digital-to-analog conversion value and the corresponding first mapping relationship. The determining unit is used to determine a first functional relationship between the crystal temperature and the digital-to-analog conversion value based on the digital-to-analog conversion coefficients and the first mapping relationship.
9. A computer device, characterized in that, The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the error compensation method as described in any one of claims 1 to 6.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the error compensation method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
High-accuracy microcomputer-compensated surface-mounted temperature compensation crystal oscillator
CN102082548A
Temperature-compensated oscillator and temperature compensation method thereof
CN102142810A
Method for improving precision of built-in real-time clock of electric energy meter MCU
CN103499803A
High-precision temperature detection method and device
CN110857890A
Electric energy meter daily timing error compensation method, device and system
CN113504401A