Electric energy metering system and method based on intelligent algorithm
Patent Information
- Application Number
- CN202511660258.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-13
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2045-11-13
AI Technical Summary
大多数算法在面对突发异常时,缺乏一套明确的“识别-响应-替换”机制,无法做到对扰动行为的动态识别、对低置信度数据的训练降权处理,以及在模型识别失效时进行回滚或切换
本发明通过将目标电力线路中的电能参数按照时间顺序划分为多个滑动时间窗口,并对每一窗口内的电能参数计算信息熵值,进一步构建动态统计模型,实现了对电能特征在时间维度上的连续监测与演化感知。借助信息熵变化速率的计算与动态统计模型的动态判定机制,能够精准识别出突发性的电能扰动区域,本发明可在应对工业场景中高频变化、复杂负载干扰等实际工况时,动态识别局部非稳态行为,增强电能异常识别的灵活性与准确性。
Smart Images

Figure CN121479118B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent sensing technology, and more specifically, to an energy metering system and method based on intelligent algorithms. Background Technology
[0002] With the rapid development of industrial automation and energy intelligence, electricity metering technology is evolving from traditional static sampling and rule analysis methods to an intelligent algorithm-driven model with intelligent identification, dynamic learning, and adaptive optimization capabilities. In electricity metering systems, accurately identifying and measuring the actual electricity consumption behavior of load devices, responding to changes in power quality, and providing stable data support have become key technological requirements in smart grid construction.
[0003] Existing technologies have partially incorporated intelligent algorithms such as machine learning, deep learning, and self-learning models to model and analyze multi-dimensional electrical energy parameters such as current, voltage, frequency, and harmonics, enabling tasks such as nonlinear identification, time-series prediction, and load behavior classification. While these methods have achieved some success in experimental environments or certain static scenarios, the following core problems remain insurmountable in complex industrial power environments: Power data is characterized by high dimensionality, high frequency, strong disturbances, and low stability. In large and medium-sized industrial sites, power quality problems such as voltage fluctuations, current surges, and frequency deviations frequently occur due to the frequent start-stop of heavy-load equipment, harmonic source equipment, and nonlinear power factor compensation devices. These non-stationary disturbance signals place extremely high demands on the stability recognition capabilities of algorithms. Existing intelligent power metering methods lack effective disturbance removal and classification mechanisms for power quality anomalies. Because some power anomalies have repetitive characteristics in specific scenarios, such as morning and evening start-stop cycles and phased load switching, the self-learning algorithm in the system may incorrectly identify these disturbance behaviors as "inherent characteristics" or "tolerable fluctuation ranges" of equipment operation after long-term operation, and thus include them in the model's learning samples and assign them high weights. As a result, the model not only fails to eliminate anomalies, but also "solidifies" contaminated data as part of normal behavior.
[0004] The risk of model weight contamination brought about by self-learning mechanisms has not been fully recognized. In existing methods, most algorithm designs assume that the quality of sample data is controllable and do not establish a constraint relationship between "input confidence" and "training weights." In actual operation, once perturbation data is mixed into the input samples, the model may gradually absorb these abnormal features, leading to model output shift, decreased generalization ability, and in severe cases, even safety issues such as misidentification and misclassification. This contamination is not immediately visible but gradually damages the model structure in a subtle way, a risk known as self-learning contamination.
[0005] Existing technologies lack dynamic anomaly monitoring and robust control mechanisms. Most algorithms, when faced with sudden anomalies, lack a clear "identification-response-replacement" mechanism, failing to dynamically identify disturbances, reduce the weight of training data with low confidence, or roll back or switch when model identification fails. While some systems incorporate anomaly alarm mechanisms, they remain at the level of static threshold triggering, failing to achieve intelligent, real-time, and highly adaptable algorithm strategy management. Therefore, this invention proposes an intelligent algorithm-based electricity metering system and method to address the aforementioned problems. Summary of the Invention
[0006] To achieve the above objectives, the present invention provides the following technical solution: The energy metering method based on intelligent algorithms includes the following steps: Steps for acquiring power signals and dividing windows: acquire power parameters in the target power line, and divide the acquired power parameters into multiple sliding time windows in chronological order; Information entropy calculation and drift determination steps: Calculate the information entropy corresponding to the power parameters in each sliding time window, and construct a dynamic statistical model based on the information entropy changes in historical time windows; when the rate of change of information entropy corresponding to the current time window is greater than the set first threshold, mark the time window as a high-risk window for external disturbance, and set the data in the window as low-confidence data; Training sample weight adjustment steps: For data marked as high-risk windows of external perturbation, before using it for training the self-learning model, dynamically reduce the sample weights participating in model training to suppress the dominant role of this type of data in updating model parameters. Fuzzy reconstruction error analysis steps: Use the current self-learning model to perform fuzzy reconstruction on the data marked as low confidence, obtain the reconstruction output corresponding to the data, and calculate the error value between the original data and the reconstructed data; when the error value is lower than the set second threshold, it is determined that the current self-learning model has the risk of overfitting to abnormal data; Model switching and training termination steps: When the rate of change of information entropy exceeds the first threshold and the corresponding reconstruction error value is lower than the second threshold, stop the training process of the current self-learning model and replace the current model with a backup model or roll back to the previous stable version of the model state.
[0007] When acquiring the electrical energy parameters of the target power line, the electrical energy parameters of multiple sampling points in the target power line are first collected, and the data of each sampling point are processed for time synchronization. Then, according to the fixed duration and overlap ratio of each sliding time window, the sliding step size is set, and the time axis is evenly divided into multiple continuous windows. Finally, amplitude normalization and frequency domain transformation are performed on the data in each window.
[0008] In a preferred embodiment, the dynamic statistical model refers to: For each sliding time window, an equally spaced discrete sequence of electrical parameters is constructed, and the information entropy value is calculated based on the probability distribution of the sequence. The probability distribution is obtained by statistically analyzing the proportion of the frequency of voltage amplitude, current fluctuation and frequency shift, where the information entropy value is the negative sum of all probabilities multiplied by their logarithms. The entropy values of consecutive sliding time windows are subtracted from each other to obtain the entropy difference between adjacent windows. This difference is then divided by the window time interval to obtain the rate of change of entropy. The statistical mean and standard deviation of the rate of change of entropy within a set period are then statistically analyzed to construct a dynamic statistical model.
[0009] In a preferred embodiment, the deviation of the current window's entropy change rate relative to the dynamic statistical model is calculated to obtain the offset, and the ratio of the offset to the historical standard deviation is defined as the local anomaly coefficient. If the current window's entropy change rate not only exceeds the first threshold, but the local anomaly coefficient also exceeds the historical average of the entropy change rate in the dynamic statistical model plus twice the standard deviation, then the window is marked as an enhanced external disturbance high-risk window, and the current window data is set as low-confidence data.
[0010] In a preferred embodiment, for each data point marked as a high-risk window for external disturbance, the difference between the rate of change of information entropy in the current sliding time window and the rate of change of information entropy in the historical average information entropy in the dynamic statistical model is calculated to obtain an offset. Based on this offset, the data is normalized within a preset ratio range to obtain a normalized dynamic adjustment factor. The initial weights of the training samples are multiplied by the dynamic adjustment factor to obtain the dynamic adjustment weight of each training sample. The dynamic adjustment factor decreases monotonically as the deviation increases, so as to assign lower training weights to data with higher abnormality.
[0011] In a preferred embodiment, during model training, the gradient contribution of each training sample is scaled based on the dynamically adjusted weights.
[0012] In a preferred embodiment, the error value is obtained through the following steps: Using the currently trained self-learning model as input, the data samples marked as low confidence are input and fuzzy reconstruction is performed using a denoising process. The denoising process includes setting some time segments of the input samples to zero or randomly perturbing them to simulate data loss and perturbation under abnormal conditions. The model then generates a complete reconstruction output. The complete reconstructed output is compared point by point with the original undisturbed sample. The sum of the squared differences of various electrical parameters at each time point is calculated, and the average of the sums is taken to obtain the reconstruction error value of the sample.
[0013] In a preferred embodiment, multiple backup models are pre-built during the model deployment phase. Each backup model adopts different structural parameters or training strategies to cover various possible scenarios of power data feature changes. After the joint triggering condition of the information entropy change rate exceeding a first threshold and the reconstruction error value being lower than a second threshold is met, the model that is closest to the current data features is selected from the backup model set as the switching target according to the main change pattern of the current power data. During the model switching process, the parameters of the current model are backed up in a snapshot to ensure that the system can fall back to the current model state if the backup model cannot be adapted, thus ensuring the continuity and security of system operation.
[0014] In a preferred embodiment, rolling back to the model state of the previous stable version means: During model training, model parameter versions are saved at fixed time intervals, and training sample quality indicators and model error statistics are recorded for each version. The training sample quality indicators are calculated based on the proportion of samples marked as high confidence in the training data used for that version. The model error statistics are composed of the variance and mean of the loss value recorded in each round of training. When the joint triggering condition is met, the model error statistics of multiple saved model versions are compared in turn, and the model version with the smallest training error variance is selected as the candidate rollback model. If the difference in error variance among multiple model versions is less than the preset error variance judgment threshold, then the training sample quality indicators are further compared, and the model version with the highest proportion of high confidence samples is selected as the final rollback target. The current self-learning model is then replaced with this model version to restore model stability.
[0015] In a preferred embodiment, the energy metering system based on intelligent algorithms includes: The data acquisition module is used to acquire the electrical energy parameters in the target power line and divide the electrical energy parameters into multiple sliding time windows in chronological order; The entropy calculation module is used to calculate the information entropy of the electrical parameters within each sliding time window and to build a dynamic statistical model based on the information entropy changes of multiple historical time windows. It is also used to mark the current time window as a high-risk window for external disturbances and set the data in the window as low-confidence data when the rate of change of information entropy corresponding to the current time window is greater than a set first threshold. The weight adjustment module is used to dynamically reduce the sample weights of low-confidence data participating in model training before they are used to train the self-learning model, so as to suppress the dominant role of such data in updating model parameters. The reconstruction analysis module is used to perform fuzzy reconstruction of low-confidence data using the current self-learning model, obtain the reconstruction output, and calculate the error value between the reconstruction output and the original data; it is also used to determine that the current self-learning model has the risk of overfitting to abnormal data when the error value is lower than a set second threshold. The model control module is used to stop the training process of the current self-learning model and replace the current model with a backup model or roll back to the previous stable version of the model when the rate of change of information entropy exceeds the first threshold and the corresponding reconstruction error value is lower than the second threshold.
[0016] The technical effects and advantages of this invention are as follows: This invention divides the electrical parameters in a target power line into multiple sliding time windows according to time sequence, calculates the information entropy value of the electrical parameters within each window, and further constructs a dynamic statistical model to achieve continuous monitoring and evolution perception of electrical characteristics in the time dimension. By utilizing the calculation of the information entropy change rate and the dynamic judgment mechanism of the dynamic statistical model, it can accurately identify sudden electrical disturbance regions. This invention can dynamically identify local unsteady-state behaviors when dealing with high-frequency changes and complex load interference in industrial scenarios, enhancing the flexibility and accuracy of electrical anomaly identification.
[0017] This invention targets data identified as high-risk windows for external disturbances. Before entering the self-learning model, it reduces the weight of these samples during training, thereby minimizing the impact of anomalous samples on the model's gradient direction and parameter updates. This prevents overall performance drift in the early learning stages due to a small number of strongly interfering samples. This dynamic weighting mechanism adjusts in real-time according to the degree of disturbance, enabling differentiated management of the "credibility" of training samples. It fundamentally suppresses overlearning of noisy data or atypical behavior, effectively improving the model's fidelity to normal electricity consumption characteristics and contributing to the long-term maintenance of the model's convergence stability and generalization ability.
[0018] This invention automatically triggers a training termination process when the rate of change of information entropy exceeds a first threshold and the reconstruction error value is below a second threshold. The current model is then replaced with a backup model or rolled back to a previous stable version, enabling the model to take timely corrective measures when potential overfitting risks are identified. This joint triggering mechanism integrates both feature entropy and model error criteria, improving the robustness of the judgment and ensuring that the model terminates before entering an abnormal learning path, preventing abnormal patterns from becoming ingrained in the model. This design further guarantees the continuous operation and accurate response capability of the electricity metering method in complex environments, demonstrating high practicality and engineering adaptability. Attached Figure Description
[0019] To facilitate understanding by those skilled in the art, the present invention will be further described below with reference to the accompanying drawings; Figure 1 This is a schematic diagram of the power metering method based on intelligent algorithms in this invention.
[0020] Figure 2 This is a schematic diagram of the intelligent algorithm-based electricity metering system in this invention. Detailed Implementation
[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. 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.
[0022] Reference Figure 1 - Figure 2 The following examples were obtained: Example 1: To ensure the data quality of electricity metering, this invention proposes an electricity metering method based on intelligent algorithms, including the following steps: The steps for acquiring power signals and dividing windows are as follows: acquire the power parameters in the target power line, and divide the acquired power parameters into multiple sliding time windows in chronological order; by dividing the continuous power data stream into manageable sliding time windows, it is helpful to capture the dynamic change characteristics of power parameters in the time dimension, providing structured input for subsequent feature extraction and model judgment; the sliding mechanism of the window can maintain the temporal continuity of the data, while avoiding the omission of short-term abrupt change signals, and enhancing the system's sensitivity to power disturbances.
[0023] Information entropy calculation and drift determination steps: Calculate the information entropy corresponding to the electrical parameters within each sliding time window, and construct a dynamic statistical model based on the information entropy changes in historical time windows. When the rate of change of information entropy corresponding to the current time window exceeds a set first threshold, mark this time window as a high-risk window for external disturbances, and set the data in this window as low-confidence data. Information entropy, as an important indicator for measuring data uncertainty, is used here to measure the complexity of electrical signals. When the rate of change of information entropy increases significantly, it indicates that the system may experience abnormal operating conditions such as voltage fluctuations and harmonic interference. Identifying these trends through the dynamic statistical model allows for the timely labeling of potential abnormal data before model training, thereby achieving early perception and classification of data quality.
[0024] The training sample weight adjustment process involves dynamically reducing the weight of data marked as high-risk windows for external perturbations before they are used in training the self-learning model. This suppresses the dominant role of such data in updating model parameters. By dynamically adjusting the weights of training samples, the model is prevented from experiencing parameter shifts when faced with anomalous samples. This mechanism ensures that high-quality samples are prioritized during model training, reduces the risk of overfitting to incorrect patterns due to short-term perturbations, improves overall robustness and generalization ability, and contributes to the stability of model performance over long-term operation.
[0025] The steps for fuzzy reconstruction error analysis are as follows: First, use the current self-learning model to perform fuzzy reconstruction on the data marked as low confidence, obtain the reconstruction output corresponding to that data, and calculate the error value between the original data and the reconstructed data. If this error value is lower than a set second threshold, it is determined that the current self-learning model is at risk of overfitting to anomalous data. Second, test whether the model has become "accustomed" to anomalous data through fuzzy reconstruction. If the model can still accurately reconstruct the original signal even with perturbed input data, it indicates that it has developed a tendency to overfit to anomalous behavior. The calculation of reconstruction error can serve as an adaptive feedback mechanism, helping the system detect early signs that the model has deviated from the normal learning path, thereby determining whether training needs to be terminated or the strategy adjusted.
[0026] Model switching and training termination steps: When the rate of change of information entropy exceeds the first threshold and the corresponding reconstruction error value is lower than the second threshold, the training process of the current self-learning model is stopped, and the current model is replaced with a backup model or rolled back to the previous stable version of the model. This step achieves training termination and model replacement through a dual-condition triggering mechanism, which can effectively prevent the model from continuing to learn biasedly on abnormal samples. When the model is judged to have an overfitting risk, it is immediately switched to the previously stable model or the backup model, which can avoid the system being in a state of misjudgment for a long time, while improving fault recovery efficiency and overall system reliability.
[0027] The process of acquiring electrical energy parameters and constructing a sliding time window includes the following steps: Synchronous acquisition of electrical energy parameters from multiple sampling points deployed along the target power line. These parameters include voltage amplitude, current amplitude, active power, reactive power, frequency, power factor, and harmonic content. The sampling frequency is set to 1,000 samples per second to ensure the capture of high-frequency disturbances and fine-grained electrical energy variation characteristics. Due to slight clock skew or network transmission delays between different sampling points, a global time synchronization protocol is used during the acquisition process to align all sampling point data with a unified time reference, ensuring the elimination of time offsets at the microsecond level and guaranteeing the consistency and comparability of the data in the time series dimension.
[0028] After aligning the power parameters in time sequence, the sliding step size is set based on the fixed duration and overlap ratio of the sliding time window, and the aligned power parameters are divided into consecutive sliding windows in chronological order. For example, if the duration of each sliding time window is set to two seconds and the overlap ratio to be 50%, then the sliding step size is one second, thus generating nine effective time windows in any consecutive ten-second raw data sequence. Each time window contains a sequence of sampling points for multiple synchronous power parameters, which are used for subsequent statistics and feature extraction.
[0029] Within each completed sliding time window, normalization is performed on various electrical energy parameter data. Specifically, for parameters such as voltage, current, active power, and frequency, the original values are normalized using the ratio between their minimum and maximum values, with a normalization range of zero to one. For parameters with periodic or offset characteristics, such as power factor and harmonic content, mean difference normalization is used to maintain sensitivity to abnormal fluctuations. The purpose of normalization is to eliminate differences in the dimensions of different parameters, ensuring a unified measurement standard in subsequent statistical modeling and avoiding the propagation of biases caused by amplitude differences.
[0030] After normalization, frequency domain transformation is further performed on the data sequence within each sliding time window. The Fast Fourier Transform (FFT) method is used to convert the electrical parameters from the time domain to the frequency domain, extracting their spectral structure features. Particularly in harmonic analysis and transient fluctuation identification, these frequency domain features can effectively reveal the causes and patterns of electrical disturbances. By extracting indicators such as frequency amplitude distribution, dominant frequency location, and spectral energy density, the ability to identify non-stationary signals is enhanced, and more discriminative input features are provided for subsequent entropy calculation and disturbance determination. In practical applications, for energy concentration areas with frequency components more than twice that of the fundamental frequency, multi-scale decomposition methods such as wavelet transform can be used for feature refinement, thereby improving the system's ability to model complex electrical disturbance scenarios. Through these steps, this implementation method realizes a complete process from the acquisition of original electrical parameters, time alignment, window division, amplitude normalization to frequency domain feature transformation, providing a high-quality, structured, and standardized input data foundation for subsequent entropy calculation, anomaly identification, and model training.
[0031] The construction process of the dynamic statistical model includes the following steps: Constructing equally spaced discrete sequences of electrical parameter data within each sliding time window. Electrical parameters include multiple dimensions such as voltage amplitude, current amplitude, frequency, active power, reactive power, and harmonic content. In practical applications, each electrical parameter sampling point within the time window is re-divided according to a preset sampling period, forming a time sequence composed of a set of equally spaced data points. Taking voltage amplitude as an example, if the sliding window duration is two seconds and the sampling frequency is one thousand times per second, then the window contains two thousand sampling values. A first-level equally spaced subsequence is constructed with every hundred points, resulting in twenty segments. This method enables unified structured processing of the original electrical signal in the time dimension. Based on the above discrete sequences, frequency statistics are performed on three types of electrical parameters: voltage amplitude, current fluctuation, and frequency offset, and their probability distributions are calculated. Alternatively, it could be other types of electrical energy parameters after correlation analysis. In fact, the categories of the first three to five electrical energy parameters are determined based on correlation. The specific method is as follows: Within each sliding window, the voltage value is divided into several amplitude intervals, for example, dividing the 220V to 250V range into six intervals. The number of sampled values falling into each interval is counted, and this number is divided by the total number of sampling points to obtain the voltage probability distribution. Current fluctuations and frequency shifts are also divided into intervals and probabilities are calculated in the same way. This probability distribution reflects the state distribution pattern of each electrical energy parameter within the window and is the basis for subsequent information entropy calculations.
[0032] Based on the obtained probability distribution, the information entropy value corresponding to each sliding time window is calculated. The information entropy is calculated by multiplying the probability value of each interval by its logarithm, negating all products, and then summing the results to obtain the entropy value for that window. For example, in a certain window, the probabilities of the voltage falling into six intervals are 0.15, 0.2, 0.3, 0.2, 0.1, and 0.05, respectively. The corresponding entropy value is calculated as the negative sum of the products of these probabilities and their logarithms. A higher information entropy value indicates more complex and unstable electrical parameters, and vice versa.
[0033] The information entropy values corresponding to each sliding time window are subtracted pairwise to calculate the information entropy difference between adjacent windows. This difference is then divided by the window time interval to obtain the information entropy change rate. An observation period is set, for example, every ten sliding time windows. The statistical mean and standard deviation of all entropy change rates within this period are calculated as the dynamic statistical baseline for the current period. This dynamic statistical baseline constitutes the core parameter of the dynamic statistical model, used to subsequently determine whether the entropy change in the current window deviates from the normal level. For example, if the mean entropy change rate of the ten windows is 0.02 and the standard deviation is 0.05, then if the entropy change rate of the current window reaches 0.1, its deviation can be clearly determined by the standard deviation ratio to determine whether it constitutes an external disturbance risk. Through the above steps, this implementation method realizes the entire process of power parameters within a sliding time window, from probabilistic modeling to information entropy quantification and then to dynamic fluctuation trend analysis. This effectively improves the ability to identify fine-grained anomalies such as micro-disturbances and latent disturbances in the power grid, providing accurate and reliable reference for subsequent low-confidence sample screening and model training process control.
[0034] To further enhance the ability to identify potential power disturbances, a refined analysis of the information entropy change rate of the current sliding time window is performed, and a local anomaly coefficient is introduced to identify high-risk windows for enhanced external disturbances. This process includes the following steps: Based on the information entropy change rate of the current sliding time window obtained from the previously published dynamic statistical model, it is compared with the statistical mean over historical periods to calculate the degree of deviation. This deviation is defined as the information entropy change rate of the current window minus the mean of the historical entropy change rates. For example, if the mean of the information entropy change rate over historical statistical periods is 0.02, and the current window's entropy change rate is 0.08, then the deviation is 0.06. This deviation quantifies the fluctuation amplitude of the current window relative to the historical trend and is initially used to determine whether it constitutes significant abnormal behavior.
[0035] To eliminate the interference of misjudgments and irregular fluctuations, the offset is further divided by the standard deviation of the historical entropy change rate in the dynamic statistical model to obtain the standardized degree of deviation, i.e., the local anomaly coefficient. This coefficient is used to measure the degree to which the current window fluctuation exceeds the normal range of variation. Continuing with the above data as an example, if the historical standard deviation is 0.02, then the local anomaly coefficient is the offset of 0.06 divided by 0.02, resulting in a coefficient value of 3. This coefficient reflects that the change in the current window is three times the historical fluctuation range, which is a relatively strong anomaly signal.
[0036] After obtaining the local anomaly coefficient, it is jointly judged with the trigger threshold in the dynamic statistical model. Specifically, if the rate of change of the current window's information entropy not only exceeds a preset first threshold (e.g., 0.05), but the corresponding local anomaly coefficient also exceeds the numerical boundary of the historical information entropy change rate average plus twice the standard deviation, then the current window is determined to have significant perturbation behavior and characteristics exceeding normal perturbation. For example, if the historical average is 0.02 and the standard deviation is 0.02, then the judgment threshold is 0.02 plus 0.04, i.e., 0.06. If the local anomaly coefficient is greater than 0.06, then the judgment condition is met.
[0037] After meeting the joint judgment criteria, the current sliding time window is marked as an enhanced external disturbance high-risk window, and the electrical parameter data within this window is marked as low-confidence data, limiting its influence on subsequent model training. Compared to ordinary external disturbance windows, enhanced high-risk windows represent more drastic and unconventional electrical energy changes in the system within a specific time period, possibly related to abnormal equipment startup, harmonic source mutations, or environmental voltage fluctuations. These changes are more disruptive to model training, thus requiring stricter data intervention strategies. Through these four steps, this implementation method achieves the entire process from offset extraction and standardized evaluation to joint judgment and classification labeling, establishing a more accurate electrical disturbance identification mechanism. This helps avoid interference from strong anomalous samples during model training, improving the overall stability and security of the model.
[0038] In one specific embodiment of the present invention, to ensure that the self-learning model is not disturbed by severely perturbed data during training, a dynamic weight adjustment method based on entropy change rate offset is proposed for differential processing of training data marked as high-risk windows for external perturbation. The method includes the following steps: for each piece of data marked as a high-risk window for external perturbation, the difference between the information entropy change rate of the current sliding time window and the mean of the historical entropy change rate in the dynamic statistical model is calculated to obtain an offset representing the degree of anomaly. For example, if the historical average entropy change rate in the dynamic statistical model is 0.03, and the entropy change rate of the current window is 0.07, then the offset is 0.04. This offset is a fundamental parameter for judging the intensity of the sample's deviation from normal behavior and is used to guide the subsequent dynamic allocation of weights.
[0039] The obtained offset is mapped to a preset normalization interval and proportionally processed to obtain the normalized dynamic adjustment factor. Specifically, the maximum tolerable offset is set to 0.1, and the minimum offset is zero. In this case, the normalized value of the offset of 0.04 within this interval is 0.6. To achieve the goal of assigning lower weights to data with stronger disturbances, an inverse linear mapping function can be used during the normalization process. That is, the normalization factor equals one minus the normalized offset value, thus obtaining an adjustment factor that decreases with the degree of offset. Continuing the previous example, if the normalized offset value is 0.6, then the dynamic adjustment factor is 0.4.
[0040] The dynamically adjusted weight of a sample is obtained by multiplying the aforementioned dynamic adjustment factor with the original initial weights of the training sample. If the model defaults to an initial weight of one in a perturbation-free scenario, the final weight of the labeled sample will be 0.4. This weight will be used in the gradient update calculation in the loss function, significantly reducing the impact of outlier samples on model parameter updates, thereby protecting the model from being dominated by extreme perturbation samples in the learning process.
[0041] Throughout the training process, the above calculation procedure is performed on all data samples from windows marked as high-risk for external perturbations, dynamically generating their respective training weights. This mechanism can adaptively identify differences in perturbation levels and make fine adjustments to their contribution values. Compared with traditional static weight setting methods, this implementation realizes a functional mapping relationship between the degree of anomaly and the training weights, significantly improving robustness and error tolerance to anomalous data while maintaining the model's adaptive capabilities. For example, in a complete training cycle, if the offsets of a set of samples are 0.01, 0.05, and 0.09, their final weights may be 0.9, 0.5, and 0.1, respectively, exhibiting a clear hierarchical decay effect and effectively limiting the influence range of highly perturbed samples.
[0042] During model training, the gradient contribution of each training sample is scaled according to the dynamically adjusted weights. This includes the following steps: In each round of model training, training samples containing normal samples and data marked as high-risk windows of external disturbances are extracted from the training set in batches, and the dynamically adjusted weights calculated in the previous stage are read one by one with the samples; the dynamically adjusted weights of each sample are used as the participation coefficient of that sample in this round of training.
[0043] During the forward propagation phase, the model generates a predicted output for the input samples and records the loss function value between the predicted and actual values. Before the loss function is backpropagated, the loss term of each sample is multiplied by its corresponding dynamically adjusted weight to obtain a weighted individual loss result, which serves as the sample's actual contribution to the total loss function. In the backpropagation phase, the gradient of the model parameters is calculated based on the weighted loss function. Because highly perturbed samples are assigned lower dynamically adjusted weights, their loss term's proportion in the total gradient decreases. Therefore, in the gradient propagation chain, the parameter update magnitude caused by such samples is significantly reduced, thus preventing the model from shifting towards abnormal features. This weight control and gradient scaling mechanism is continuously executed throughout the training cycle, enabling the training process to dynamically perceive the intensity of perturbations and adjust sample contributions in real time. For example, in a typical training round, if the dynamically adjusted weight of a normal sample in a batch is one, while the weight of a high-risk external perturbation sample is 0.25, then the gradient contribution of that sample accounts for only one-quarter of its original weight in the entire training round, effectively suppressing the risk of it misleading the model's learning. By establishing a gradient scaling mechanism that is linked to dynamic weight adjustment, the impact of sample quality is not only controlled on the data input side, but also directly affects parameter updates in the training optimization path, effectively improving the model's stable training capability under abnormal power conditions.
[0044] To assess whether the current self-learning model overfits to power disturbance data, this invention proposes a discrimination method based on fuzzy reconstruction error. This method quantifies the model's ability to reconstruct abnormal patterns by performing structural perturbations, reconstruction predictions, and error calculations on low-confidence data, thereby identifying whether the model has developed an overly strong memory of abnormal behavior. Specifically, it includes the following four steps: selecting data samples already marked as low-confidence, inputting them into the self-learning model trained in the current stage, and denoising the input samples. The denoising process simulates potential data loss, timing interruptions, or signal disturbances that may occur in the power grid. Specifically, several time segments in the original data samples are zeroed out or randomly perturbed. For example, in a two-second voltage data sequence sampled 1000 times per second, two intervals of 100 points each are randomly selected and zeroed out or have normally distributed noise added to simulate data loss caused by external equipment malfunctions, sensor fluctuations, or transmission interference.
[0045] The current self-learning model is used to predict and reconstruct the input samples after the aforementioned perturbation, generating complete output data. Based on its learned internal representations and historical features, the model attempts to "complete" or "restore" the data trend even when the temporal structure is disrupted. If the model has developed an explicit learning ability for this type of anomalous data, it can still generate an output highly close to the original data when faced with incomplete input. This reconstructed output serves as the basis for subsequent error calculations.
[0046] A point-by-point error calculation method is used to compare the model output with the original unperturbed samples to measure the reconstruction quality. Specifically, the method involves taking the voltage, current, frequency, and other electrical parameters at each time point in the reconstructed sequence and the original sequence, calculating the squared difference of each parameter at each time point, and summing all the squared differences before dividing by the total number of points to obtain the average reconstruction error value for that sample. For example, in a sample containing three types of parameters and one thousand time points, if the average sum of squared errors of the parameters at each point after reconstruction is 0.3, then the reconstruction error value of that sample is 0.3.
[0047] The reconstruction error value is compared with a preset second threshold. If it is less than the threshold, the current self-learning model is considered to still be able to highly reconstruct abnormal data under disturbance conditions, indicating that the model has a significant tendency to overfit abnormal patterns. This triggers a subsequent model training termination or rollback mechanism to prevent the model from further reinforcing the learning path for atypical data. Conversely, if the error value is high, it indicates that the model exhibits some resistance to abnormal input and can continue to maintain the current learning strategy. Through these steps, not only is a mechanism for diagnosing model learning behavior provided, but also, by introducing data perturbation and reconstruction error analysis, a feedback loop of anomaly perception and self-regulation is constructed, significantly enhancing the model's stability and generalization ability under power disturbance environments. This mechanism is particularly suitable for industrial scenarios with highly complex power parameters and frequent data disturbances, helping to prevent the model from falling into the learning trap of "false memory" in the early training stages.
[0048] To address the potential for drastic fluctuations, structural abrupt changes, or nonlinear disturbances in power data characteristics during real-world scenarios, multiple backup models are pre-built. During model operation, the most suitable model is automatically selected for replacement based on changes in data characteristics, thereby enhancing the model's adaptability to complex operating conditions. This method is triggered by a joint determination of the information entropy change rate and the reconstruction error value, and includes the following steps: In the model deployment phase, multiple backup models with different structural parameters or training strategies are constructed based on historically collected multi-type power characteristic data from the training sample library. Differences in structural parameters include different numbers of neural network layers, activation function combinations, or attention mechanism designs; differences in training strategies include learning rate scheduling methods, training sample selection strategies, or loss function types. Each backup model is optimized for a specific type of power data change; for example, one model is better suited for handling periodically fluctuating data, while another is better at handling high-frequency abrupt changes. Through this diversified pre-training strategy, a complementary set of model backups can be constructed in both feature and response dimensions.
[0049] During system operation, when the joint judgment condition of the information entropy change rate exceeding the first threshold and the corresponding reconstruction error value being lower than the second threshold is met, the model switching process is initiated, and the main change patterns of the power data within the current window are extracted. The main change patterns refer to the statistical trend of power parameters exhibited over the most recent sliding time windows, including continuous voltage shifts, increased periodicity of frequency fluctuations, frequent spikes in current peaks, sudden drops in power factor, or surges in harmonic energy. By statistically analyzing the mean drift, variance increase rate, and spectral concentration of each parameter, a structured feature vector of the current power data change is comprehensively constructed, serving as the basis for model adaptation judgment.
[0050] Based on the extracted power change feature vectors, similarity matching is performed with the feature response labels pre-generated during the training phase of all standby models. Weighted cosine similarity or Mahalanobis distance is used to calculate the degree of matching between the current power change vector and the corresponding adaptation range of each standby model, and the closest model is selected as the switching target. For example, if the variance of the current voltage parameter increases by 80% within ten minutes, and the main energy segment of the harmonic spectrum shifts from 300 Hz to 500 Hz, it may indicate that the power grid is undergoing rapid industrial load switching. In this case, selecting a standby model trained well under high-frequency disturbances can improve model stability.
[0051] Before model switching, a snapshot of the parameters of the currently running self-learning model is automatically saved, recording information including the weight matrix, optimizer status, and training epochs. This ensures that if adaptation failure or prediction performance degradation occurs after the backup model is deployed, the system can immediately roll back to the previous model state. This mechanism guarantees the reversibility and safety of model switching operations, effectively preventing abnormal system fluctuations caused by model selection misjudgment during model replacement. For example, in a replacement operation, if the prediction error exceeds the set tolerance threshold for three consecutive windows after the backup model goes online, the snapshot mechanism is immediately activated to restore the original model state, preventing the continued spread of the impact of misjudged models. By establishing a multi-model deployment and switching mechanism that adapts to power change patterns, rapid response and intelligent error correction can be achieved when facing sudden power disturbances, data structure mutations, or model mismatch risks, significantly improving the overall flexibility, safety, and robustness of model operation. This mechanism is particularly suitable for power consumption scenarios with complex grid structures, frequent industrial load switching, and diverse disturbance types.
[0052] To ensure the stability recovery capability of the self-learning model under abnormal perturbation conditions, this invention adopts a model switching strategy based on a historical version rollback mechanism. This strategy involves periodically saving the model state during training and recording the training sample quality indicators and error statistics related to each model version. This allows for the informed selection of the optimal model version for rollback when joint triggering conditions occur. Specifically, the strategy includes the following steps: During model training, the parameter state of the current self-learning model is saved at preset time intervals, forming a traceable model version record sequence. Each save records information such as the parameter weights, optimizer state, and loss function convergence state of the current training epoch, and simultaneously calculates the number and percentage of samples marked as high-confidence in the current training data as training sample quality indicators. For example, in a 20-minute continuous training process, saving the model state every five minutes creates four historical model versions. The percentages of high-confidence samples for each version in the corresponding training phase are recorded, for example, 85%, 83%, 75%, and 67%.
[0053] After the joint triggering conditions of the information entropy change rate exceeding the first threshold and the reconstruction error being lower than the second threshold are met, the model rollback determination process is triggered, and the analysis of multiple saved historical model versions begins. For each model version, the mean and variance of its training error are extracted, and the error statistics are the statistical summary of the loss value of each round in the corresponding training interval for that version. For example, if the average loss function is 0.3 and the variance is 0.015 in ten rounds of training for a certain version, then this is recorded as the error feature of the current candidate model.
[0054] The error variances of multiple model versions are compared, and the model version with the smallest error variance is selected as the rollback candidate. Error variance reflects the fluctuation of the model's loss value during training; the smaller the value, the more stable the training process and the lower the risk of overfitting or underfitting. If the difference in error variance between multiple model versions is less than a preset error variance judgment threshold, such as 5%, the next stage of comparing training sample quality indicators is initiated. At this point, the focus shifts to the proportion of high-confidence samples in each version to determine which model achieved more stable results using high-quality training data. For example, when the error variances of two model versions are 0.015 and 0.016 respectively, the difference is only 6.7%, which is less than the threshold; if the corresponding proportions of high-confidence samples are 83% and 78% respectively, the higher one is selected as the final rollback model version.
[0055] The current self-learning model state is replaced with the selected historical stable version, and the corresponding parameter weights and training state information are reloaded, allowing the model to continue operating based on a more reliable and stable historical training foundation. To ensure that the switching process does not interrupt the training flow, the entropy and error judgment process can be re-executed on the data in the current sliding time window after the switch to confirm whether it is still in a high-risk state. If the joint triggering conditions are still met, training is paused and manual intervention or an alarm mechanism is triggered; if the error returns to normal after the switch, subsequent training tasks continue.
[0056] Example 2: An energy metering system based on intelligent algorithms, comprising: The data acquisition module is used to acquire the electrical energy parameters in the target power line and divide the electrical energy parameters into multiple sliding time windows in chronological order; The entropy calculation module is used to calculate the information entropy of the electrical parameters within each sliding time window and to build a dynamic statistical model based on the information entropy changes of multiple historical time windows. It is also used to mark the current time window as a high-risk window for external disturbances and set the data in the window as low-confidence data when the rate of change of information entropy corresponding to the current time window is greater than a set first threshold. The weight adjustment module is used to dynamically reduce the sample weights of low-confidence data participating in model training before they are used to train the self-learning model, so as to suppress the dominant role of such data in updating model parameters. The reconstruction analysis module is used to perform fuzzy reconstruction of low-confidence data using the current self-learning model, obtain the reconstruction output, and calculate the error value between the reconstruction output and the original data; it is also used to determine that the current self-learning model has the risk of overfitting to abnormal data when the error value is lower than a set second threshold. The model control module is used to stop the training process of the current self-learning model and replace the current model with a backup model or roll back to the previous stable version of the model when the rate of change of information entropy exceeds the first threshold and the corresponding reconstruction error value is lower than the second threshold.
[0057] The above formulas are all dimensionless calculations. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.
[0058] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0059] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0060] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0061] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An energy metering method based on intelligent algorithms, characterized in that, Includes the following steps: Obtain the electrical energy parameters in the target power line and divide the obtained electrical energy parameters into multiple sliding time windows in chronological order; The information entropy corresponding to the electrical energy parameters in each sliding time window is calculated, and a dynamic statistical model is constructed based on the information entropy changes in historical time windows. When the rate of change of information entropy corresponding to the current time window is greater than the set first threshold, the time window is marked as a high-risk window for external disturbance, and the data in the window is set as low-confidence data. For data marked as high-risk windows of external disturbances, the sample weights of these data participating in model training are dynamically reduced before they are used for training the self-learning model, in order to suppress the dominant role of this type of data in updating model parameters. The current self-learning model is used to perform fuzzy reconstruction on the data marked as low confidence, obtain the reconstruction output corresponding to the data, and calculate the error value between the original data and the reconstructed data; when the error value is lower than the set second threshold, it is determined that the current self-learning model has the risk of overfitting to the abnormal data. When the rate of change of information entropy exceeds the first threshold and the corresponding reconstruction error value is lower than the second threshold, the training process of the current self-learning model is stopped, and the current model is replaced with a backup model or rolled back to the previous stable version of the model. Dynamic statistical models refer to: For each sliding time window, an equally spaced discrete sequence of electrical parameters is constructed, and the information entropy value is calculated based on the probability distribution of the sequence. The probability distribution is obtained by statistically analyzing the proportion of the frequency of voltage amplitude, current fluctuation and frequency shift, where the information entropy value is the negative sum of all probabilities multiplied by their logarithms. The entropy values of consecutive sliding time windows are subtracted from each other to obtain the entropy difference between adjacent windows. This difference is then divided by the window time interval to obtain the rate of change of entropy. The statistical mean and standard deviation of the rate of change of entropy within a set period are then statistically analyzed to construct a dynamic statistical model.
2. The energy metering method based on intelligent algorithms according to claim 1, characterized in that, When acquiring the electrical energy parameters of the target power line, the electrical energy parameters of multiple sampling points in the target power line are first collected, and the data of each sampling point are processed for time synchronization. Then, according to the fixed duration and overlap ratio of each sliding time window, the sliding step size is set, and the time axis is evenly divided into multiple continuous windows. Finally, amplitude normalization and frequency domain transformation are performed on the data in each window.
3. The energy metering method based on intelligent algorithms according to claim 1, characterized in that, The offset is calculated by measuring the deviation of the current window's entropy change rate relative to the dynamic statistical model. The ratio of this offset to the historical standard deviation is defined as the local anomaly coefficient. If the current window's entropy change rate not only exceeds the first threshold, but also the local anomaly coefficient exceeds the historical average of the entropy change rate in the dynamic statistical model plus twice the standard deviation, then the window is marked as a high-risk window for enhanced external disturbances, and the current window data is set as low-confidence data.
4. The energy metering method based on intelligent algorithms according to claim 3, characterized in that, For each data point marked as a high-risk window for external disturbance, the difference between the rate of change of information entropy in the current sliding time window and the rate of change of information entropy in the historical average information entropy in the dynamic statistical model is calculated to obtain the offset. Based on this offset, the data is normalized within a preset ratio range to obtain the normalized dynamic adjustment factor. The initial weights of the training samples are multiplied by the dynamic adjustment factor to obtain the dynamic adjustment weights of each training sample.
5. The energy metering method based on intelligent algorithms according to claim 4, characterized in that, During model training, the gradient contribution of each training sample is scaled by dynamically adjusting the weights.
6. The energy metering method based on intelligent algorithms according to claim 5, characterized in that, The error value is obtained through the following steps: Using the currently trained self-learning model as input, the data samples marked as low confidence are input and fuzzy reconstruction is performed using a denoising process. The denoising process includes setting some time segments of the input samples to zero or randomly perturbing them to simulate data loss and perturbation under abnormal conditions. The model then generates a complete reconstruction output. The complete reconstructed output is compared point by point with the original undisturbed sample. The sum of the squared differences of various electrical parameters at each time point is calculated, and the average of the sums is taken to obtain the reconstruction error value of the sample.
7. The energy metering method based on intelligent algorithms according to claim 6, characterized in that, Multiple backup models are pre-built during the model deployment phase. Each backup model adopts different structural parameters or training strategies. After the joint triggering conditions of the information entropy change rate exceeding the first threshold and the reconstruction error value being lower than the second threshold are met, the model that is closest to the current data characteristics is selected from the backup model set as the switching target based on the main change pattern of the current power data. In addition, the parameter snapshot backup of the current model is maintained during the model switching process.
8. The energy metering method based on intelligent algorithms according to claim 7, characterized in that, Rolling back to the previous stable version of the model means: During model training, model parameter versions are saved at fixed time intervals, and training sample quality indicators and model error statistics are recorded for each version. The training sample quality indicators are calculated based on the proportion of samples marked as high confidence in the training data used for that version. The model error statistics are composed of the variance and mean of the loss value recorded in each round of training. When the joint triggering condition is met, the model error statistics of multiple saved model versions are compared in turn, and the model version with the smallest training error variance is selected as the candidate rollback model. If the difference in error variance among multiple model versions is less than the preset error variance judgment threshold, then the training sample quality indicators are further compared, and the model version with the highest proportion of high confidence samples is selected as the final rollback target. The current self-learning model is then replaced with this model version to restore model stability.
9. An energy metering system based on intelligent algorithms, used to implement the energy metering method based on intelligent algorithms as described in any one of claims 1-8, characterized in that, include: The data acquisition module is used to acquire the electrical energy parameters in the target power line and divide the electrical energy parameters into multiple sliding time windows in chronological order; The entropy calculation module is used to calculate the information entropy of the electrical parameters within each sliding time window and to build a dynamic statistical model based on the information entropy changes of multiple historical time windows. It is also used to mark the current time window as a high-risk window for external disturbances and set the data in the window as low-confidence data when the rate of change of information entropy corresponding to the current time window is greater than a set first threshold. The weight adjustment module is used to dynamically reduce the sample weights of low-confidence data participating in model training before they are used to train the self-learning model, so as to suppress the dominant role of such data in updating model parameters. The reconstruction analysis module is used to perform fuzzy reconstruction of low-confidence data using the current self-learning model, obtain the reconstruction output, and calculate the error value between the reconstruction output and the original data; it is also used to determine that the current self-learning model has the risk of overfitting to abnormal data when the error value is lower than a set second threshold. The model control module is used to stop the training process of the current self-learning model and replace the current model with a backup model or roll back to the previous stable version of the model when the rate of change of information entropy exceeds the first threshold and the corresponding reconstruction error value is lower than the second threshold.
Citation Information
Patent Citations
Power grid abnormal flow detection method based on multi-modal data fusion
CN120354230A