Error real-time compensation method and system suitable for complex working conditions of electric energy meter

CN122815310APending Publication Date: 2026-09-25JIANGYIN CHANGYI GRP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611300574.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-26
Publication Date
2026-09-25

AI Technical Summary

Technical Problem

[0003]现有误差补偿方法多采用单一固定长度的滑动窗口提取工况特征,无法同时覆盖瞬时冲击、常规波动、长期温漂等不同时间尺度的工况变化,导致工况表征不全面,补偿精度难以满足复杂工况下的计量需求

Benefits of technology

1、本发明通过多尺度全局特征提取、工况聚类及误差同源性分析构成的完整补偿方案,能够同时覆盖瞬时冲击、常规波动、长期温漂等不同时间尺度的工况变化,克服了单一固定长度窗口对工况表征不全面的问题,显著提升了复杂工况下电能表误差补偿的全面性和准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122815310A_ABST
    Figure CN122815310A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of measurement, in particular to a power meter error real-time compensation method and system suitable for complex working conditions, the method comprising: acquiring historical time series data to construct historical samples, and extracting multi-scale global feature vectors from each sample; clustering the global feature vectors of all windows to obtain multiple global working condition clusters, and calculating the error homology between any two clusters; combining the error homology and the cluster to which each window belongs to calculate the working condition complexity of each historical sample; constructing real-time samples and mapping them to the corresponding clusters to obtain real-time working condition complexity; determining the expected number of matching samples according to the real-time working condition complexity, and using a hierarchical matching strategy to screen candidate matching samples from the historical samples; determining the comprehensive error based on the candidate matching samples and the expected number of matching samples, and obtaining the real-time metering compensation error after reverse normalization. The present application can achieve real-time high-precision compensation of power meter error under complex working conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of measurement technology. More specifically, this invention relates to a method and system for real-time error compensation of electricity meters under complex operating conditions. Background Technology

[0002] Electricity metering is a core component of power system operation and electricity trading settlement, and its accuracy directly affects the fairness and accuracy of metering. With the large-scale grid connection of new energy sources and the increasing complexity of industrial loads, the operating conditions of the power grid exhibit strong nonlinearity and time-varying characteristics, which places higher demands on the metering error compensation of electricity meters.

[0003] Existing error compensation methods mostly use a single fixed-length sliding window to extract operating condition features, which cannot simultaneously cover operating condition changes at different time scales such as instantaneous impact, normal fluctuations, and long-term temperature drift. This results in incomplete operating condition characterization and the compensation accuracy is difficult to meet the measurement needs under complex operating conditions. Summary of the Invention

[0004] To address the aforementioned technical problems, the present invention provides solutions in the following aspects.

[0005] In the first aspect, a real-time error compensation method for electricity meters applicable to complex operating conditions includes: Historical time-series data collected by electricity meters is acquired to construct historical samples. Multi-scale global feature vectors are extracted from the historical samples. The multi-scale global feature vectors include: multiple sliding windows of preset lengths, time-series sub-window matrices under each window with the same sampling point as the common end point, and statistical features and frequency domain features are extracted from each time-series sub-window matrix to obtain global feature vectors. Each historical sample contains the global feature vectors of all windows corresponding to the same sampling point and the true error value of that sampling point. Clustering is performed on the global feature vectors of all windows of all historical samples to obtain multiple global operating condition clusters, and the error homology between any two global operating condition clusters is calculated. Based on the aforementioned error homology, and combined with the global working condition cluster to which the global feature vector of each window in each historical sample belongs, the working condition complexity of each historical sample is calculated. Acquire real-time operating data collected by the electricity meter, construct real-time samples, obtain the global feature vector of the real-time samples and map it to the corresponding global operating condition cluster, and obtain the real-time operating condition complexity of the real-time samples. The desired number of matching samples is determined based on the real-time operating condition complexity, and a hierarchical matching strategy is used to screen candidate matching samples from historical samples. The comprehensive error is determined based on the number of candidate matching samples and the desired number of matching samples, and the comprehensive error is reverse-normalized to obtain the real-time metering compensation error, which is used for error compensation of the electricity meter.

