Intelligent discrimination method and system for data correctness of autonomous controllable electric energy meter based on ILSTM-AE

CN122506476APending Publication Date: 2026-08-04YANTAI DONGFANG WISDOM ELECTRIC
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
YANTAI DONGFANG WISDOM ELECTRIC
Filing Date
2026-06-23
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

[0007]本发明提出了一种基于ILSTM-AE的自主可控电能表数据正确性智能判别方法及系统,其目的是:第一,解决传统CRC、ECC、HASH等校验方法只能检测比特级错误,无法识别因传感器漂移、器件老化及电磁干扰等因素导致的逻辑异常数据的问题;第二,解决现有神经网络异常检测模型结构复杂、计算资源消耗大,难以部署于国产MCU/DSP嵌入式平台,且缺乏物理约束融合、可解释性不足的问题;第三,解决传统单一Flash存储架构下校验信息与原始数据混合存储,异常工况下容易同时损毁,导致系统难以有效恢复的问题

Benefits of technology

[0054]1. Time-series data of RMS voltage, RMS current, and active power are encoded and reconstructed using the ILSTM-AE model. The reconstruction error measures the deviation of the current data from the learned normal pattern, thereby detecting numerical logic anomalies that cannot be covered by traditional CRC or ECC checks. Building upon this, an error calculation based on physical constraints is introduced. The physical constraint error and reconstruction error are weighted and fused to generate a confidence score, which is then compared with an anomaly detection threshold. With this fusion strategy, even if the time-series reconstruction error of anomalous data is insignificant, it will still be classified as an anomaly if it violates basic electrical laws. This reduces the risk of missed detection when relying solely on reconstruction error and provides a physically interpretable basis for the detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122506476A_ABST
    Figure CN122506476A_ABST
Patent Text Reader

Abstract

The application discloses an intelligent discrimination method and system for data correctness of an autonomous controllable electric energy meter based on an ILSTM-AE, and relates to the technical field of intelligent electric energy meter data processing and safety and reliability. The method obtains a voltage effective value, a current effective value and an active power, constructs an input data matrix, reconstructs through an ILSTM-AE model of a single LSTM encoder and decoder structure, calculates a reconstruction error and a physical constraint error, and obtains a comprehensive error through weighted fusion, generates a discrimination result after determining a confidence degree and combining a cyclic redundancy check result, and stores external parameters and LSTM weights in an EEPROM. The system comprises an EEPROM, a flash memory and an ILSTM-AE discrimination module and the like. The application can detect logical abnormalities that cannot be identified by traditional checking methods, and is suitable for a resource-limited domestic embedded platform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of smart energy meter data processing and security and reliability technology, specifically to an intelligent method and system for judging the correctness of autonomous and controllable energy meter data based on ILSTM-AE. Background Technology

[0002] With the rapid development of smart grids and power systems, smart meters, as core devices for electricity metering and data acquisition, are widely used in scenarios such as power system operation monitoring, automated electricity management, and remote data transmission. During the long-term operation of smart meters, it is necessary to continuously collect, store, and remotely transmit data such as voltage, current, active power, cumulative electricity consumption, and event records to ensure data integrity and traceability.

[0003] In practical engineering, to ensure the reliability of data storage and transmission, methods such as Cyclic Redundancy Check (CRC), Error Correcting Code (ECC), or hash check are commonly used to verify the integrity of data streams. These methods primarily target hard errors such as bit flips and loss occurring in memory and communication channels, effectively detecting random bit errors caused by hardware failures or transmission interference. However, these verification methods can only determine whether data has been damaged at the storage or transmission level at the "bit level," and cannot identify data that is "logically correct but actually abnormal" due to factors such as sensor drift, analog front-end noise, device aging, and complex electromagnetic environments. Specifically, under the influence of temperature and humidity changes and long-term operation of devices, key components inside the energy meter (such as voltage sampling circuits, current sampling circuits, and ADC modules) are prone to parameter drift, causing the output value to deviate from the true physical quantity. However, this output value is still reasonable in terms of numerical range and format, and traditional CRC or ECC checks cannot detect it, which may lead to the accumulation of metering deviations and affect the accuracy and safety of system operation.

[0004] On the other hand, with the development of artificial intelligence technology, existing research has attempted to apply neural network models to anomaly detection in electricity meter data. For example, a time-series reconstruction method based on Long Short-Term Memory Autoencoder (LSTM-AE) is used to compress and reconstruct time-series data such as voltage, current, and power, using the reconstruction error as the basis for anomaly detection. However, traditional LSTM-AE typically employs a bidirectional or multi-layer stacked LSTM encoder-decoder structure, resulting in a large number of model parameters, high computational complexity, and stringent requirements for computing and storage resources, making it difficult to deploy directly on embedded electricity meter platforms using domestically produced MCUs or DSP chips. Furthermore, such methods often lack the integration of physical constraints on electrical power, resulting in poor interpretability of the model's judgment results and failing to form effective synergy with the existing verification system of electricity meters.

[0005] Furthermore, regarding the data storage and protection mechanisms of electricity meters, existing solutions typically use a single Flash memory to store sampling data and historical records, with verification information (such as CRC codes) often stored on the same medium as the original data. Under conditions such as power outages, electromagnetic interference, or storage unit malfunctions, there is a risk that the verification information and the original data may be simultaneously damaged. This makes it difficult for the system to effectively verify data integrity and reconstruct the operating parameters for anomaly detection after recovery, thus affecting the system's reliable recovery capability under abnormal operating conditions.

[0006] In summary, existing technologies lack a solution for verifying the correctness of electricity meter data that can run in real time on resource-constrained embedded platforms such as domestically produced MCUs / DSPs, balance bit-level verification and logic-level anomaly detection, incorporate physical constraints to enhance interpretability, and ensure data security and system recovery capabilities through separate storage. Summary of the Invention

