Self-adaptive electric energy metering algorithm and system based on dynamic environment compensation
By constructing differential and cluster analysis of electric energy metering errors and environmental feature sequences, the optimal input environmental factors and time length are determined, and an electric energy metering error prediction model is constructed. This solves the problem of environmental change impact in the electric energy metering algorithm and improves metering accuracy and stability.
Patent Information
- Application Number
- CN202511286645.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-10
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-09-10
AI Technical Summary
Existing electricity metering algorithms fail to effectively consider the impact of environmental changes on electricity metering errors, resulting in insufficient metering accuracy.
Construct historical electricity metering error sequences and environmental feature sequences, determine the optimal input environmental factors and time length through differential and cluster analysis of environmental feature sequences, build an electricity metering error prediction model, and perform error compensation in real time.
The prediction accuracy of electric energy metering errors is improved, and the adaptability and stability of electric energy metering are enhanced.
Smart Images

Figure CN120804748A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of dynamic compensation of electric energy metering, and in particular to an adaptive electric energy metering algorithm and system based on dynamic environment compensation. BACKGROUND
[0002] Electric energy metering is a core link of power system operation, and its accuracy is directly related to the economic interests of power supply and consumption parties, the rationality of power grid dispatching, the evaluation of energy utilization efficiency, and the fairness of the electricity market. With the acceleration of global energy transformation, the promotion of smart grid construction, and the large-scale access of distributed energy (such as photovoltaic and wind power) and new type of electrical equipment (such as electric vehicles and variable frequency household appliances), the complexity of the working condition of the power system has been significantly improved, and higher requirements have been put forward for the accuracy, stability and adaptability of electric energy metering. In actual power systems, the metering environment is not in an ideal state, and dynamic factors such as temperature, humidity, electromagnetic interference, power grid harmonics and voltage fluctuation will significantly affect the metering accuracy. However, the traditional algorithm is often designed based on the "static environment assumption", without considering the real-time changes of such disturbances, resulting in error accumulation. Therefore, how to adaptively compensate for electric energy metering based on the dynamic changes of the environment is a problem to be solved.
[0003] The patent with publication number CN117669647A discloses an electric energy metering adaptive compensation method and device based on a BP network. The method discloses learning the relationship between environmental parameters, electric energy metering and electric energy compensation through a neural network. This method only considers the influence of single-time environmental parameters on electric energy metering, without considering the influence of environmental parameter sequences on electric energy metering. SUMMARY
[0004] In order to solve the problem that the existing electric energy metering compensation method does not consider the influence of environmental changes on electric energy metering error, resulting in low accuracy of metering error predicted by the model, the present application provides an adaptive electric energy metering algorithm and system based on dynamic environment compensation.
[0005] In the first aspect, the present application provides an adaptive electric energy metering algorithm based on dynamic environment compensation, which adopts the following technical scheme: An adaptive electric energy metering algorithm based on dynamic environment compensation includes the following steps: A historical electric energy metering error sequence and an environmental feature sequence corresponding to the time are constructed, the difference of the environmental feature sequence is calculated to obtain an environmental feature difference sequence, and the environmental feature sequence is a multi-dimensional sequence; For any dimensional environmental feature sequence, different sequence segments are obtained by dividing the environmental feature sequence and the environmental feature difference sequence according to a preset time length, the distance between the sequence segments is calculated, clustering is performed according to the distance, the distribution of error corresponding to each cluster is calculated after clustering is completed, and an evaluation function is constructed according to the distribution of error; Select an environmental feature sequence of any dimension as a target environmental factor, and sum evaluation functions of all dimensions of the target environmental factor as an evaluation function of the target environmental factor; Calculate evaluation functions of different target environmental factors under different preset time lengths, and when the evaluation function reaches the maximum, the target environmental factor and the preset time length are the best input environmental factor and the best input length of the electric energy metering error prediction model; According to the best input environmental factor and the best input length, an electric energy metering error prediction model is constructed, and the electric energy metering error prediction model is trained using historical data, and after training, the electric energy metering error is predicted in real time.
[0006] Beneficial effects are: by dividing the environmental feature sequence to obtain sequence segments, and clustering the sequence segments to obtain different environmental change conditions, whether the sequence division is reasonable is determined according to the distribution of the electric energy metering error under different environmental change conditions, and the electric energy metering error prediction model is constructed according to the best sequence division result, which improves the prediction accuracy of the electric energy metering error.
[0007] Optionally, the environmental feature sequence includes a temperature sequence, a humidity sequence, and an electromagnetic interference sequence.
[0008] Optionally, the distance between the sequence segments is a weighted sum of the environmental feature sequence distance and the environmental feature difference sequence distance between different sequences.
[0009] Beneficial effects are: when calculating the distance between different sequence segments, the distance between the environmental feature sequences of different sequence segments is considered, and the difference in the change of the environmental feature sequences of different sequence segments is also considered.
[0010] Optionally, the environmental feature sequence distance is calculated by normalizing the Euclidean distance of two environmental feature sequences.
[0011] Beneficial effects are: the distance between two environmental feature sequences reflects the static difference between the two environmental feature sequences at each time, therefore, using the Euclidean distance can better reflect the static difference.
[0012] Optionally, the environmental feature difference sequence distance is calculated by normalizing the Pearson correlation coefficient of two environmental feature difference sequences.
[0013] Beneficial effects are: the environmental feature difference sequence is mainly used to reflect the change of the environmental feature sequence, and the Pearson correlation coefficient is used to calculate the difference between two environmental feature difference sequences, which can better reflect whether the change trends of the two sequences are consistent.
[0014] Optionally, the calculation process of the evaluation function is as follows: after clustering, each sequence segment in the clustering cluster corresponds to an electric energy metering error, one clustering cluster corresponds to an electric energy metering error distribution, the kurtosis and dispersion of the electric energy metering error distribution are calculated, and the ratio of the kurtosis and dispersion is taken as the evaluation function.
[0015] The beneficial effect is that the greater the kurtosis of the electric energy metering error distribution corresponding to the clustering cluster, the greater the probability that the electric energy metering error is a certain value, the higher the concentration of the error distribution, the smaller the dispersion of the electric energy metering error distribution corresponding to the clustering cluster, and the lower the possibility of occurrence of smaller or larger error values in the electric energy metering error distribution, and the higher the concentration of the error distribution.
[0016] Optionally, the calculation of the dispersion is the difference between the 3 / 4-bit number and the 1 / 4-bit number of the normalized electric energy metering error distribution.
[0017] The beneficial effect is that when the error distribution is concentrated, the 3 / 4-bit number and the 1 / 4-bit number of the error distribution are close, and the difference between the two is small, therefore, the smaller the difference, the smaller the dispersion of the error distribution, and the more concentrated the error distribution.
[0018] In a second aspect, the application provides an adaptive electric energy metering system based on dynamic environment compensation, which adopts the following technical solution: It comprises a processor and a memory, and the memory stores computer program instructions, which realize the adaptive electric energy metering algorithm based on dynamic environment compensation when executed by the processor.
[0019] The beneficial effect is that the adaptive electric energy metering algorithm based on dynamic environment compensation is generated into a computer program and stored in the memory to be loaded and executed by the processor, so that the system is convenient to use according to the memory and the processor.
[0020] The application has the following technical effects: 1. The application finds the influence of the environment sequence on the electric energy metering from the perspective of time sequence, finds the time length of the influence of the environment on the electric energy, and finds the mapping relationship between different environmental changes and errors through the analysis of the environment sequence and the error.
[0021] 2. According to the error distribution under different environmental changes at different time lengths, the time length corresponding to the most concentrated error distribution is found, the relationship between the environmental change and the error at this time length is most certain, and the error prediction accuracy of the constructed model is the highest. BRIEF DESCRIPTION OF DRAWINGS
[0022] The above and other objects, features and advantages of the present application will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings in which a number of embodiments of the application are illustrated by way of example and not limitation. Like or corresponding elements in the figures are denoted by like reference numerals.
[0023] Figure 1 is a flowchart of steps S1-S4 in an adaptive electric energy metering algorithm based on dynamic environment compensation.
[0024] Figure 2 is a structural block diagram of an adaptive electric energy metering system based on dynamic environment compensation. DETAILED DESCRIPTION
[0025] The technical solutions in the embodiments of the present application will be apparently and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without any creative work fall within the scope of protection of the present application.
[0026] It should be understood that when the claims, the specification and the drawings of the present application use the terms “first”, “second”, etc., they are only used to distinguish different objects, rather than to describe a specific sequence. The terms “include” and “contain” used in the specification and claims of the present application indicate the existence of the described features, whole, steps, operations, elements and / or components, but do not exclude the existence or addition of one or more other features, whole, steps, operations, elements, components and / or sets thereof.
[0027] The embodiments of the present application disclose an adaptive electric energy metering algorithm based on dynamic environment compensation, referring to Figure 1 , comprising the following steps: S1: constructing a historical electric energy metering error sequence and an environment feature sequence corresponding to the time.
[0028] In one embodiment, the temperature sensor is used to collect the ambient temperature, the humidity sensor is used to collect the ambient humidity, the device for collecting electromagnetic interference is used to collect the electromagnetic interference intensity, the power sensor is used to collect the power, the electric energy metering error is obtained according to the difference between the measured value and the true value of the power, the collection time of temperature, humidity and electric energy error is aligned, the temperature, humidity and electric energy error collected once is a sample, the fixed collection frequency (for example, it can be 10 times / 1 minute), after the collection is completed, the data is normalized to obtain the historical electric energy metering error sequence and the environment feature sequence.
[0029] S2: calculate the difference sequence of the environment feature sequence, divide the environment feature sequence and the difference sequence thereof into sequence segments according to the preset time length, set the calculation method of the distance between the sequence segments during clustering, select an arbitrary environment feature to obtain a target environment factor, and calculate the clustering results of different target environment factors under different preset time lengths.
[0030] In one embodiment, the error of electric energy metering is different under different environments and different environmental changes, that is, the error of electric energy at the current moment may be related to the environment at the current moment, or may be related to the environmental state at the previous moment. In order to find the relationship between environmental change and electric energy metering error, the application analyzes the relationship between environment and electric energy error by presetting different time lengths. Specifically: The environment feature sequence obtained by S1 is differentiated to obtain an environment feature difference sequence, a preset time length is set, and the environment feature sequence and the environment feature difference sequence are divided by a sliding window. After division, sequence segments are obtained, each sequence segment includes the environment feature sequence and the environment feature difference sequence. An example is as follows: The preset time length is 4, and the divided sequence segments are , , , , , The electric energy error of each sequence segment is the electric energy error corresponding to the last moment. At this time, the data form is that one sequence segment corresponds to one electric energy metering error.
[0031] The divided sequence segments are clustered. When clustering, the distance of the environment feature sequence and the distance of the environment feature difference sequence of two sequence segments are calculated respectively, and the two distances are weighted and summed to obtain the distance of the two sequence segments. The distance calculation formula of the two environment feature sequences is as follows: Wherein, represents the distance of the two environment feature sequences, represents a normalization function, and the purpose is to finally obtain a distance within a certain range, represents the preset time length, represents the feature value of the i-th environment feature sequence at the k-th moment, represents the feature value of the j-th environment feature sequence at the k-th moment. Reflects the difference between the two sequence environment features. The greater the difference, the greater the distance between the two sequences, and the less likely the two sequences belong to the same cluster.
[0032] The distance calculation formula of the two environment feature difference sequences is as follows: wherein, represents the distance of two environmental feature difference sequences, represents the exponential function with base represents the xth environmental feature difference sequence, represents the yth environmental feature difference sequence, represents the covariance of two difference sequences, represents the standard deviation of the environmental feature difference sequence represents the standard deviation of the environmental feature difference sequence represents the Pearson correlation coefficient of the environmental feature difference sequence and the environmental feature difference sequence The distance of the environmental feature difference sequences reflects whether the changes of the two environmental features are consistent. The closer the Pearson correlation coefficient of the two difference sequences is to 1, the more consistent the changes of the two sequences are.
[0033] In other embodiments, the distance calculation process of the two environmental feature difference sequences can also be: performing trend test on the two environmental feature difference sequences respectively, obtaining the probability of the sequence having an upward trend after the trend test, and taking the difference between the probabilities of the upward regions of the two sequences as the distance of the two environmental feature difference sequences. The method of trend test is a prior art, which will not be described here.
[0034] According to the distance between the sequence segments, the sequence segments are clustered, and after clustering, each cluster is obtained. According to the electric energy metering error corresponding to the sequence segments in the cluster, the electric energy metering error distribution corresponding to the cluster is obtained.
[0035] When calculating the error influence of the environment on the electric energy metering, not only the length of time of the environmental features that will affect the electric energy metering error should be considered, but also which environmental features have a stronger influence on the electric energy metering error should be considered. Therefore, the best influencing factor is determined through the relationship between different environmental features and the electric energy metering error, and the specific process is as follows: Select an arbitrary environmental feature to obtain a target environmental factor. The number of environmental features responding to the target environmental factor is equal to 1. The environmental feature sequence and the environmental feature difference sequence are processed using the above method to obtain the electric energy metering error corresponding to each cluster after clustering. In response to the number of environmental features responding to the target environmental factor being greater than 1, the distance calculation process when clustering the sequence segments is as follows: first, calculate the distance of any environmental feature sequence and the corresponding environmental feature difference sequence in the two sequence segments, and then sum the distances of all environmental feature sequences and the corresponding environmental feature difference sequences to obtain the distance of the two sequence segments.
[0036] So far, different clustering results of the target environmental factors under different preset time lengths are obtained.
[0037] S3: For each clustering result, the distribution of the electric energy measurement error corresponding to the clustering cluster is calculated, the evaluation function of the clustering result is constructed according to the kurtosis and dispersion of the error distribution of each clustering cluster, and the best clustering result is selected according to the evaluation function.
[0038] In one embodiment, in order to obtain the best environmental feature and preset time length to make the prediction accuracy of the time series model higher, the evaluation function of the clustering result is constructed, when the evaluation function reaches the maximum, the environmental feature and the preset time length at this time are the best, and the specific evaluation function is composed of the kurtosis and dispersion of the electric energy measurement error distribution corresponding to the clustering cluster, and the calculation formula is as follows: Wherein, indicates the evaluation function of the i th clustering result, indicates the total number of clustering clusters of the i th clustering result, indicates the kurtosis of the electric energy measurement error distribution corresponding to the j th clustering cluster in the i th clustering result, indicates the dispersion of the electric energy measurement error distribution corresponding to the j th clustering cluster in the i th clustering result. Kurtosis is also called kurtosis coefficient. It is a characteristic number representing the height of the peak value of the probability density distribution curve at the mean value. In a direct view, kurtosis reflects the sharpness of the peak. The kurtosis of the sample is compared with the normal distribution, if the kurtosis is greater than three, the peak shape is relatively sharp, and the peak is steeper than the normal distribution. The greater the kurtosis of the electric energy measurement error distribution corresponding to each clustering cluster, the more concentrated the electric energy error corresponding to the clustering cluster is, and the smaller the dispersion of the electric energy measurement error corresponding to each clustering cluster, the more concentrated the electric energy error corresponding to the clustering cluster is. Therefore, the greater the value of the evaluation function, the more optimal the environmental feature and the preset time length selected at this time, because the electric energy measurement error corresponding to the environmental change in the same period is more concentrated and stable at this time, and it is easier to use the model to learn the relationship between the environment and the electric energy measurement error. Wherein, the calculation method of the dispersion is the difference between the 3 / 4 digit and the 1 / 4 digit of the normalized electric energy measurement error distribution, the greater the difference, the more dispersed the electric energy error distribution is.
[0039] The greater the kurtosis of the electric energy measurement error distribution corresponding to each clustering cluster, the more concentrated the electric energy error corresponding to the clustering cluster is, and the smaller the dispersion of the electric energy measurement error corresponding to each clustering cluster, the more concentrated the electric energy error corresponding to the clustering cluster is. Therefore, the greater the value of the evaluation function, the more optimal the environmental feature and the preset time length selected at this time, because the electric energy measurement error corresponding to the environmental change in the same period is more concentrated and stable at this time, and it is easier to use the model to learn the relationship between the environment and the electric energy measurement error.
[0040] The greater the kurtosis of the electric energy measurement error distribution corresponding to each clustering cluster, the more concentrated the electric energy error corresponding to the clustering cluster is, and the smaller the dispersion of the electric energy measurement error corresponding to each clustering cluster, the more concentrated the electric energy error corresponding to the clustering cluster is. Therefore, the greater the value of the evaluation function, the more optimal the environmental feature and the preset time length selected at this time, because the electric energy measurement error corresponding to the environmental change in the same period is more concentrated and stable at this time, and it is easier to use the model to learn the relationship between the environment and the electric energy measurement error.
[0041] Wherein, the calculation method of the dispersion is the difference between the 3 / 4 digit and the 1 / 4 digit of the normalized electric energy measurement error distribution, the greater the difference, the more dispersed the electric energy error distribution is.
[0042] In other embodiments, the calculation method of the dispersion degree can be the variance of the cluster cluster energy error. The greater the variance, the more dispersed the energy error distribution is. The smaller the variance, the more concentrated the energy error distribution is.
[0043] The evaluation function value of the clustering result of different target environmental factors under different preset time lengths is calculated. When the value of the evaluation function reaches the maximum, the corresponding target environmental factor and preset time length are the best input environmental factor and the best input length.
[0044] S4: Constructing an energy error prediction dataset according to the best input environmental factor and the best input length, training a time series prediction model using the energy error prediction dataset, selecting an optimal model after the model training is completed, and performing real-time prediction of the energy error according to the optimal model.
[0045] In one embodiment, a time series prediction model is constructed according to the best environmental factor and the best input length obtained according to the above steps. The environmental feature sequence corresponding to the best environmental factor in the data collected in S1 is divided according to the best input length, and an energy error prediction dataset is obtained after the division, such as: the best environmental factor is temperature and humidity, and the best input length is 5. A training sample after division is: the temperature value and humidity value of the consecutive 5 time points, and the corresponding energy metering error. In the training process, the feature sequence of the best environmental factor is input into the time series prediction model, the output of the model is the energy metering error, the loss function of the model uses the mean square error loss, and the gradient descent algorithm is used to update the model parameters. When the model reaches the preset maximum training times or the loss of the model is less than the set loss threshold, the model stops training. The optimal model is selected according to the accuracy of the evaluation index. The exemplary maximum training times of the model is 1000 times, and the loss threshold is 0.01.
[0046] Collecting real-time best environmental factor values, inputting the collected best environmental factor values into the optimal model, and outputting real-time energy metering error.
[0047] The embodiments of the present application also disclose an adaptive energy metering system based on dynamic environmental compensation, as shown in Figure 2 The embodiments of the present application also disclose an adaptive energy metering system based on dynamic environmental compensation, as shown in
[0048] The above system also includes a communication bus and a communication interface and other components familiar to those skilled in the art. The settings and functions thereof are known in the art, and thus will not be described here.
[0049] In this application, the aforementioned memory can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device. For example, the computer-readable storage medium can be any suitable magnetic storage medium or magnetic-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Access Memory (EDRAM), High Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), and the like, or any other medium that can be used to store the desired information and that can be accessed by an application, module, or both. Any such computer storage media can be part of the device or accessible or connectable thereto.
[0050] Although the present specification has shown and described a number of embodiments of the application, it is to be understood that those skilled in the art will be able to devise various arrangements which, although not explicitly enumerated here, embody the principles of the application and fall within its spirit and scope. It is intended that the present specification be construed as including all such arrangements.
[0051] The above are only preferred embodiments of the present application, not to limit the protection scope of the present application, therefore: all equivalent changes made on the structure, shape, principle of the present application should be covered within the protection scope of the present application.
Claims
1. An adaptive electric energy metering algorithm based on dynamic environmental compensation, characterized in that: The following steps are involved: Construct the historical electric energy metering error sequence and the environmental feature sequence at the corresponding moment, calculate the difference of the environmental feature sequence to obtain the environmental feature difference sequence, and the environmental feature sequence is a multi-dimensional sequence; For environmental feature sequences of any dimension, the environmental feature sequences and environmental feature difference sequences are divided into different sequence segments according to the preset time length. The distance between the sequence segments is calculated and clustered according to the distance. After clustering, the distribution of the error corresponding to each cluster is calculated and the evaluation function is constructed according to the distribution of the error. Select an environmental feature sequence of any dimension as the target environmental factor, and take the sum of the evaluation functions of all dimensions of the target environmental factor as the evaluation function of the target environmental factor; Calculate the evaluation function of different target environmental factors under different preset time lengths. When the evaluation function reaches the maximum, the target environmental factors and the preset time length are the optimal input environmental factors and optimal input length of the electric energy metering error prediction model. An electric energy metering error prediction model is constructed based on the optimal input environmental factors and the optimal input length. The electric energy metering error prediction model is trained using historical data. After training, the electric energy metering error is predicted in real time.
2. The adaptive electric energy metering algorithm based on dynamic environmental compensation according to claim 1, characterized in that: The environmental feature sequence includes a temperature sequence, a humidity sequence, and an electromagnetic interference sequence.
3. The adaptive electric energy metering algorithm based on dynamic environment compensation according to claim 1, characterized in that: The distance between the sequence segments is the weighted sum of the environmental feature sequence distance and the environmental feature differential sequence distance between different sequences.
4. The adaptive electric energy metering algorithm based on dynamic environmental compensation according to claim 3, characterized in that: The method for calculating the environmental feature sequence distance is: normalizing the Euclidean distance between two environmental feature sequences.
5. The adaptive electric energy metering algorithm based on dynamic environment compensation according to claim 3 is characterized in that: The calculation method of the environmental feature difference sequence distance is: normalizing the Pearson correlation coefficient of the two environmental feature difference sequences.
6. The adaptive electric energy metering algorithm based on dynamic environment compensation according to claim 1, characterized in that: The calculation process of the evaluation function is as follows: after clustering is completed, each sequence segment in the cluster corresponds to an electric energy metering error, and a cluster corresponds to an electric energy metering error distribution. The kurtosis and dispersion of the electric energy metering error distribution are calculated, and the ratio of the kurtosis to the dispersion is used as the evaluation function.
7. The adaptive electric energy metering algorithm based on dynamic environment compensation according to claim 6, characterized in that: The calculation of the dispersion is the difference between the 3 / 4 digit and the 1 / 4 digit of the normalized electric energy metering error distribution.
8. An adaptive electric energy metering system based on dynamic environmental compensation, characterized in that: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, an adaptive electric energy metering algorithm based on dynamic environment compensation according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Electric energy meter metering error prediction method, system and device based on multi-stress influence
CN113447879A
Operation strategy method of self-adaptive optical storage and charging system
CN117879118A
Ammeter adaptive error compensation method and system
CN119959857A
Automatic feeding method and system based on electromagnetic valve flowmeter data
CN120477090A
Electric energy meter metering misalignment analysis method and apparatus, storage medium, and electronic device
WO2024078010A1