[0006] Optionally, the historical time series data includes voltage time series, current time series, temperature time series, and humidity time series.

[0007] Optionally, the statistical features include the mean, standard deviation, maximum value, and minimum value of the temperature time series, and the mean, standard deviation, maximum value, and minimum value of the humidity time series; the frequency domain features include the fundamental effective value, total harmonic distortion rate, and fluctuation of the voltage time series and the current time series.

[0008] Optionally, the calculation of the error homology includes: For each global operating condition cluster, find all global feature vectors belonging to that cluster, trace the historical samples to which these global feature vectors belong, and extract the true error of these historical samples. Calculate the mean and standard deviation of all true errors under the global operating condition cluster; then, for any two different global operating condition clusters, calculate the square of the difference between the means of the two clusters and the sum of the squares of the standard deviations of the two clusters. Multiply the square of the difference between the means and the sum of the squares of the standard deviations to obtain the error distribution difference degree. Then, calculate the exponential function value with the natural constant as the base and the negative number of the error distribution difference degree as the exponent to obtain the error homology between the two global operating condition clusters.

[0009] Optionally, the calculation of the operational complexity of the historical samples includes: Arrange the global operating condition clusters to which the global feature vectors of each window in the historical sample belong in order of window length to obtain the operating condition cluster identifier vector of the historical sample; The frequency of occurrence of each global working condition cluster identifier in the working condition cluster identifier vector is statistically analyzed, and the working condition pattern distribution entropy of the historical sample is calculated using the Shannon entropy formula. Traverse the identifier vector of the working condition cluster, obtain all pairs of different global working condition cluster identifier combinations, and calculate the mean of the corresponding error homology. The operating condition distribution entropy is mapped through a hyperbolic tangent function, and then multiplied by an exponential function with the natural constant as the base and the negative of the mean of the error homology as the exponent, to obtain the operating condition complexity of the historical sample.

[0010] Optionally, the real-time operating complexity of the real-time sample is calculated in the same way as the operating complexity of the historical sample; the expected number of matching samples is determined by adaptively adjusting the preset number of basic matching samples based on the real-time operating complexity and rounding it up.

[0011] Optionally, the hierarchical matching strategy is: Prioritize selecting historical samples whose operating condition cluster identifier vectors are completely consistent with real-time samples as candidate matching samples; if none exist, gradually relax the matching conditions, select historical samples whose cluster labels are consistent with the first few window lengths of real-time samples, and gradually reduce the number of cluster labels required to be consistent until the candidate matching sample set is not empty.

[0012] Optionally, the determination of the comprehensive error includes: If the number of candidate matching samples is greater than or equal to the expected number of matching samples, a preset number of sample combinations are randomly generated from the candidate matching samples. For each group, the expected number of historical samples are extracted from the candidate matching samples without replacement. The standard deviation of the true error of the samples in each sample combination is calculated. The sample combination with the smallest standard deviation is selected, and the arithmetic mean of the true error in the sample combination is calculated as the comprehensive error. If the number of candidate matching samples is less than the expected number of matching samples, then the arithmetic mean of the true errors of all candidate matching samples is directly calculated as the comprehensive error.

[0013] Secondly, a real-time error compensation system for electricity meters under complex operating conditions is provided, comprising: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the real-time error compensation method for electricity meters under complex operating conditions described in any one of the above embodiments is implemented.

[0014] The present invention has the following beneficial effects: 1. The present invention provides a complete compensation scheme consisting of multi-scale global feature extraction, operating condition clustering and error homology analysis. This scheme can simultaneously cover operating condition changes at different time scales, such as instantaneous impact, normal fluctuations and long-term temperature drift. It overcomes the problem that a single fixed-length window cannot fully represent the operating conditions and significantly improves the comprehensiveness and accuracy of power meter error compensation under complex operating conditions.