[0007] This invention proposes an intelligent method and system for determining the correctness of data from an autonomous and controllable energy meter based on ILSTM-AE. Its objectives are: First, to address the problem that traditional verification methods such as CRC, ECC, and HASH can only detect bit-level errors and cannot identify logically abnormal data caused by factors such as sensor drift, device aging, and electromagnetic interference. Second, to solve the problems of existing neural network anomaly detection models being complex in structure, consuming large computational resources, difficult to deploy on domestic MCU / DSP embedded platforms, lacking physical constraint integration, and having insufficient interpretability. Third, to solve the problem that in traditional single Flash storage architectures, verification information and original data are stored together, which can easily be damaged simultaneously under abnormal operating conditions, making it difficult for the system to recover effectively.

[0008] The technical solution of this invention is as follows:

[0009] A method for intelligently judging the correctness of autonomous and controllable energy meter data based on ILSTM-AE includes: acquiring the effective voltage value, effective current value, and active power of the energy meter, as well as the cyclic redundancy check results corresponding to the effective voltage value, the effective current value, and the active power; and further includes:

[0010] An input data matrix is ​​constructed based on the effective values ​​of voltage, current, and active power within a preset time window;

[0011] The input data matrix is ​​input into the improved Long Short-Term Memory Autoencoder (ILSTM-AE) model. The input data matrix is ​​compressed using a temporal feature compression method via an LSTM encoder to obtain a bottleneck layer representation. The LSTM decoder then decodes and reconstructs the data matrix based on the bottleneck layer representation to obtain the reconstructed data matrix. The ILSTM-AE model adopts a simplified structure with a single LSTM encoder and a single LSTM decoder.

[0012] The reconstruction error is calculated based on the difference between the input data matrix and the reconstructed data matrix;

[0013] The physical constraint error is calculated based on the physical power constraint relationship that should be satisfied between the effective voltage value, the effective current value, and the active power.

[0014] The reconstruction error and the physical constraint error are weighted and fused to obtain the comprehensive error;

[0015] The confidence level of the current data is determined based on the comprehensive error.

[0016] The confidence level is compared with a preset anomaly detection threshold, and combined with the cyclic redundancy check result, a data correctness determination result is generated;

[0017] The fusion weight coefficient used in the weighted fusion, the confidence decay coefficient used to determine the confidence level, and the anomaly detection threshold constitute a set of external parameters. The external parameters and the LSTM weights inside the ILSTM-AE model are all stored in EEPROM.

[0018] As a further improvement to the intelligent judgment method for the correctness of autonomous and controllable energy meter data based on ILSTM-AE: each row of the input data matrix corresponds to a multi-dimensional electrical parameter at a sampling time, and the multi-dimensional electrical parameter includes at least the phase voltage, phase current and active power. Each column of the input data matrix corresponds to the time series of the same electrical parameter at different sampling times.

[0019] As a further improvement to the intelligent judgment method for the correctness of autonomous and controllable energy meter data based on ILSTM-AE: the reconstruction error Calculate using the following formula:

[0020]

[0021] in, The number of sampling moments within the preset time window. The first of the input data matrix row vectors For the first reconstructed data matrix row vectors Represents the L2 norm;

[0022] The physical constraint error Calculate using the following formula:

[0023]

[0024] in, For the first Active power at each sampling time. For the first The effective voltage value at each sampling time. For the first The effective value of the current at each sampling time;

[0025] The comprehensive error Calculate using the following formula:

[0026]

[0027] in, and , which is the fusion weight coefficient in the external parameters.

[0028] As a further improvement to the intelligent data correctness judgment method for autonomous and controllable energy meters based on ILSTM-AE, the step of determining the confidence level of the current data based on the comprehensive error includes calculating the confidence level according to the following formula. :

[0029]

[0030] in, The confidence decay coefficient is one of the external parameters. , The total error is as described above;

[0031] The step of comparing the confidence level with a preset anomaly detection threshold and combining it with the cyclic redundancy check result to generate a data correctness determination result specifically includes:

[0032] When the cyclic redundancy check fails, the result is that there is a bit-level error in the data;

[0033] When the cyclic redundancy check passes and At that time, the judgment result was that the data was normal, among which The anomaly detection threshold among the external parameters;

[0034] When the cyclic redundancy check passes and At that time, the judgment result was that there was a logical anomaly in the data.

[0035] As a further improvement to the intelligent judgment method for the correctness of autonomous and controllable energy meter data based on ILSTM-AE, a parameter adaptive optimization step is also included:

[0036] The improved Sparrow Search Algorithm (ISSA) is used to optimize the external parameters;

[0037] The ISSA employs a preset small-scale population and a preset few iterations, and uses an adaptive step size decay mechanism to reduce the search step size as the iteration progresses, and terminates the iteration early when the change in fitness function value between adjacent iterations is less than a preset convergence threshold.

[0038] The optimal external parameters obtained through optimization are updated in the EEPROM.

[0039] As a further improvement to the intelligent judgment method for the correctness of autonomous and controllable energy meter data based on ILSTM-AE, the following fitness function is used as the optimization objective in the optimization process of the ISSA:

[0040]

[0041] in, This represents the average comprehensive error of the normal samples selected from the labeled dataset in this batch. For preset coefficients, The error rate at which the judgment result is inconsistent with the annotation result after comparing the confidence level and the anomaly discrimination threshold for the labeled samples in this batch.

[0042] As a further improvement to the intelligent judgment method for the correctness of autonomous and controllable energy meter data based on ILSTM-AE, a system recovery step is also included:

[0043] When the system is powered on and reset, the pre-stored cyclic redundancy check code, the external parameters, and the LSTM weights inside the ILSTM-AE model are read from the EEPROM.

