A dynamic digital compensation method for metering error of a wide temperature range electric energy meter device
By constructing a historical temperature-error relationship database and an adaptive compensation model, and by using the existing temperature sensing module to adjust the metering results in real time, the metering error problem of electricity meter equipment in a wide temperature range is solved, and high-precision and stable metering effect is achieved.
Patent Information
- Application Number
- CN202511355528.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-22
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2045-09-22
AI Technical Summary
Existing electricity meter equipment suffers from metering errors due to temperature variations over a wide temperature range. In particular, traditional compensation schemes cannot adapt to continuous temperature changes and equipment aging, leading to error drift. Furthermore, relying on additional sensors increases equipment costs and failure rates.
A dynamic digital compensation method that requires no additional hardware is adopted. By constructing a historical temperature-error relationship database and an adaptive compensation model, the measurement results are adjusted in real time using the existing temperature sensing module of the equipment, realizing a nonlinear mapping between temperature and error, and adapting to measurement error correction over a wide temperature range.
Within a wide temperature range of -40℃ to 85℃, the measurement error is controlled within ±1.5℃, which reduces costs and failure rates, improves measurement accuracy and stability, and meets the high-precision measurement requirements of special environments such as extreme cold and high temperature.
Smart Images

Figure CN120847707B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electricity metering technology, specifically to a dynamic digital compensation method, system, device, and storage medium for metering errors in electricity meters over a wide temperature range, applicable to smart meters, industrial metering terminals, and other scenarios. Background Technology
[0002] The accuracy of electricity metering equipment directly affects electricity trade settlement and grid operation efficiency. Temperature is a key environmental factor that causes metering errors in electricity metering equipment: low temperature will reduce the permeability of the current transformer core, resulting in an increase in ratio difference; high temperature will cause ADC chip gain drift, introducing nonlinear errors.
[0003] For metering errors in electricity meters, existing compensation schemes are mainly divided into two categories: one is hardware compensation, which involves adding high-precision temperature sensors and temperature control circuits to adjust the operating point of components in real time. However, the additional hardware increases costs by more than 30%, and the sensor layout is easily affected by uneven temperature fields. The other is static compensation, which involves calibrating the error coefficients of several fixed temperature points before leaving the factory and correcting them by looking up tables in intervals during operation. However, it cannot cope with error drift caused by continuous temperature changes and equipment aging. In temperature ranges other than ±20℃, the error can reach more than ±2%.
[0004] Based on the above compensation scheme, the current technology has three major limitations: First, it relies on adding new sensors, which increases the size of the equipment and the failure rate; second, the static compensation model cannot adapt to continuous temperature changes in a wide temperature range (such as winter in extremely cold regions or high-temperature industrial workshops); third, the hardware temperature field reconstruction requires complex thermal simulation and structural design, which makes it difficult to adapt to different models of metering equipment.
[0005] Therefore, this application proposes a dynamic digital compensation method for metering errors in wide-temperature-range electricity meter equipment. By providing a digital compensation scheme that does not require additional hardware and can dynamically adapt to a wide temperature range, this method solves the technical problem of metering errors caused by the drift of the characteristics of components such as current transformers and ADCs due to temperature changes in the wide temperature range of -40℃ to 85℃ in traditional electricity metering equipment. Summary of the Invention
[0006] The main objective of this invention is to provide a dynamic digital compensation method for metering errors in wide-temperature-range electricity meters. By providing a digital compensation technology that can dynamically adapt to a wide temperature range without the need for additional hardware, this invention replaces the hardware temperature field reconstruction scheme. It eliminates the need for additional temperature sensors and utilizes only the existing temperature sensing capabilities of the device to achieve dynamic error correction. This method can improve metering accuracy and stability in wide-temperature environments, thereby solving the technical problem mentioned in the background art of metering errors caused by the drift of characteristics of components such as current transformers and ADCs due to temperature changes in traditional electricity metering devices within a wide temperature range of -40℃ to 85℃.
[0007] The present invention solves the above-mentioned technical problems by adopting the following technical solutions:
[0008] A dynamic digital compensation method for metering errors in wide-temperature-range energy meters includes:
[0009] Before the equipment leaves the factory and during the operation and maintenance phase, the temperature sensing module collects measurement error data of the equipment at different temperatures to build a historical temperature-error relationship database;
[0010] An adaptive compensation model is trained based on a historical temperature-error relationship database to establish a nonlinear mapping relationship between temperature and error.
[0011] During real-time operation of the equipment, the current equipment temperature is collected by a temperature sensing module (such as a temperature sensor built into the MCU), and the current equipment temperature and real-time load rate are input into the adaptive compensation model to obtain the error correction amount. Then, the measurement results are dynamically adjusted in real time according to the current error correction amount so as to finally output the accurate measurement value after compensation.
[0012] Preferably, the temperature sensing module is an MCU temperature sensor built into the device, and the nonlinear mapping relationship between temperature and error is also used to map the relationship between the temperature collected by the MCU temperature sensor and the actual temperature of the device.
[0013] Preferably, the data in the historical temperature-error relational database is stored in a four-dimensional structure of "temperature value - current level - mean error - variance of error" to form an initial relational database, wherein the method for constructing the relational database includes:
[0014] Set temperature points within a preset temperature range according to the specified temperature intervals;
[0015] At each temperature point, a standard signal of 0% to 120% of the rated current is passed through, and the difference between the output value of the metering device and the standard metering device is recorded synchronously as the reference error of that temperature point.
[0016] For each temperature point, 100 sets of data were collected repeatedly. After removing obvious outliers, the mean and variance of the error were calculated. The results of the calculation of the mean and variance of the error were stored in the form of a three-dimensional array to form a historical temperature-error relationship database.
[0017] Preferably, during the operation and maintenance phase of the historical temperature-error relationship database, a remote upgrade module can be used to periodically (e.g., every 6 months) drive the actual on-site temperature-error data collected by the energy meter to supplement the temperature-energy meter error relationship database, so as to realize the dynamic update of the relationship database. Here, the remote upgrade module can also be used to supplement new parameters and improve the construction method of the temperature-energy meter error relationship database.
[0018] Preferably, for each temperature point, a reference current output from a standard source is sequentially applied. , , For the rated current, continue for a specified duration to record the first... The metering device output current for the second sampling , , Each of these Each sample was taken independently 1000 times;
[0019] The formula for calculating the reference error of the temperature point is:
[0020]
[0021] in, For temperature Load rate Current measurement error at that time.
[0022] Preferably, the internal storage index of the temperature-error relation library is set to temperature. and load rate The temperature-error relationship database stores the mean error value. with standard deviation For the temperature-error relationship library The data sets are as follows:
[0023]
[0024]
[0025]
[0026] in, For temperature and load rate The corresponding error feature library, Represents temperature and load rate The corresponding mean error, Represents temperature and load rate The corresponding standard deviation of the error is used to reflect the dispersion of the data. For temperature Load rate Time Current measurement error in the set of data.
[0027] Preferably, the adaptive compensation model uses a modified gradient boosting tree (GBDT) as the core compensation model, with temperature as the primary factor. Current load factor (The ratio of actual current to rated current) is the input characteristic, and the measurement error is... Train for the output target;
[0028] The adaptive compensation model training process incorporates a temperature change rate. (Unit: °C / min) serves as an auxiliary feature to address the hysteresis error problem during sudden temperature changes; the temperature change rate... Using a sliding window calculation, we have:
[0029]
[0030] in, for The rate of temperature change at any given time (°C / s). for Temperature sampling value at time, This is the temperature sample value from 5 seconds ago.
[0031] Preferably, the adaptive compensation model training process includes:
[0032] In the offline pre-training phase, the model parameters are trained using the initial relational database data collected in the laboratory, and hyperparameters, including decision tree depth and learning rate, are determined.
[0033] During the online phase, the system retrieves the operational data (temperature, load rate, error prediction and actual deviation) from the previous hour every 24 hours, optimizes hyperparameters through grid search, and updates the model using momentum gradient descent to ensure long-term operational stability.
[0034] Preferably, the optimization objective of the hyperparameters during the grid search optimization process is:
[0035]
[0036] in, For the first The input feature vector of each sample, the validation set 20% of the total sample is used to ultimately determine the learning rate. Decision tree depth , For the first The output value of the adaptive compensation model for each sample (prediction error data). For the first The actual error of each sample.
[0037] Preferably, the adaptive compensation model is composed of The decision tree consists of 1, 2, 3, 4, 5, 6, 7, 8, 9 The output of the tree is The total output of the adaptive compensation model is:
[0038]
[0039]
[0040] Where the loss function Using Huber loss, we have:
[0041]
[0042] in, Indicates the first The prediction function of a decision tree. Refers to the first The input feature vector of each sample, This is the predicted error value, used as an error correction amount. For the front The prediction error after stacking decision trees, the first Each decision tree learns based on the residual between this value and the actual error. The input feature vector includes temperature, load rate, and temperature change rate. For the first The input feature vector of each sample, The Huber loss function is used to balance linear error and outliers. The threshold parameter of the loss function. These represent the true error and the prediction error of the Huber loss function, respectively.
[0043] Preferably, the method for real-time dynamic adjustment of the measurement results includes:
[0044] The real-time temperature is collected using the built-in MCU temperature sensor of the metering equipment (such as the built-in sensor of the STM32 chip, with an accuracy of ±2℃), and the current equipment temperature and real-time load rate are preprocessed.
[0045] Real-time temperature after preprocessing Current load rate Input the trained compensation model to obtain real-time error prediction values. ;
[0046] Output based on adaptive compensation model Real-time error correction amount at time Error correction is performed on the data after preprocessing, and the corrected measurement value is obtained. for:
[0047]
[0048] in, The measurement value before correction (the original measurement result before compensation).
[0049] Furthermore, to avoid overcompensation, an error correction threshold is set:
[0050] when At this time, no correction is made to reduce the consumption of computing resources.
[0051] Preferably, when the temperature exceeds the preset training range, extrapolation calculation is initiated, and linear extrapolation compensation is performed based on the error trend of the nearest neighbor temperature point, resulting in:
[0052]
[0053] in, This is the current temperature value. For the nearest boundary temperature point, This is the error value calculated by extrapolation. Boundary temperature point Measurement error values stored in the historical temperature-error database. The next temperature point after the boundary temperature point.
[0054] Preferably, the preprocessing operation does not require additional hardware and directly reuses the existing sensing capabilities of the device, which can reduce implementation costs. Specifically, it includes:
[0055] (1) For Raw temperature sampling at time By averaging the raw temperatures of 5 sampling points and performing a sliding window smoothing filter (with the window size set to 5 sampling points), high-frequency noise is removed.
[0056]
[0057] in, This is the filtered temperature value. This is the index variable within the sliding window, with a value range of 0 to 4;
[0058] (2) Cubic spline interpolation is used to fill in the missing data when the sensor experiences occasional disconnection, ensuring the continuity of the temperature sequence. Therefore:
[0059]
[0060] in, The interpolated temperature value at time t, and the spline interpolation coefficients. , , , Calculated by fitting from four adjacent valid sampling points;
[0061] (3) Calculate the load factor by real-time current sampling, and we have:
[0062]
[0063] in, for Load rate at any given time for The instantaneous current sample value at time t. Indicates the first Each sampling time, This represents the number of sampling points within one calculation period.
[0064] Preferably, during the dynamic adjustment of the measurement results, a correction smoothing coefficient is set to avoid measurement fluctuations caused by high-frequency corrections. To achieve temperature stability control, we have:
[0065]
[0066] in, The final measured value after smoothing is set during initialization. That is, the smoothed value of the first sampling point is equal to its original measurement value. All times are integers.
[0067] On the other hand, the present invention also discloses a dynamic digital compensation system for wide-temperature-range electricity metering errors, used to perform the dynamic digital compensation method for metering errors of any of the above-mentioned wide-temperature-range electricity meter devices, comprising:
[0068] The temperature sensing module is built into the core components of the device and is used to collect temperature data in real time.
[0069] Historical temperature-error relationship database, which stores data such as temperature value, current level, mean error, and error variance;
[0070] An adaptive compensation model is used to establish a nonlinear mapping relationship between temperature and error based on stored data in a historical temperature-error relationship database, in order to calculate the error correction amount.
[0071] The data processing module is used to drive the calculation and processing of error correction values in the historical temperature-error relationship database and the data collected by the temperature sensing module within the adaptive compensation model, and to perform dynamic data adjustment operations based on the collected data.
[0072] The correction output module is used to output the processed metering error and correct the metering error caused by the drift of the characteristics of the power metering element.
[0073] In another aspect, the present invention also discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the method described above.
[0074] In another aspect, the present invention also discloses a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method described above.
[0075] As can be seen from the above technical solution, the present invention provides a dynamic digital compensation method for metering errors in wide-temperature-range electricity meters. Compared with the prior art, the present invention has the following advantages:
[0076] 1. This invention replaces the hardware temperature field reconstruction scheme with digital compensation technology. It directly utilizes the existing temperature sensor built into the device's MCU, replacing the high-precision temperature sensor added in the traditional solution. It eliminates the need for an additional temperature sensor, achieving dynamic error correction solely through the device's existing temperature sensing capabilities. This avoids the problems of increased costs, larger device size, and higher failure rates caused by additional hardware. Furthermore, it eliminates the need for complex thermal simulation and structural design, making it compatible with different models of electricity metering devices. Thus, it controls the temperature sensing error within ±1.5℃ in a wide temperature range of -40℃ to 85℃, effectively correcting measurement errors caused by temperature changes. This improves measurement accuracy and stability in a wide temperature environment, reduces overall costs, and meets the high-precision measurement needs of extreme cold and high temperature environments.
[0077] It should be understood that the descriptions in this section are not intended to identify key or essential features of embodiments of the invention, nor are they intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Of course, implementing any product of the invention does not necessarily require achieving all of the advantages described above simultaneously. Attached Figure Description
[0078] The accompanying drawings, which form part of this application, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings:
[0079] Figure 1 This is a flowchart illustrating the overall operation of the present invention.
[0080] Figure 2 This is a schematic diagram of the data processing flow of the present invention;
[0081] Figure 3 This is a schematic diagram of the model training process of the present invention. Detailed Implementation
[0082] 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 a part of the embodiments of the present invention, and not all of them. Unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other. 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.
[0083] For details in the embodiments, please refer to Figures 1 to 3 .
[0084] like Figure 1 and Figure 2 As shown in the embodiment of the present invention, a dynamic digital compensation method for metering errors in a wide temperature range energy meter is proposed. This method achieves wide temperature range metering error correction through a two-step process of "historical data modeling – real-time dynamic compensation," specifically including the following steps:
[0085] S1. Before the equipment leaves the factory and during the operation and maintenance phase, the temperature sensing module collects the measurement error data of the equipment at different temperatures to build a historical temperature-error relationship database.
[0086] The temperature sensing module is an MCU temperature sensor built into the device. The non-linear mapping relationship between temperature and error is also used to map the relationship between the temperature collected by the MCU temperature sensor and the actual temperature of the device.
[0087] At this point, the historical temperature-error relational database is stored in a four-dimensional structure of "temperature value - current level - mean error - variance of error" to form the initial relational database. The methods for constructing the relational database include:
[0088] S101. Set temperature points within a preset temperature range according to the specified temperature intervals. For each temperature point, sequentially apply the reference current output from the standard source. ( , (Rated current), for a specified duration, to record the first... The metering device output current for the second sampling ( , ), each of these Each sample was taken independently 1000 times;
[0089] The formula for calculating the reference error of the temperature point is:
[0090]
[0091] in, For temperature Load rate Current measurement error at that time;
[0092] S102. At each temperature point, a standard signal of 0% to 120% of the rated current is passed through, and the difference between the output value of the metering device and the standard metering device is recorded synchronously as the reference error for that temperature point;
[0093] S103. Collect 100 sets of data for each temperature point, remove obvious outliers, calculate the mean and variance of the error, and store the results of the calculation of the mean and variance of the error in the form of a three-dimensional array to form a historical temperature-error relationship database.
[0094] At this time, the internal storage index of the temperature-error relation database is set to temperature. and load rate The temperature-error relation library stores the mean error value. with standard deviation For the temperature-error relation library The data sets are as follows:
[0095]
[0096]
[0097]
[0098] in, For temperature and load rate The corresponding error feature library, Represents temperature and load rate The corresponding mean error, Represents temperature and load rate The corresponding standard deviation of the error is used to reflect the dispersion of the data. For temperature Load rate Time Current measurement error in the set of data.
[0099] Furthermore, it should be noted that during the operation and maintenance phase of the historical temperature-error relationship database, the remote upgrade module can periodically (e.g., every 6 months) drive the actual on-site temperature-error data collected by the energy meter to supplement the temperature-energy meter error relationship database, so as to realize the dynamic update of the relationship database. Here, the remote upgrade module can also be used to supplement new parameters and improve the construction method of the temperature-energy meter error relationship database.
[0100] S2. Train an adaptive compensation model based on a historical temperature-error relationship database to establish a nonlinear mapping relationship between temperature and error.
[0101] It should be further noted that the adaptive compensation model here uses an improved gradient boosting tree (GBDT) as the core compensation model, with temperature as the key factor. Current load factor (The ratio of actual current to rated current) is the input characteristic, and the measurement error is... Train for the output target.
[0102] Furthermore, the adaptive compensation model is specifically composed of The decision tree consists of 1, 2, 3, 4, 5, 6, 7, 8, 9 The output of the tree is The total output of the adaptive compensation model is:
[0103]
[0104]
[0105] Where the loss function Using Huber loss, we have:
[0106]
[0107] in, Indicates the first The prediction function of a decision tree. Refers to the first The input feature vector of each sample, This is the predicted error value, used as an error correction amount. For the front The prediction error after stacking decision trees, the first Each decision tree learns based on the residual between this value and the actual error. The input feature vector contains temperature. Load rate Temperature change rate , For the first The input feature vector of each sample, The Huber loss function is used to balance linear error and outliers. The threshold parameter of the loss function. These represent the true error and the prediction error of the Huber loss function, respectively.
[0108] In addition, the temperature change rate is also introduced during the training of the adaptive compensation model. (Unit: °C / min) serves as an auxiliary feature to address the hysteresis error problem during sudden temperature changes; temperature change rate Using a sliding window calculation, we have:
[0109]
[0110] in, for The rate of temperature change at any given time (°C / s). for Temperature sampling value at time, This is the temperature sample value from 5 seconds ago.
[0111] Therefore, it is necessary to further explain here that the reference... Figure 3 The adaptive compensation model training process includes:
[0112] (1) In the offline pre-training stage, the model parameters are trained using the initial relational database data collected in the laboratory, and the hyperparameters, including the decision tree depth and learning rate, are determined.
[0113] (2) During the online phase, the operating data (temperature, load rate, error prediction and actual deviation) of the previous hour is retrieved every 24 hours. Hyperparameters are optimized through grid search, and the model is updated using momentum gradient descent to ensure long-term operational stability. The optimization objective of the hyperparameters during the grid search optimization process is:
[0114]
[0115] in, For the first The input feature vector of each sample, the validation set 20% of the total sample is used to ultimately determine the learning rate. Decision tree depth , For the first The output value of the adaptive compensation model for each sample (prediction error data). For the first The actual error of each sample.
[0116] S3. During real-time operation of the equipment, the current equipment temperature is collected by the temperature sensing module (such as the temperature sensor built into the MCU), and the current equipment temperature and real-time load rate are input into the adaptive compensation model to obtain the error correction amount. Then, the measurement results are dynamically adjusted in real time according to the current error correction amount so as to finally output the accurate measurement value after compensation.
[0117] Specifically, the methods for real-time dynamic adjustment of measurement results include:
[0118] S301. Use the built-in MCU temperature sensor (such as the built-in sensor of the STM32 chip, with an accuracy of ±2℃) of the metering equipment to collect the real-time temperature and perform preprocessing operations on the current equipment temperature and real-time load rate.
[0119] At this point, no new hardware is needed during the preprocessing operation; the existing sensing capabilities of the device can be directly reused, which can reduce implementation costs. Specifically, this includes:
[0120] (1) For Raw temperature sampling at time By averaging the raw temperatures of 5 sampling points and performing a sliding window smoothing filter (with the window size set to 5 sampling points), high-frequency noise is removed.
[0121]
[0122] in, This is the filtered temperature value. This is the index variable within the sliding window, with a value range of 0 to 4;
[0123] (2) Cubic spline interpolation is used to fill in the missing data when the sensor experiences occasional disconnection, ensuring the continuity of the temperature sequence. Therefore:
[0124]
[0125] in, The interpolated temperature value at time t, and the spline interpolation coefficients. , , , Calculated by fitting from four adjacent valid sampling points;
[0126] (3) Calculate the load factor by real-time current sampling, and we have:
[0127]
[0128] in, for Load rate at any given time for The instantaneous current sample value at time t. Indicates the first Each sampling time, The number of sampling points within one calculation period;
[0129] S302. The real-time temperature after pretreatment Current load rate Input the trained compensation model to obtain real-time error prediction values. ;
[0130] S303. Output based on adaptive compensation model Real-time error correction amount at time Error correction is performed on the data after preprocessing, and the corrected measurement value is obtained. for:
[0131]
[0132] in, The measurement value before correction (the original measurement result before compensation).
[0133] Furthermore, to avoid overcompensation, an error correction threshold is set:
[0134] when At this time, no correction is made to reduce the consumption of computing resources.
[0135] Furthermore, during the dynamic adjustment of measurement results, it is necessary to further explain that, in order to avoid measurement fluctuations caused by high-frequency corrections, a correction smoothing coefficient should be set. To achieve temperature stability control, we have:
[0136]
[0137] in, The final measured value after smoothing is set during initialization. That is, the smoothed value of the first sampling point is equal to its original measurement value, i.e.: , here All times are integers.
[0138] Furthermore, when the temperature exceeds the preset training range, extrapolation calculation needs to be initiated, and linear extrapolation compensation is performed based on the error trend of the nearest neighbor temperature point, resulting in:
[0139]
[0140] in, This is the current temperature value. For the nearest boundary temperature point, This is the error value calculated by extrapolation. Boundary temperature point Measurement error values stored in the historical temperature-error database. The next temperature point after the boundary temperature point.
[0141] In summary, this method replaces the hardware temperature field reconstruction scheme with digital compensation technology in practical use. It directly utilizes the existing temperature sensor built into the device's MCU, replacing the high-precision temperature sensor added in the traditional scheme. It eliminates the need for an additional temperature sensor and achieves dynamic error correction by utilizing the device's existing temperature sensing capabilities. This avoids the problems of increased costs, larger device size, and higher failure rate caused by additional hardware.
[0142] In the actual process of a set of specific embodiments, the following steps are performed respectively:
[0143] L1. Construction of Historical Temperature-Error Relationship Database
[0144] The data acquisition phase covers a temperature range of -40℃ to 85℃, with temperature points set at 5℃ intervals. A standard signal of 0% to 120% of the rated current is passed through each temperature point, and the difference between the output value of the metering equipment and the standard metering device (accuracy class 0.05) is recorded synchronously as the reference error for that temperature point.
[0145] Specifically, a temperature sequence T = [-40, -35, ..., 80, 85]℃ (intervals of 5℃, for a total of 26 points) is set in the high and low temperature chamber, and each temperature point is kept constant for 30 minutes to ensure the thermal stability of the equipment. At this time, the temperature field equilibrium condition is satisfied:
[0146]
[0147] in, The rate of temperature change over time reflects the thermal stability of the equipment.
[0148] At this point, for each temperature point, the reference current output from the standard source is sequentially applied. ( , (Rated current), for 10 minutes, to record the first... The metering device output current for the second sampling ( , ), and calculate the error, here each Each sample was taken independently 1000 times.
[0149] For each temperature point, 100 sets of data are repeatedly collected. After removing outliers other than 3σ, the mean and variance of the error are calculated and stored in a four-dimensional structure of "temperature value - current level - mean error - variance of error" to form an initial relational database. During the operation and maintenance phase, the actual temperature-error data of the field operation is periodically (e.g., every 6 months) supplemented through a remote upgrade module to achieve dynamic updates of the relational database.
[0150] L2. Compensation Model Training
[0151] An improved gradient boosting tree (GBDT) is used as the core compensation model, with temperature T and current load rate L (the ratio of actual current to rated current) as input features and metering error ε as the output target.
[0152] During training, the temperature change rate λ (unit: °C / min) is introduced as an auxiliary feature to address the hysteresis error problem during sudden temperature changes. Model training is divided into offline pre-training and online fine-tuning: In the offline pre-training stage, the model parameters are trained using initial relational database data collected in the laboratory, determining hyperparameters including decision tree depth and learning rate; in the online stage, the running data of the previous hour (temperature, load rate, error prediction value and actual deviation) is retrieved every 24 hours, and the model is updated using the momentum gradient descent method to ensure long-term operational stability.
[0153] At this point, the hyperparameters are optimized using a grid search, and the validation set is obtained through computation. The learning rate is determined by using 20% of the total sample. Decision tree depth .
[0154] L3. Real-time Temperature Acquisition and Preprocessing
[0155] Real-time temperature is acquired using the built-in MCU temperature sensor of the metering equipment (such as the built-in sensor of the STM32 chip, with an accuracy of ±2℃), and the sampling frequency is set to 1Hz. The raw temperature data is preprocessed: a sliding window filter is used to remove high-frequency noise, and the window size is set to 5 sampling points; cubic spline interpolation is used to fill in missing data when the sensor occasionally disconnects, ensuring the continuity of the temperature sequence.
[0156] This step requires no new hardware and directly reuses the existing sensing capabilities of the device, reducing implementation costs.
[0157] Furthermore, the load factor is calculated based on real-time current sampling. For each cycle of the corresponding power grid, we have:
[0158]
[0159]
[0160] in, for Load rate at any given time for The instantaneous current sample value at time t. Indicates the first Each sampling time, This represents the number of sampling points within one calculation period.
[0161] L4. Dynamic metering compensation calculation
[0162] The preprocessed real-time temperature T(t) and current load rate L(t) are input into the trained compensation model to obtain the real-time error prediction value. .
[0163] Input feature vector Model output prediction error Initial measurement value (The uncompensated original measurement result) is corrected in the following way: Compensated measurement value .
[0164] To avoid overcompensation, an error correction threshold is set: when When the temperature exceeds the initial training range (e.g., >85℃ or <-40℃), the extrapolation algorithm is activated to perform linear extrapolation compensation based on the error trend of the nearest neighbor temperature point.
[0165] Furthermore, regarding the compensation results, three smart meters of the same model (specifications: 220V, 5(60)A) were selected. Traditional hardware compensation schemes (with external temperature sensors), static lookup compensation schemes (factory-calibrated at 5 temperature points), and the scheme of this invention were used respectively. Cyclic tests were conducted in a high and low temperature chamber from -40℃ to 85℃, with a temperature change rate of 5℃ / min. Three currents of 5A, 30A, and 60A (corresponding to load rates of 10%, 50%, and 100%) were applied. Metering errors were recorded every 10 minutes. The results are as follows:
[0166] (1) Low temperature range (-40℃ to -20℃): Traditional hardware solutions have an error fluctuation of ±1.8% due to sensor response lag; static lookup table solutions have an error that is stable at ±1.5%; the solution of this invention controls the error within ±0.3%, and because the model includes temperature change rate characteristics, the lag error can be corrected in real time.
[0167] (2) Normal temperature range (20℃ to 30℃): The errors of the three schemes are relatively small. The error of the scheme of the present invention is the lowest (±0.1%), which is better than the ±0.5% of the traditional scheme.
[0168] (3) High temperature range (60℃ to 85℃): Traditional hardware solutions have an error of ±2.2% due to sensor drift at high temperatures; static lookup table solutions have an error of ±1.9%; the solution of this invention is corrected by a dynamic model, and the error is stabilized at ±0.4%.
[0169] In summary, traditional solutions require the installation of high-precision temperature sensors near core metrology components (such as current transformers and digital-to-analog converters, ADCs) (increasing costs by 15-20 yuan per unit). In contrast, this invention directly utilizes the temperature sensor built into the existing microcontroller unit (MCU) of the device. Through a model trained using a historical temperature-error relationship library, it indirectly establishes a mapping relationship between the temperature of the built-in sensor and the actual temperature of the core components without requiring hardware modifications. Numerically, this invention reduces the metrology error by more than 70% over a wide temperature range compared to traditional solutions, without requiring additional hardware, resulting in a 20% reduction in overall cost. It can meet the high-precision metrology requirements of special environments such as extreme cold and high temperatures.
[0170] Therefore, this application replaces "hardware reconstruction" with "data-driven" technology, eliminating the need for complex thermal simulation and structural design. It can be adapted to different models of electricity metering equipment, which not only reduces costs but also avoids temperature field perception deviations caused by sensor layout. The temperature perception error is controlled within ±1.5℃ in the entire range of -40℃ to 85℃, meeting the compensation accuracy requirements. It can effectively correct the measurement error caused by temperature changes, thereby improving the measurement accuracy and stability in a wide temperature environment, reducing overall costs, and meeting the high-precision measurement requirements of special environments such as extreme cold and high temperature.
[0171] Furthermore, it should be emphasized that the formulas used in the above technical solutions of this application... The coefficient k in this context, and the real-time load factor k that characterizes the equipment's operating status, are essentially the same physical concept. Both represent the ratio of the actual current to the rated current (i.e., the load factor). During the laboratory calibration phase of building the historical temperature-error relationship database, this "k" is a preset coefficient used to control the output of the standard source. The setting points are set according to the sequence k=0.1,0.2,...,1.2. The purpose is to systematically and comprehensively measure the reference error of the equipment under different load conditions (from 10% to 120% of the rated current) at each temperature point T. .at this time, This is a known and precise reference current value output from a standard source. However, during the real-time operation of the equipment, this "k" is the real-time load rate calculated through real-time sampling, a measured value of the equipment's current operating status, as stated in the formula. The term "load rate L" is used to further represent this error. Therefore, the error data stored in the historical database in this application is the error measured at a specific load point (coefficient k). During real-time compensation, the prediction error at the current real-time load point (load rate L, i.e., k) can be queried or calculated through the model. Both are normalized current ratios in numerical terms, but they are at different stages of the process (calibration vs. operation).
[0172] On the other hand, the present invention also discloses a dynamic digital compensation system for wide-temperature-range electricity metering errors, used to perform the dynamic digital compensation method for metering errors of any of the above-mentioned wide-temperature-range electricity meter devices, comprising:
[0173] The temperature sensing module is built into the core components of the device and is used to collect temperature data in real time.
[0174] Historical temperature-error relationship database, which stores data such as temperature value, current level, mean error, and error variance;
[0175] An adaptive compensation model is used to establish a nonlinear mapping relationship between temperature and error based on stored data in a historical temperature-error relationship database, in order to calculate the error correction amount.
[0176] The data processing module is used to drive the calculation and processing of error correction values in the historical temperature-error relationship database and the data collected by the temperature sensing module within the adaptive compensation model, and to perform dynamic data adjustment operations based on the collected data.
[0177] The correction output module is used to output the processed metering error and correct the metering error caused by the drift of the characteristics of the power metering element.
[0178] In another aspect, the present invention also discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the method described above.
[0179] In another aspect, the present invention also discloses a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method described above.
[0180] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute the dynamic digital compensation method for metering errors of any of the wide temperature range energy meter devices in the above embodiments.
[0181] It is understood that the system provided in the embodiments of the present invention corresponds to the method provided in the embodiments of the present invention, and the explanation, examples and beneficial effects of the relevant content can be referred to the corresponding parts of the above methods.
[0182] This application also provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, communication interface, and memory communicate with each other via the communication bus.
[0183] Memory, used to store computer programs;
[0184] When the processor executes the program stored in the memory, it implements the above-mentioned dynamic digital compensation method for metering errors of wide-temperature-range energy meter equipment.
[0185] The communication bus mentioned in the above-mentioned electronic devices can be a standard bus for interconnecting peripheral components or an extended industrial standard structure bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc.
[0186] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0187] The memory may include random access memory or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0188] The processors mentioned above can be general-purpose processors, including central processing units, network processors, etc.; they can also be digital signal processors, application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0189] It should also be noted that electronic devices include terminal devices, which can also be called terminals, user equipment, mobile stations, mobile terminals, etc. Terminal devices can be mobile phones, smart TVs, wearable devices, tablets, computers with wireless transceiver capabilities, virtual reality terminal devices, augmented reality terminal devices, wireless terminals in industrial control, wireless terminals in autonomous driving, wireless terminals in remote surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, and so on. The embodiments of this application do not limit the specific technologies or device forms used in the terminal devices.
[0190] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium, or a semiconductor medium, etc.
[0191] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0192] Furthermore, it should be noted that if any directional indication (such as up, down, left, right, front, back, etc.) is involved in the embodiments of the present invention, the directional indication is only used to explain the relative positional relationship and movement of each component in a specific posture. If the specific posture changes, the directional indication will also change accordingly.
[0193] Furthermore, if the embodiments of this invention involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the meaning of "and / or" throughout the text includes three parallel solutions; for example, "A and / or B" includes solution A, solution B, or a solution where both A and B are satisfied simultaneously. Furthermore, in the embodiments of this invention, "multiple" refers to two or more. Moreover, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
Claims
1. A dynamic digital compensation method for metering error of a wide temperature range electric energy meter device, characterized in that, The application relates to a temperature self-adaptive compensation method for a metering device. The application comprises the following steps: A historical temperature-error relationship database is constructed by collecting metering error data of the device at different temperatures through a temperature sensing module; An adaptive compensation model is trained based on the historical temperature-error relationship database to establish a nonlinear mapping relationship between temperature and error; The adaptive compensation model adopts an improved gradient boosting tree as a core compensation model, takes temperature , current load rate as input features, and measurement error as output target for training; The adaptive compensation model introduces a temperature change rate during training As an auxiliary feature, the temperature change rate Computed by a sliding window; During the real-time operation of the device, the current device temperature is collected through the temperature sensing module, and the current device temperature and real-time load rate are input into the adaptive compensation model to obtain an error correction amount, and then the metering result is dynamically adjusted in real time according to the current error correction amount to output a compensated accurate metering value. The adaptive compensation model training process comprises the following steps: In an offline pre-training stage, the model parameters are trained by using initial relationship database data collected in a laboratory, and the hyperparameters such as the decision tree depth and learning rate are determined; The adaptive compensation model is composed of The decision tree consists of 1, 2, 3, 4, 5, 6, 7, 8, 9 The output of the tree is The total output of the adaptive compensation model is: where the loss function With Huber loss, we have: wherein, represents the prediction function of the is the error prediction value, which is used as an error correction amount, is the input feature vector, including temperature, load rate, temperature change rate, is the Huber loss function, which is used to balance linear error and outliers, is the threshold parameter of the loss function, respectively represent the true error value and the prediction error value of the Huber loss function. 2. The dynamic digital compensation method of metrology errors of a wide temperature range electric energy metering device according to claim 1, characterized in that, In an online stage, the operation data of the previous one hour are called every 24 hours, the hyperparameters are optimized through a grid search, and the model is updated through a momentum gradient descent method.
3. The dynamic digital compensation method of metrology errors of a wide temperature range electric energy metering device, as claimed in claim 1, wherein, The temperature sensing module is an MCU temperature sensor built in the device, and the nonlinear mapping relationship between temperature and error is used to map the relationship between the temperature collected by the MCU temperature sensor and the actual temperature of the device. The construction method of the historical temperature-error relationship database comprises the following steps: Temperature points are set in a preset temperature range at specified temperature intervals; A standard signal of 0%-120% rated current is input at each temperature point, and the difference between the output value of the metering device and the standard metering device is recorded synchronously as the reference error of the temperature point; 100 groups of data are collected at each temperature point, and after removing obvious abnormal values, the error mean and variance are calculated; 4. The dynamic digital compensation method of metrology errors of a wide temperature range electric energy meter device according to claim 3, characterized in that, For each temperature point, the reference current output by the standard source is sequentially passed through , , The rated current is maintained for a specified duration to record the meter output current for the first sampling , , Each of the 1000 individual samples is taken independently The calculation results of the error mean and variance are stored in the form of a three-dimensional array to form the historical temperature-error relationship database. wherein temperature , load rate current measurement error at the time.
5. The dynamic digital compensation method of metrology errors of a wide temperature range electric energy metering device according to claim 4, characterized in that, The internal storage index of the temperature-error relation database is set to temperature. and load rate The temperature-error relationship database stores the mean error value. with standard deviation For the temperature-error relationship library The data sets are as follows: wherein, temperature and load rate corresponding error feature library, representative temperature and load rate corresponding error mean value, representative temperature and load rate corresponding error standard deviation for reflecting data dispersion, temperature , load rate current measurement error of the first group of data.
6. The dynamic digital compensation method of metrology errors of a wide temperature range electric energy metering device, as claimed in claim 1, wherein, The reference error calculation formula of the temperature point is as follows: The real-time dynamic adjustment method of the metering result comprises the following steps: based on an adaptive compensation model output a real-time error correction amount at the moment , and the corrected measurement value is : wherein is the pre-correction measurement value; The current device temperature and real-time load rate are preprocessed; wherein, is the current temperature value, is the nearest boundary temperature point, is the error value of the extrapolation calculation, is the boundary temperature point the metrology error value stored in the historical temperature-error relationship library, is the next temperature point of the boundary temperature point.
7. The dynamic digital compensation method of metrology errors of a wide temperature range electric energy meter device according to claim 6, characterized in that, When the temperature exceeds the preset training range, extrapolation calculation is started, and the formula is as follows: (1) For raw temperature samples at the moment The raw temperature samples of the 5 sampling points are averaged to perform sliding window smoothing filtering, and there are wherein, is the filtered temperature value, is an index variable within the sliding window, taking values from 0 to 4; The preprocessing operation comprises the following steps: wherein, is the interpolated temperature value at the time instant, the spline interpolation coefficient 、 、 、 is calculated by fitting to the 4 adjacent valid samples. (2) Cubic spline interpolation is used for missing data, and the formula is as follows: (3) The real-time current sampling is calculated to calculate the load rate, and the formula is as follows: wherein, is the load ratio at the moment, is the instantaneous current sampling value at the moment, denotes the sampling moment, is the number of sampling points in a calculation period, is the rated current.
8. The dynamic digital compensation method of metrology errors of a wide temperature range electric energy metering device, as claimed in claim 6, wherein, In the dynamic adjustment process of the metrological result, a correction amount smoothing coefficient is set to avoid metrological fluctuation caused by high-frequency correction To achieve temperature stability control, there are: wherein, is the smoothed final metering value, initialized at i.e. the smoothed value of the first sample point equals its original metering value, here are both integers.
Citation Information
Patent Citations
Testing method and device of MCU temperature sensor
CN106679849A
Electric energy metering error correction method and system for charging facility under multiple working conditions
CN120334837A