[0015] 2. This invention obtains global working condition clusters through clustering and introduces an error homology index to quantify the similarity of error distributions between different working condition clusters. It also constructs a working condition complexity assessment model by combining the working condition pattern distribution entropy. This model can adaptively distinguish between truly complex working conditions and seemingly mixed but mechanistically consistent working conditions, thus providing a reliable basis for determining the number of matching samples in the future.

[0016] 3. This invention dynamically adjusts the number of expected matching samples based on the complexity of real-time operating conditions, and uses a hierarchical matching strategy to select the candidate matching samples most relevant to the current operating conditions from historical samples. Furthermore, it optimizes the sample combination by minimizing the standard deviation criterion to calculate the comprehensive error, thereby realizing the intelligent adaptation of the error compensation strategy to changes in real-time operating conditions and improving the calculation efficiency while ensuring the compensation accuracy. Attached Figure Description

[0017] Figure 1 This is a flowchart of steps S1-S3 in the real-time compensation method for electricity meter errors under complex working conditions according to an embodiment of the present invention.

[0018] Figure 2 This is a structural block diagram of a real-time error compensation system for electricity meters applicable to complex working conditions, according to an embodiment of the present invention. Detailed Implementation

[0019] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments.

[0020] Reference Figure 1 The real-time error compensation method for electricity meters applicable to complex operating conditions includes steps S1-S3, as detailed below: S1: Obtain historical time-series data collected by the electricity meter, construct historical samples, and extract multi-scale global feature vectors from the historical samples.

[0021] Electricity metering errors exhibit a strong nonlinear relationship with operating parameters such as voltage, current, harmonics, temperature, and humidity. Furthermore, different error sources have different time scales, such as instantaneous shocks, regular fluctuations, and long-term temperature drift. To comprehensively characterize operating conditions and accurately estimate errors, it is necessary to first acquire historical data labeled with actual errors. This historical data is collected and recorded by the electricity meter and its associated sensors, and then transformed into structured samples that reflect characteristics across multiple time scales.

[0022] First, the sampling frequency is set to 10kHz to acquire the voltage and current time series collected by the electricity meter itself during operation, as well as the temperature and humidity time series collected by the thermistor and capacitive humidity sensor deployed inside the electricity meter.

[0023] Simultaneously, real-time error data is acquired through a standard electricity metering device. The real error is the difference between the actual power and the measured power; its value can be positive or negative. A positive value indicates that the electricity meter reading is too low, requiring positive compensation.

[0024] All the collected data were subjected to standard normalization processing, mapping the values ​​of each dimension to... Intervals eliminate dimensional differences.

[0025] Then, a multi-window set is preset.

[0026] For example, based on the power frequency cycle and sampling frequency, a sliding window with a minimum window length of 200 sampling points and a fixed increment of 100 sampling points is used to gradually increase the window length to 2000 sampling points, resulting in a total of 19 sliding window lengths. The sliding step size is set to the minimum window length to ensure that the longest window has sufficient historical data. Starting from the 2000th sampling point, this sampling point is used as the end point of the first window and as the common end point of all window lengths. Each window length in the multi-window set is traversed, and the voltage, current, temperature, and humidity data of the end point and the consecutive number of sampling points before the end point are extracted to obtain the time-series sub-window matrix under the corresponding window length.

[0027] A historical sample is formed by combining the set of time-series sub-window matrices of all windows corresponding to the same sampling point with the actual error value corresponding to that sampling point. Each sampling point is processed one by one.

[0028] It should be noted that the true error at the end point is used as the unique error label for historical samples, thereby ensuring that windows of different lengths share the same error value and achieving accurate alignment between multi-scale operating condition information and the unique error label.