[0044] The integrity of historical data in the Flash memory is verified using the read Cyclic Redundancy Check (CRC) code.

[0045] The availability of historical data is determined based on the verification results, and the ILSTM-AE model is reconstructed using the read external parameters and the LSTM weights to restore it to its operating state before the power outage.

[0046] An intelligent system for determining the correctness of autonomous and controllable energy meter data based on ILSTM-AE includes:

[0047] EEPROM is used to store cyclic redundancy check codes, LSTM weights inside the ILSTM-AE model, and a set of external parameters, which include at least fusion weight coefficients, confidence decay coefficients, and anomaly detection thresholds.

[0048] The Flash memory is used to store raw metering data and historical time-series data. The EEPROM and the Flash memory form a physically isolated collaborative storage architecture.

[0049] The ILSTM-AE discrimination module is used to construct an input data matrix within a preset time window based on the effective voltage value, effective current value, and active power. The input data matrix is ​​encoded, compressed, and decoded using the ILSTM-AE model to reconstruct the data matrix, resulting in a reconstructed data matrix. The reconstruction error is calculated based on the difference between the input data matrix and the reconstructed data matrix. The physical constraint error is calculated based on the physical constraint relationship of electric power. The reconstruction error and the physical constraint error are weighted and fused using the fusion weight coefficient to obtain a comprehensive error. The confidence level of the current data is determined based on the comprehensive error and the confidence decay coefficient. The confidence level is compared with the anomaly detection threshold, and the data correctness is determined by combining the results of cyclic redundancy check.

[0050] As a further improvement to the intelligent judgment system for the correctness of autonomous and controllable energy meter data based on ILSTM-AE, it also includes an ISSA parameter optimization module, which is used to optimize the external parameters using an improved sparrow search algorithm. The ISSA parameter optimization module adopts a preset small-scale population and a preset few iterations, and uses an adaptive step size decay mechanism to make the search step size decrease with the iteration process, and terminates the iteration in advance when the change in fitness function value of adjacent iterations is less than a preset convergence threshold.

[0051] As a further improvement to the aforementioned intelligent judgment system for the correctness of autonomous and controllable energy meter data based on ILSTM-AE, it also includes:

[0052] The system recovery module is used to read the cyclic redundancy check code, the external parameters, and the LSTM weights from the EEPROM when the system is powered on and reset. It uses the cyclic redundancy check code to perform integrity verification on the historical data in the Flash memory, and uses the read external parameters and the LSTM weights to reconstruct the ILSTM-AE model to restore it to the operating state before the power failure.

[0053] Compared with the prior art, the present invention has the following beneficial effects:

[0054] 1. Time-series data of RMS voltage, RMS current, and active power are encoded and reconstructed using the ILSTM-AE model. The reconstruction error measures the deviation of the current data from the learned normal pattern, thereby detecting numerical logic anomalies that cannot be covered by traditional CRC or ECC checks. Building upon this, an error calculation based on physical constraints is introduced. The physical constraint error and reconstruction error are weighted and fused to generate a confidence score, which is then compared with an anomaly detection threshold. With this fusion strategy, even if the time-series reconstruction error of anomalous data is insignificant, it will still be classified as an anomaly if it violates basic electrical laws. This reduces the risk of missed detection when relying solely on reconstruction error and provides a physically interpretable basis for the detection results.

[0055] 2. The ILSTM-AE model employs a simplified structure with a single-layer LSTM encoder and a single-layer LSTM decoder, with the bottleneck layer dimension being significantly lower than the input dimension. Compared to the bidirectional or multi-layer stacked structures commonly found in traditional LSTM-AE models, this design, while maintaining temporal feature extraction capabilities, compresses the number of model parameters to a scale suitable for operation on domestically produced MCU chips. This enables anomaly detection methods based on temporal reconstruction to be executed in real-time on resource-constrained embedded platforms within fixed time windows, resolving the bottleneck of existing deep learning models' difficulty in engineering deployment.

[0056] 3. This invention also employs a collaborative storage architecture that physically separates EEPROM and Flash memory. CRC checksums, external parameters (including fusion weight coefficients, confidence decay coefficients, and anomaly detection thresholds), and the LSTM weights within the ILSTM-AE model are stored in the EEPROM, while raw measurement data and historical time-series data are stored in the Flash memory. When the system experiences an abnormal power outage, electromagnetic interference, or Flash memory failure, the verification information and model parameters are not lost along with the original data due to the separation of storage media. After power-on reset, the CRC code stored in the EEPROM is used to verify the integrity of the historical Flash data, and the ILSTM-AE model is directly reconstructed based on the external parameters and LSTM weights, restoring the system to its pre-power-out running state without the need for retraining or reloading the model file.

[0057] 4. This invention employs the improved Sparrow Search Algorithm (ISSA) to periodically optimize external parameters. ISSA reduces the population size, limits the number of iterations, and uses an adaptive step size decay strategy and an early stopping mechanism, thus keeping the computational and storage space consumption of the parameter optimization process at a low level. It can be executed as a periodic background task on the energy meter device. After the optimized external parameters are updated to the EEPROM, the subsequent real-time discrimination process automatically reads and uses the new parameters, thereby enabling the discrimination model to maintain its effectiveness in the face of gradual changes in the operating environment (such as temperature and humidity drift, device aging). Attached Figure Description

[0058] Figure 1 This is a flowchart of an intelligent method for judging the correctness of autonomous and controllable energy meter data based on ILSTM-AE. Detailed Implementation

[0059] The technical solution of the present invention will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0060] Example 1

[0061] An intelligent method for determining the correctness of autonomous and controllable energy meter data based on ILSTM-AE is presented, comprising several parts: initial model construction, online real-time determination, adaptive parameter optimization, incremental model update, and system recovery. Among these, online real-time determination is the core process of daily operation, while adaptive parameter optimization, incremental model update, and system recovery are the supporting mechanisms surrounding this core process. Initial model construction is a prerequisite for the execution of the aforementioned parts. These will be explained in detail below.

[0062] The initial model build is performed before the device leaves the factory or during the first deployment. Its purpose is to determine the structure and initial parameters of the ILSTM-AE model and produce a deployable discriminant model.

[0063] First, typical operating condition data generated by a high-precision standard source is used as the benchmark dataset. The benchmark data needs to cover common voltage ranges, current ranges, and power factor combinations that electricity meters commonly encounter in actual operation.

[0064] Selecting continuous time windows using a sliding time window method Data from each sampling time, with features at each sampling time including three-phase voltage. , , Three-phase current , , and active power ,common Each feature dimension. The feature vector at a single sampling time is denoted as... Then the input matrix for a time window is:

[0065]

[0066] Each row of the matrix corresponds to a 7-dimensional feature vector at a sampling time, and each column corresponds to the change sequence of the same feature over 64 consecutive time points. This matrix simultaneously preserves the time dynamics and the correlation between voltage, current, and power.

[0067] The ILSTM-AE model employs a simplified structure with a single LSTM encoder and a single LSTM decoder, compressing the hidden layer dimension to 16 dimensions. By reducing the number of network layers, the model parameter size is reduced, thereby lowering the computational complexity while maintaining the ability to extract time-series features. The single LSTM encoder processes the input matrix... Processing is done sequentially step by step. At each time step, the LSTM unit updates the hidden state based on the current input row vector and the hidden state from the previous time step. After processing all 64 time steps, the hidden state from the last time step is taken and linearly mapped to obtain the bottleneck layer representation. Its dimension is denoted as A single LSTM decoder with Starting from the initial state, the output vector at each time step is reconstructed step by step to obtain the reconstruction matrix.

[0068] The ILSTM weights inside the ILSTM-AE model were trained using a benchmark dataset. The training employed gradient descent with the goal of minimizing the reconstruction error (the specific calculation method is described later).

[0069] Initialize external parameters , and These are the fusion weight coefficients. and initial value, Anomaly detection threshold initial value, Confidence decay coefficient The initial values. The internal LSTM weights and external parameters of the model. Write to EEPROM to complete model deployment.

[0070] Online real-time discrimination is the core process of the system's daily operation, executed in real time after each acquisition of new sampled data. This requires that the initial model construction has been completed, and the structure and parameters of the ILSTM-AE model have been stored in the EEPROM. The specific steps are as follows.

[0071] Step S1: The voltage analog signal and current analog signal are sequentially converted from analog to digital by ADC and processed by DSP signal to extract the effective value of the three-phase voltage. Three-phase current RMS value and active power .

[0072] The ADC module in the first metering unit performs high-speed sampling of the conditioned analog voltage and current signals. The sampling frequency can be configured within the range of 1MHz to 10MHz, and the sampled values ​​are represented in 8-bit or 16-bit format. After the sampled values ​​are converted into digital quantities, they are encapsulated into data frames in time sequence and transmitted to the DSP module via the SPI interface. The SPI interface is configured in master mode, with a fixed clock frequency and fixed data bit width, and uses an interrupt mechanism to send data frames at fixed intervals. The DSP module performs FIR or IIR digital filtering and noise suppression on the sampled data to extract the effective values ​​of the three-phase voltages. Three-phase current RMS value and active power The data is transmitted to the MCU module via the UART interface. The UART communication parameters can be configured to a baud rate of 9600bps or higher, 8 data bits, even parity or no parity, and 1 stop bit.

[0073] Step S2: For , and The corresponding raw sampling data undergoes collaborative storage and verification—the raw data is written to Flash, the synchronously calculated CRC check code and ECC error correction code are written to EEPROM, and high and low frequency pulses are compared and cross-checked.

[0074] After receiving data from the DSP module, the MCU module performs data storage and protection operations. It writes the original sampled data and historical timing data into the Flash memory, and simultaneously calculates the CRC checksum and ECC error correction code for this batch of data. The CRC and ECC codes are then written into the EEPROM, achieving physical separation of the verification information from the original data. Before writing the data to the storage medium, a second metering unit is invoked to perform high- and low-frequency pulse comparison (this comparison method follows the common error verification procedures in the electricity meter industry, and its specific implementation will not be elaborated upon in this invention). This verifies whether the metering error of the current data is within the preset range through an independent hardware metering path, providing a hardware-level reference for subsequent anomaly detection.

[0075] Step S3: Based on , and The input matrix is ​​constructed using a sliding time window. The normalized values ​​are then used as input to the ILSTM-AE model.

[0076] The MCU module selects continuous [devices] using a sliding window method. Data from each sampling time, each time containing three-phase voltage. , , Three-phase current , , and active power common Construct the input matrix using each feature dimension. For the input matrix Normalization is performed to enhance the numerical stability of the model.

[0077] Step S4: Input matrix The input is fed into the ILSTM-AE model, and the bottleneck layer representation is obtained by compression encoding using a single LSTM encoder. Then, a single LSTM decoder is used for... Decoding and reconstruction yields the reconstruction matrix. and calculate and Reconstruction error between .

[0078] The input matrix obtained in step S3 Input to the ILSTM-AE model. Single LSTM encoder pair Processing is done sequentially step by step. At each time step, the LSTM unit updates the hidden state based on the current input row vector and the hidden state of the previous time step. After all 64 time steps, the hidden state of the last time step is taken and linearly mapped to obtain the bottleneck layer representation. This completes the compression encoding from 448 dimensions to 16 dimensions.

[0079] Will Make 64 copies along the time dimension to form the decoder input matrix:

[0080]

[0081] Single LSTM decoder with Each line is input, processed sequentially at each time step, and a 7-dimensional reconstructed feature vector is output at each time step, ultimately yielding the reconstructed matrix. .