[0029] In addition, for each window of each historical sample, a global feature vector is extracted: Temperature time series: calculate mean, standard deviation, maximum and minimum values; Humidity time series: calculate mean, standard deviation, maximum and minimum values; Voltage and current time series: first perform fast Fourier transform to extract the fundamental effective value (i.e., fundamental component amplitude), total harmonic distortion rate, and fluctuation, which is defined as the range of instantaneous sampled values ​​within the window, i.e., the difference between the maximum and minimum values.

[0030] Then, the above statistical features are concatenated in a fixed order to obtain the global feature vector of the window.

[0031] In summary, each historical sample corresponds to a sampling point, which includes the temporal sub-window matrix of all windows under that sampling point, the true error, and the global feature vector of all windows.

[0032] S2: Clustering is performed based on multi-scale global feature vectors to obtain multiple global operating condition clusters. An error homology matrix is ​​constructed between the global operating condition clusters, and the operating condition complexity of each historical sample is calculated based on the error homology matrix.

[0033] Each historical sample obtained in S1 contains multiple global feature vectors with different window lengths. To group similar operating conditions into one category, these global feature vectors need to be clustered, thus mapping the high-dimensional feature space into discrete operating condition cluster labels and constructing a unified operating condition representation system across scales. Furthermore, the error generation mechanisms of electricity meters vary under different operating conditions, requiring further quantification of the similarity between operating conditions and the complexity within each historical sample, so that the most relevant historical samples can be adaptively selected for error fusion during the online phase.

[0034] First, global feature vectors of all historical samples across all windows are collected. The Euclidean distance between these global feature vectors is used as a similarity metric, and the silhouette coefficient is employed to determine the optimal number of clusters, K. In this embodiment, K is determined to be 12 based on the silhouette coefficient method to achieve a good balance between distinguishing typical working conditions and computational efficiency. K-means clustering is then performed to obtain 12 global working condition clusters. Each global feature vector is assigned a unique cluster category label.

[0035] For each historical sample, the cluster labels corresponding to all global feature vectors are arranged in ascending order of window length to obtain the working condition cluster identifier vector for that historical sample, with the dimension being the number of windows corresponding to that historical sample. This working condition cluster identifier vector preserves the combined state of multi-scale working conditions within a single historical sample.

[0036] Then, it is necessary to further quantify the similarity of the error generation mechanism between any two different global operating condition clusters obtained by the above clustering. That is, the closer the mean error within the two global operating condition clusters are, and the more concentrated the error distribution within each cluster is, the higher the overlap of the error distribution of the two global operating condition clusters, indicating that the error generation mechanism of the two is more similar and the homology is greater. Then, the error homology between any two different global operating condition clusters can be calculated.

[0037] The calculation process for the error homology between any two different global operating condition clusters is as follows: For each global operating condition cluster, find all global feature vectors belonging to that cluster, then trace the historical samples to which these global feature vectors belong, and extract the true error of these historical samples.

[0038] It should be noted that the same historical sample contains global feature vectors from multiple windows. These global feature vectors may be assigned to the same global operating condition cluster. In this case, the true error of the historical sample is only counted once to avoid double counting, which would cause the error statistical characteristics of the cluster to be incorrectly reduced.

[0039] Furthermore, the mean and standard deviation of all true errors under this global operating condition cluster are calculated. Then, the square of the difference between the means of all true errors between any two different global operating condition clusters is calculated as the squared deviation of the error centers of these two global operating condition clusters. The larger this value, the farther the error centers of the two clusters deviate, and the greater the difference in error mechanisms. Additionally, the sum of the squares of the standard deviations of all true errors between any two different global operating condition clusters is calculated as the overall error dispersion of these two global operating condition clusters. The larger this value, the more dispersed the error distribution within the two clusters, and the lower the overlap.

[0040] Furthermore, by multiplying the square of the error center deviation by the overall error dispersion, we obtain the error distribution difference between the two global operating condition clusters. This error distribution difference comprehensively measures the overall difference between the error distributions of the two clusters.