[0082] Calculate the reconstruction matrix With the original input matrix Reconstruction error between :

[0083]

[0084] in, For the input matrix The row vectors To reconstruct the matrix The row vectors Represents the L2 norm. Reconstruction error. This reflects the degree of deviation of the current data from the normal data patterns that the model has learned: the reconstruction error of normal data is small, while the reconstruction error of abnormal data is significantly increased because it does not conform to the learned patterns.

[0085] Step S5: Based on , and Using the physical constraint relationship of electric power, the physical constraint error within the current time window is calculated. .

[0086] Based on the effective value of voltage RMS value of current With active power Physical constraints on electrical power between Calculate physical constraint error :

[0087]

[0088] in, For the first Active power at each sampling time. For the first The effective voltage value at each sampling time. For the first The effective value of the current at each sampling time. Physical constraint error. To assess whether current data conforms to basic electrical laws: when sensor drift, analog front-end noise, or device aging causes the measured values ​​of voltage, current, or power to deviate from the true physical relationship, This will significantly increase, thus providing supplementary evidence for anomaly detection from a physical perspective.

[0089] Step S6: The results obtained in step S4 and the result obtained in step S5 The weighted fusion is used to obtain the comprehensive error. Then calculate the confidence level. ,Will and anomaly detection threshold The comparison is performed, and the judgment result is output in conjunction with the CRC check result. .

[0090] Read the currently valid fusion weight coefficients from the EEPROM. and Regarding reconstruction errors and physical constraint error Weighted fusion is performed to obtain the comprehensive error. :

[0091]

[0092] in, and The value of is determined by the parameter adaptive optimization mechanism, which is used to balance the contributions of reconstruction error and physical constraint error to the final discrimination result.

[0093] Based on comprehensive error Calculate confidence level :

[0094]

[0095] in, The confidence attenuation coefficient read from the EEPROM. Confidence level The range of values ​​is , The closer the value is to 1, the more reliable the current data is. The lower the value, the greater the likelihood that the current data is abnormal.

[0096] The final judgment is made by combining the CRC check result and the judgment result is output. :

[0097] When the CRC check fails This indicates that a bit-level hard error has occurred during data storage or transmission; when the CRC check passes and hour, This indicates that the data is normal; when the CRC check passes and hour, This indicates that there is a logical anomaly in the data.

[0098] in The threshold for detecting anomalies read from the EEPROM. The range of values ​​is .when When an anomaly occurs, the system records the anomaly log and sends alarm signals to the remote monitoring system, enabling real-time monitoring and early warning of the electricity meter's operating status.

[0099] In addition to the main process of online real-time discrimination described above, the method of this invention also includes a parameter adaptive optimization mechanism, a model incremental update mechanism, and a system recovery mechanism.

[0100] The parameter adaptive optimization mechanism is executed periodically in the background to adjust the extrinsic parameters of the ILSTM-AE model based on actual field operation data. Adaptive optimization is performed to continuously adapt the model to the current operating environment and hardware status. The triggering conditions include at least one of the following: the preset timing period is reached; the cross-checking of the second measurement unit reveals that the measurement deviation exceeds the preset range; or the incremental update mechanism triggers parameter re-optimization after completing a fine-tuning.

[0101] Before performing parameter optimization, the candidate data acquired under the current environment undergoes multi-level verification and screening. The specific process of multi-level verification and screening is as follows: First level, hardware verification screening: Candidate data must pass CRC and ECC checks to ensure that no bit-level errors occurred during storage and transmission, excluding data damaged due to abnormal storage media or communication interference. Second level, metering cross-verification: Candidate data must be verified by comparing high and low frequency pulses from a second metering unit to confirm that the metering error of the current data is within a preset range, excluding deviation data caused by abnormalities in the main metering channel. Third level, physical consistency screening: Candidate data must meet the physical constraints of electrical power. Data that does not conform to basic electrical laws due to factors such as sensor drift and analog front-end noise is removed. Specifically, the physical constraint error within the current time window is calculated. ,when When the data is below the preset physical consistency threshold, it is determined that the data passes this level of screening. Level 4, Temporal stability screening: Candidate data must pass the temporal stability verification, including the following three sub-items: (1) Reconstruction error stability test: Input the current data window into the currently deployed ILSTM-AE model and calculate the reconstruction error. ,like If the mean reconstruction error of the recent historical window deviates from the standard deviation by more than a preset multiple, it is judged as unstable and will not pass; (2) Physical error stability test: calculate the physical constraint error of the current data window. ,like If the physical error mean of the recent historical window deviates from the standard deviation by more than a preset multiple, it is judged as unstable and will not pass; (3) Trend continuity test: calculate the sliding rate of change of the effective value of each phase voltage and current in the current data window relative to the previous window. If any rate of change exceeds the preset slow change range, it is judged as trend discontinuity and will not pass. Only data that pass the above four levels of verification are included in the candidate dataset for subsequent parameter optimization. After the candidate training set is constructed, each sample is independently labeled to obtain the labeled dataset. The labeling method is: the domain experts or according to the preset physical boundary rules, label the samples as "normal samples" or "abnormal samples". This labeling process is based only on external prior knowledge (such as power grid specifications or human experience) and does not depend on the discrimination results of the ILSTM-AE model. Therefore, the labeling results are independent of the model and can be used as an objective benchmark for ISSA to optimize external parameters.

[0102] Parameter optimization employs the improved Sparrow Search Algorithm ISSA. ISSA is an improvement upon the traditional Sparrow Search Algorithm SSA in the following ways:

[0103] First, reduce the population size by decreasing the number of sparrows in the population from 30 to 50, which is typically used in traditional SSA, to 10 to 15.

[0104] Second, the maximum number of iterations is reduced from 100 to 200 typically used in traditional SSA to 20 to 30. These two improvements significantly reduce the computational load and storage resource consumption of the parameter optimization process.

[0105] Third, an adaptive step size decay mechanism is introduced. Step size With the current iteration number Adaptive Decreasing:

[0106]

[0107] in, The initial step size, The step size is the maximum number of iterations. In the early stages of iteration, a larger step size is beneficial for conducting a broad global search in the parameter space; as the iteration progresses, the step size gradually decreases, which is beneficial for conducting fine local optimization near the discovered better regions, thereby improving convergence accuracy.

[0108] Fourth, an early stopping mechanism is introduced. The iteration process is terminated early when the fitness function value changes between two consecutive iterations meet the following conditions:

[0109]

[0110] in, For the first The fitness function value of the next iteration. This is a preset early stopping threshold. The early stopping mechanism avoids ineffective iterations after the fitness has basically converged, further saving computational resources.

[0111] During parameter optimization, the internal LSTM weights of the ILSTM-AE model remain unchanged, and the fitness function is... , This represents the average comprehensive error of the normal samples selected from the labeled dataset in this batch. The preset coefficient is preferably 0.4-0.7. The error rate where the judgment result of the labeled samples in this batch is inconsistent with the labeling result after comparing the confidence level with the anomaly discrimination threshold (e.g., a sample labeled as normal is displayed as an anomaly in the comparison judgment result, or vice versa), is calculated as the number of samples with incorrect judgment results divided by the total number of samples in this batch. ISSA's optimization target is... After optimization, the new parameters will be obtained. Write to EEPROM, overwriting the old parameters. The system will automatically read and use the updated parameters in subsequent runs, based on real-time online detection.

[0112] The purpose of the incremental update mechanism is to enable the ILSTM-AE model to adapt to gradual changes in the operating environment, such as seasonal temperature and humidity drift and minor aging of devices, thereby maintaining and improving the anomaly detection accuracy during long-term operation.

[0113] The trigger condition for the incremental update mechanism is that the number of data points that have passed multi-level validation and been judged as normal accumulates to a preset threshold. The training data selection criteria here are the same as those in the multi-level validation mechanism (and only data judged as normal is selected), but the selection criteria can be set more strictly to ensure that the data entering the fine-tuning training set has sufficient reliability.

[0114] Once the triggering condition is met, the LSTM weights within the ILSTM-AE model are incrementally fine-tuned at a preset small learning rate. The fine-tuning process uses gradient descent and involves only a small number of iterations, subtly adjusting the model parameters towards the new data distribution. During fine-tuning, only the LSTM weights are updated; the model structure remains unchanged, and no external parameters are involved. The search for excellence.

[0115] The model incremental update mechanism also includes an environment migration detection step: continuously monitoring physical constraint errors. The long-term mean. If If the long-term mean deviation exceeds the preset safety threshold, it indicates a significant change in the current operating environment, representing a major environmental migration rather than a gradual change. At this point, the system triggers an alarm signal and must freeze the ISSA's background triggering mechanism until the new model is redeployed. This mechanism ensures that when the operating environment fundamentally changes, the system will not make ineffective fine-tuning based on an outdated model, but will instead fundamentally rebuild a discrimination model adapted to the new environment.

[0116] The system recovery mechanism is automatically executed when the system is powered on or reset, with the aim of quickly restoring the system to normal operation after abnormal power failure, electromagnetic interference reset, or other faults.

[0117] After the system is powered on, it first reads the stored CRC checksum, ECC error correction code, and external operating parameters from the EEPROM. The system also includes the internal LSTM weights of the ILSTM-AE model. The integrity of historical data stored in Flash memory is verified using CRC checksums stored in the EEPROM: if the CRC matches, the data in Flash is undamaged, and the system can continue to use it; if the CRC matches, the data in Flash is corrupted, and the system marks the data block as unusable. Simultaneously, the ILSTM-AE discriminant model is reconstructed using parameters from the EEPROM, restoring the system to its operational state. Because the EEPROM and Flash are physically separated, the critical verification information and model parameters stored in the EEPROM are preserved.

[0118] Another method for system recovery after power-on is as follows: The cyclic redundancy check (CRC) code, ECC error correction code, external parameters, and LSTM weights are read from the EEPROM. First, data-level recovery is performed: the ECC error correction code in the EEPROM is used to perform block-by-block error correction scanning of historical data in the Flash memory. For data meeting the single-bit error characteristics, the error bit is located using the ECC code checksum and flipped for correction; the recovered data is then read into memory. For data blocks with multi-bit uncorrectable errors, they are marked as corrupted. Then, integrity verification is performed: the CRC checksum is used to perform secondary verification on the ECC-corrected data blocks; if the CRC comparison matches, the data is confirmed to be usable. Finally, the ILSTM-AE model is reconstructed using the read external parameters and LSTM weights, restoring the system to its operating state before power failure. Optionally, in some scenarios, error correction can be performed solely based on the ECC error correction code.

[0119] Next, the structure of the ILSTM-AE model (including a single LSTM encoder, a 16-dimensional bottleneck layer, and a single LSTM decoder) is reconstructed based on the parameters read from the EEPROM. The internal LSTM weights are then loaded, along with the external parameters. This allows the model to quickly recover to its previous normal operating state. After recovery, the system directly enters the online real-time discrimination process and continues to execute the parameter adaptive optimization mechanism without needing to rebuild the model from scratch.

[0120] Example 2

[0121] An intelligent system for judging the correctness of data from an autonomous and controllable energy meter based on ILSTM-AE includes a first metering unit, a second metering unit, an EEPROM, and a Flash.