[0041] Mapping the aforementioned error distribution differences using an exponential function yields the error homology between two different global operating condition clusters, satisfying the following relationship: In the formula, For global operating condition clusters With global operating condition cluster The error origin between them For global operating condition clusters With global operating condition cluster The degree of difference in error distribution between them. When When it increases, It decreases monotonically and approaches 0. It should be noted that if... ,but .

[0042] Then, the error homology between any two different global operating condition clusters can be calculated.

[0043] Next, after obtaining the error homology matrix among the global operating condition clusters, the operating condition complexity of each historical sample can be calculated using this matrix. Truly complex operating conditions should simultaneously satisfy two conditions: chaotic operating condition patterns and inconsistent error mechanisms. If only the patterns are chaotic but the error mechanisms of each cluster are highly consistent, the error patterns are still relatively simple; if the patterns are singular, the operating condition complexity is low regardless of the mechanism.

[0044] The specific calculation process for the working condition complexity of the above single historical sample is as follows: The operating condition cluster identifier vector of the historical sample is extracted, and the frequency of occurrence of each global operating condition cluster identifier in the operating condition cluster identifier vector is counted. The operating condition mode distribution entropy of the historical sample is calculated using the existing Shannon entropy formula. The larger the operating condition mode distribution entropy, the more different operating condition modes the historical sample exhibits under different windows, that is, the more mixed the operating conditions.

[0045] Furthermore, the operating condition cluster identifier vector of the historical sample is traversed to obtain all pairs of different cluster identifier combinations, i.e., two different global operating condition clusters. Then, the mean value of the corresponding error homology is calculated. The larger the mean value, the more consistent the error mechanism is between the different global operating condition clusters involved in the historical sample.

[0046] Finally, the calculated operating condition pattern distribution entropy is fused with the mean of the error homology of all pairwise distinct global operating condition clusters to obtain the operating condition complexity of this historical sample, which satisfies the following relationship: In the formula, The complexity of the working conditions for this historical sample. This represents the entropy of the operating condition pattern distribution for this historical sample. This represents the mean of the error homology among all pairwise distinct global operating condition clusters in this historical sample. It is the hyperbolic tangent function.

[0047] in, Follow It increases monotonically with the increase of , and with The complexity of the historical sample increases monotonically as the operating conditions increase, meaning that the more chaotic the operating conditions and the more inconsistent the error mechanisms, the greater the complexity of the historical sample's operating conditions, representing truly complex operating conditions. Conversely, if the operating conditions are simple or the mechanisms are consistent, the complexity of the historical sample's operating conditions is relatively small.

[0048] Similarly, the working condition complexity of all historical samples can be obtained.

[0049] S3: Acquire real-time operating data collected by the electricity meter, construct real-time samples, adaptively determine the number of matching samples based on the complexity of the operating conditions, and calculate the real-time metering compensation error.

[0050] The aforementioned offline phases S1 and S2 have established a global operating condition cluster, error homogeneity among global operating condition clusters, and operating condition complexity of historical samples. When the energy meter is running online, it is necessary to acquire real-time operating data collected by the energy meter and its sensors, quickly identify the current operating condition, and adaptively fuse the best-matching error compensation value using real error information from historical samples.

[0051] First, following the steps of S1 above, real-time data of voltage, current, temperature, and humidity before the current sampling point of the electricity meter are collected, and real-time samples of the current sampling point and global feature vectors of all windows under the real-time samples are constructed.

[0052] Then, following the steps in S2 above, the global feature vector of each window of the real-time sample is mapped to the corresponding global operating condition cluster. That is, the Euclidean distance between the global feature vector of each window of the real-time sample and the center of each global operating condition cluster is calculated, and the sample is assigned to the cluster with the closest Euclidean distance. The cluster labels are arranged in ascending order of window length to obtain the operating condition cluster identifier vector of the real-time sample, and the real-time operating condition complexity of the real-time sample is calculated.

[0053] Next, based on the real-time operational complexity of the real-time samples, the expected number of matching samples is obtained from the historical sample set. That is, the following relationship is satisfied: In the formula, For the desired number of matching samples, The preset base number of matching samples, The real-time operating complexity of the real-time sample. This is a mapping function.

[0054] Next, a hierarchical matching strategy is adopted to screen candidate matching samples from all historical samples in S1 above: a candidate set is constructed, and historical samples whose working condition cluster identifier vectors are completely consistent with those of the real-time samples are selected as candidate matching samples. If none exist, the matching conditions are relaxed step by step, and historical samples whose cluster labels are consistent with the first few window lengths of the real-time samples are selected in turn, and the number of cluster labels required to be consistent is gradually reduced until the candidate set is not empty.

[0055] If the number of candidate matching samples in the above candidate set is greater than or equal to the expected number of matching samples, then 100 sets of sample combinations are randomly generated from the candidate set, each set being drawn without replacement from the candidate set. The system consists of 100 historical samples (the number of combinations can be adjusted according to the requirements of calculation accuracy and efficiency; this embodiment takes 100 groups as an example). The standard deviation of the true error of the samples in each combination is calculated, and the group with the smallest standard deviation is selected. The arithmetic mean of the errors in this group is used as the comprehensive error. If the number of candidate matching samples in the above candidate set is less than the number of expected matching samples, the arithmetic mean of the true errors of all historical samples in the candidate set is directly calculated as the comprehensive error.

[0056] Finally, a reverse normalization operation is performed on the comprehensive error to obtain the real-time metering compensation error with actual physical dimensions. This error value is then sent to the metering module of the electricity meter to complete the dynamic correction of the metering error at the current sampling time.

[0057] By repeating the above process, continuous real-time error compensation of the electricity meter under complex operating conditions can be achieved.

[0058] This invention also provides a real-time error compensation system for electricity meters suitable for complex operating conditions. For example... Figure 2 As shown, the system includes a processor and a memory. The memory stores computer program instructions. When the computer program instructions are executed by the processor, the real-time compensation method for electricity meter errors under complex working conditions according to the first aspect of the present invention is implemented.

[0059] The system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces, the settings and functions of which are known in the art and will not be described in detail here.

[0060] It should be noted that those skilled in the art can make various modifications and improvements without departing from the inventive concept, and these all fall within the scope of protection of this invention. Therefore, the scope of protection of this patent should be determined by the appended claims.

Claims

1. A real-time error compensation method for electricity meters applicable to complex operating conditions, characterized in that, include: Acquire historical time-series data collected by electricity meters, construct historical samples, and extract multi-scale global feature vectors from the historical samples; The multi-scale global feature vector includes: multiple sliding windows of preset lengths, extracting time-series sub-window matrices under each window with the same sampling point as the common end point, extracting statistical features and frequency domain features from each time-series sub-window matrix to obtain a global feature vector; each historical sample contains the global feature vectors of all windows corresponding to the same sampling point and the true error value of that sampling point; Clustering is performed on the global feature vectors of all windows of all historical samples to obtain multiple global operating condition clusters, and the error homology between any two global operating condition clusters is calculated. Based on the aforementioned error homology, and combined with the global working condition cluster to which the global feature vector of each window in each historical sample belongs, the working condition complexity of each historical sample is calculated. Acquire real-time operating data collected by the electricity meter, construct real-time samples, obtain the global feature vector of the real-time samples and map it to the corresponding global operating condition cluster, and obtain the real-time operating condition complexity of the real-time samples. The desired number of matching samples is determined based on the real-time operating condition complexity, and a hierarchical matching strategy is used to screen candidate matching samples from historical samples. The comprehensive error is determined based on the number of candidate matching samples and the desired number of matching samples, and the comprehensive error is reverse-normalized to obtain the real-time metering compensation error, which is used for error compensation of the electricity meter.