[0122] The first metering unit adopts a hierarchical processing architecture of ADC, DSP, and MCU. The ADC module performs analog-to-digital conversion on the conditioned analog voltage and current signals. The sampling frequency can be configured from 1MHz to 10MHz, and the sampled values ​​are represented in 8-bit or 16-bit format. The ADC module communicates with the DSP module via an SPI interface. The SPI interface is configured in master mode, with a fixed clock frequency and fixed data bit width. An interrupt mechanism is used to send data frames at fixed intervals to ensure real-time performance and reliability of data transmission. The DSP module performs real-time signal processing on the sampled data, including FIR or IIR digital filtering and noise suppression, and extracts the effective values ​​of the three-phase voltages. Three-phase current RMS value and active power The processed data is then transmitted to the MCU module via the UART interface. UART communication parameters are configurable to a baud rate of 9600bps or higher, 8 data bits, even or no parity, and 1 stop bit. The MCU module is responsible for system control, data management, and anomaly detection. Both the MCU and DSP use domestically produced chips, ensuring the system's independent controllability.

[0123] The second metering unit is a hardware metering path independent of the first metering unit. The second metering unit verifies and cross-checks metering errors by comparing high- and low-frequency pulses: the energy pulses output by the first metering unit are compared with the reference pulses generated by the second metering unit itself. When the deviation exceeds a preset range, a metering anomaly is determined. The second metering unit provides hardware-level cross-checking reference data for anomaly detection.

[0124] The EEPROM connects to the MCU and stores CRC checksums, ECC error correction codes, parameters of the ILSTM-AE model, and key thresholds. Specifically, the EEPROM stores the following: CRC checksums, ECC error correction codes, and fusion weight coefficients. and Confidence decay coefficient Anomaly detection threshold The system includes the internal LSTM weights of the ILSTM-AE model. Flash memory connects to the MCU and stores raw sampling data, historical time-series data, and event logs. EEPROM and Flash memory form a collaborative storage system: Flash memory handles large-capacity raw and historical data storage, while EEPROM handles small-capacity critical verification information and reliable model parameter storage. The two are physically separated, ensuring isolation and protection of verification information from raw data under conditions such as power failure, electromagnetic interference, or storage unit malfunction.

[0125] The MCU is equipped with an ILSTM-AE discrimination module, an ISSA parameter optimization module, a data filtering module, a model update module, and a system recovery module.

[0126] The ILSTM-AE discrimination module includes a time-series data construction submodule, a single LSTM encoder, a single LSTM decoder, a reconstruction error calculation submodule, a physical constraint error calculation submodule, and a fusion discrimination submodule. The time-series data construction submodule is used to construct the input matrix within a time window from the data output by the DSP module. A single LSTM encoder is used for the input matrix. Perform compression encoding and output the bottleneck layer representation. A single LSTM decoder is used for the bottleneck layer representation. Perform decoding and reconstruction, and output the reconstruction matrix. The reconstruction error calculation submodule is used to calculate the reconstruction matrix. With input matrix Reconstruction error between The physical constraint error calculation submodule is used to calculate errors based on the effective voltage value. RMS value of current With active power Calculate the physical constraint relationship between them to calculate the physical constraint error. The fusion discrimination submodule is used to analyze reconstruction errors. and physical constraint error The weighted fusion is used to obtain the comprehensive error. According to the comprehensive error Calculate confidence level and confidence level and anomaly detection threshold The results are compared and combined with the CRC check results to output the judgment result. .

[0127] The ISSA parameter optimization module is used to improve the fusion weight coefficients in the ILSTM-AE discriminant module by refining the sparrow search algorithm ISSA. and Confidence decay coefficient and anomaly detection threshold Optimizations were implemented. ISSA reduced computational complexity by decreasing the population size and the number of iterations, and introduced an adaptive step size decay mechanism and an early stopping mechanism.

[0128] The data filtering module performs multi-level verification filtering on the sampled data, including CRC check, ECC check, electrical power physical constraint relationship verification, and time series stability verification. The model update module incrementally fine-tunes the internal LSTM weights of the ILSTM-AE discrimination module at a preset small learning rate when the accumulated data that has passed the data filtering module and been judged as normal by the ILSTM-AE discrimination module reaches a preset number.

[0129] The system recovery module is used to read the CRC check code from the EEPROM to verify the integrity of the data in the Flash when the system is powered on or reset, and to read the model parameters and internal LSTM weights to restore the running state of the ILSTM-AE discrimination module.

[0130] The modules in this embodiment are used to implement the corresponding method steps in Embodiment 1.

[0131] It should be noted that, as will be apparent to those skilled in the art, the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics thereof. The scope of the present invention is defined by the claims rather than the foregoing description.

Claims

1. A method for intelligently judging the correctness of autonomous and controllable energy meter data based on ILSTM-AE, comprising: The method for obtaining the effective voltage value, effective current value, and active power of an electricity meter, as well as the cyclic redundancy check results corresponding to the effective voltage value, the effective current value, and the active power, is characterized by further comprising: An input data matrix is ​​constructed based on the effective values ​​of voltage, current, and active power within a preset time window; The input data matrix is ​​input into the improved Long Short-Term Memory Autoencoder (ILSTM-AE) model. The input data matrix is ​​compressed using a temporal feature compression method via an LSTM encoder to obtain a bottleneck layer representation. The LSTM decoder then decodes and reconstructs the data matrix based on the bottleneck layer representation to obtain the reconstructed data matrix. The ILSTM-AE model adopts a simplified structure with a single LSTM encoder and a single LSTM decoder. The reconstruction error is calculated based on the difference between the input data matrix and the reconstructed data matrix; The physical constraint error is calculated based on the physical power constraint relationship that should be satisfied between the effective voltage value, the effective current value, and the active power. The reconstruction error and the physical constraint error are weighted and fused to obtain the comprehensive error; The confidence level of the current data is determined based on the comprehensive error. The confidence level is compared with a preset anomaly detection threshold, and combined with the cyclic redundancy check result, a data correctness determination result is generated; The fusion weight coefficient used in the weighted fusion, the confidence decay coefficient used to determine the confidence level, and the anomaly detection threshold constitute a set of external parameters. The external parameters and the LSTM weights inside the ILSTM-AE model are all stored in EEPROM.