2. The real-time error compensation method for electricity meters under complex operating conditions according to claim 1, characterized in that, The historical time series data includes voltage time series, current time series, temperature time series, and humidity time series.

3. The real-time error compensation method for electricity meters under complex operating conditions according to claim 2, characterized in that, The statistical features include the mean, standard deviation, maximum value, and minimum value of the temperature time series, as well as the mean, standard deviation, maximum value, and minimum value of the humidity time series; the frequency domain features include the fundamental effective value, total harmonic distortion rate, and fluctuation of the voltage and current time series.

4. The real-time error compensation method for electricity meters under complex operating conditions according to claim 1, characterized in that, The calculation of the error homology includes: For each global operating condition cluster, find all global feature vectors belonging to that cluster, trace the historical samples to which these global feature vectors belong, and extract the true error of these historical samples. Calculate the mean and standard deviation of all true errors under the global operating condition cluster; then, for any two different global operating condition clusters, calculate the square of the difference between the means of the two clusters and the sum of the squares of the standard deviations of the two clusters. Multiply the square of the difference between the means and the sum of the squares of the standard deviations to obtain the error distribution difference degree. Then, calculate the exponential function value with the natural constant as the base and the negative number of the error distribution difference degree as the exponent to obtain the error homology between the two global operating condition clusters.

5. The real-time error compensation method for electricity meters under complex operating conditions according to claim 1, characterized in that, The calculation of the operational complexity of the historical samples includes: Arrange the global operating condition clusters to which the global feature vectors of each window in the historical sample belong in order of window length to obtain the operating condition cluster identifier vector of the historical sample; The frequency of occurrence of each global working condition cluster identifier in the working condition cluster identifier vector is statistically analyzed, and the working condition pattern distribution entropy of the historical sample is calculated using the Shannon entropy formula. Traverse the identifier vector of the working condition cluster, obtain all pairs of different global working condition cluster identifier combinations, and calculate the mean of the corresponding error homology. The operating condition distribution entropy is mapped through a hyperbolic tangent function, and then multiplied by an exponential function with the natural constant as the base and the negative of the mean of the error homology as the exponent, to obtain the operating condition complexity of the historical sample.

6. The real-time error compensation method for electricity meters under complex operating conditions according to claim 1, characterized in that, The real-time operating condition complexity of the real-time sample is calculated in the same way as that of the historical sample; the expected number of matching samples is determined by adaptively adjusting the preset number of basic matching samples based on the real-time operating condition complexity and rounding it up.

7. The real-time error compensation method for electricity meters under complex operating conditions according to claim 1, characterized in that, The hierarchical matching strategy is as follows: Prioritize selecting historical samples whose operating condition cluster identifier vectors are completely consistent with real-time samples as candidate matching samples; if none exist, gradually relax the matching conditions, select historical samples whose cluster labels are consistent with the first few window lengths of real-time samples, and gradually reduce the number of cluster labels required to be consistent until the candidate matching sample set is not empty.

8. The real-time error compensation method for electricity meters under complex operating conditions according to claim 1, characterized in that, The determination of the comprehensive error includes: If the number of candidate matching samples is greater than or equal to the expected number of matching samples, a preset number of sample combinations are randomly generated from the candidate matching samples. For each group, the expected number of historical samples are extracted from the candidate matching samples without replacement. The standard deviation of the true error of the samples in each sample combination is calculated. The sample combination with the smallest standard deviation is selected, and the arithmetic mean of the true error in the sample combination is calculated as the comprehensive error. If the number of candidate matching samples is less than the expected number of matching samples, then the arithmetic mean of the true errors of all candidate matching samples is directly calculated as the comprehensive error.

9. A real-time error compensation system for electricity meters suitable for complex operating conditions, characterized in that, include: A processor and a memory, wherein the memory stores computer program instructions that, when executed by the processor, implement the real-time error compensation method for electricity meters under complex operating conditions according to any one of claims 1-8.