2. The intelligent method for determining the correctness of autonomous and controllable energy meter data based on ILSTM-AE as described in claim 1, characterized in that: Each row of the input data matrix corresponds to a multidimensional electrical parameter at a sampling time. The multidimensional electrical parameter includes at least the phase voltage, phase current, and active power. Each column of the input data matrix corresponds to the time series of the same electrical parameter at different sampling times.

3. The intelligent method for determining the correctness of autonomous and controllable energy meter data based on ILSTM-AE as described in claim 1, characterized in that: The reconstruction error Calculate using the following formula: ; in, The number of sampling moments within the preset time window. The first of the input data matrix row vectors For the first reconstructed data matrix row vectors Represents the L2 norm; The physical constraint error Calculate using the following formula: ; in, For the first Active power at each sampling time. For the first The effective voltage value at each sampling time. For the first The effective value of the current at each sampling time; The comprehensive error Calculate using the following formula: ; in, and , which is the fusion weight coefficient in the external parameters.

4. The intelligent method for determining the correctness of autonomous and controllable energy meter data based on ILSTM-AE as described in claim 1, characterized in that, Determining the confidence level of the current data based on the comprehensive error includes calculating the confidence level using the following formula. : ; in, The confidence decay coefficient is one of the external parameters. , The total error is as described above; The step of comparing the confidence level with a preset anomaly detection threshold and combining it with the cyclic redundancy check result to generate a data correctness determination result specifically includes: When the cyclic redundancy check fails, the result is that there is a bit-level error in the data; When the cyclic redundancy check passes and At that time, the judgment result was that the data was normal, among which The anomaly detection threshold among the external parameters; When the cyclic redundancy check passes and At that time, the judgment result was that there was a logical anomaly in the data.

5. The intelligent method for determining the correctness of autonomous and controllable energy meter data based on ILSTM-AE as described in claim 1, characterized in that, It also includes a parameter adaptive optimization step: The improved Sparrow Search Algorithm (ISSA) is used to optimize the external parameters; The ISSA employs a preset small-scale population and a preset few iterations, and uses an adaptive step size decay mechanism to reduce the search step size as the iteration progresses, and terminates the iteration early when the change in fitness function value between adjacent iterations is less than a preset convergence threshold. The optimal external parameters obtained through optimization are updated in the EEPROM.

6. The intelligent data correctness determination method for autonomous and controllable energy meters based on ILSTM-AE as described in claim 5, characterized in that, In the optimization process of the ISSA, the following fitness function is used as the optimization objective: ; in, This represents the average comprehensive error of the normal samples selected from the labeled dataset in this batch. For preset coefficients, The error rate at which the judgment result is inconsistent with the annotation result after comparing the confidence level and the anomaly discrimination threshold for the labeled samples in this batch.

7. The intelligent method for determining the correctness of autonomous and controllable energy meter data based on ILSTM-AE as described in claim 1, characterized in that, It also includes system recovery steps: When the system is powered on and reset, the pre-stored cyclic redundancy check code, the external parameters, and the LSTM weights inside the ILSTM-AE model are read from the EEPROM. The integrity of historical data in the Flash memory is verified using the read Cyclic Redundancy Check (CRC) code. The availability of historical data is determined based on the verification results, and the ILSTM-AE model is reconstructed using the read external parameters and the LSTM weights to restore it to its operating state before the power outage.

8. A self-controllable intelligent system for judging the correctness of electricity meter data based on ILSTM-AE, characterized in that, include: EEPROM is used to store cyclic redundancy check codes, LSTM weights inside the ILSTM-AE model, and a set of external parameters, which include at least fusion weight coefficients, confidence decay coefficients, and anomaly detection thresholds. The Flash memory is used to store raw metering data and historical time-series data. The EEPROM and the Flash memory form a physically isolated collaborative storage architecture. The ILSTM-AE discrimination module is used to construct an input data matrix within a preset time window based on the effective voltage value, effective current value, and active power. The input data matrix is ​​encoded, compressed, and decoded using the ILSTM-AE model to reconstruct the data matrix, resulting in a reconstructed data matrix. The reconstruction error is calculated based on the difference between the input data matrix and the reconstructed data matrix. The physical constraint error is calculated based on the physical constraint relationship of electric power. The reconstruction error and the physical constraint error are weighted and fused using the fusion weight coefficient to obtain a comprehensive error. The confidence level of the current data is determined based on the comprehensive error and the confidence decay coefficient. The confidence level is compared with the anomaly detection threshold, and the data correctness is determined by combining the results of cyclic redundancy check.

9. The intelligent data correctness judgment system for autonomous and controllable energy meters based on ILSTM-AE as described in claim 8, characterized in that, It also includes an ISSA parameter optimization module, which is used to optimize the external parameters using an improved sparrow search algorithm. The ISSA parameter optimization module uses a preset small population and a preset few iterations, and adopts an adaptive step size decay mechanism to make the search step size decrease with the iteration process, and terminates the iteration early when the change in fitness function value of adjacent iterations is less than a preset convergence threshold.

10. The intelligent data correctness judgment system for autonomous and controllable energy meters based on ILSTM-AE as described in claim 8, characterized in that, Also includes: The system recovery module is used to read the cyclic redundancy check code, the external parameters, and the LSTM weights from the EEPROM when the system is powered on and reset. It uses the cyclic redundancy check code to perform integrity verification on the historical data in the Flash memory, and uses the read external parameters and the LSTM weights to reconstruct the ILSTM-AE model to restore it to the operating state before the power failure.