A smart meter measurement error prediction method and system
Patent Information
- Application Number
- CN202610975106.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-01
- Publication Date
- 2026-10-30
AI Technical Summary
然而,与实验室受控环境截然不同,现场部署的智能电表长期处于复杂多变的恶劣工况下,温度波动、湿度变化及各类环境应力会持续加速电子元件老化,进而引发测量误差的显著非线性漂移
本发明设计了新颖的双路径门控注意力Transformer模型,该模型的双路径结构能够将短期的局部动态波动与长期的全局时间依赖性解耦。局部注意力分支负责短期变化,全局注意力分支保留输入窗口内更广泛的时间上下文,最后通过门控机制自适应融合学习到的表示,完美契合了智能电表误差序列同时包含瞬态干扰和缓慢漂移行为的复杂时间特性。基于该模型能够大大提高智能电表计量误差的预测精度。
Smart Images

Figure CN123012516A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method and system for predicting measurement errors in smart meters, belonging to the field of automated meter monitoring technology. Background Technology
[0002] As a core component of advanced metering infrastructure in modern smart grids, the measurement accuracy of smart meters directly affects the fairness of energy billing, the reliability of grid dispatching, and the scientific nature of equipment maintenance decisions. However, unlike the controlled environment of a laboratory, field-deployed smart meters operate under complex and variable harsh conditions for extended periods. Temperature fluctuations, humidity changes, and various environmental stresses continuously accelerate the aging of electronic components, leading to significant nonlinear drift in measurement errors.
[0003] In traditional operation and maintenance models, metering accuracy is mainly ensured through regular manual inspections and batch replacement of meters. This approach is not only costly in terms of manpower and has a long maintenance cycle, but it also easily leads to the premature replacement of fully functional meters, resulting in a large amount of unnecessary resource waste. Although data-driven methods based on support vector regression, various neural networks, etc., have been extensively studied, existing technologies generally struggle to simultaneously and accurately model the multi-scale dynamic characteristics of measurement errors, such as transient disturbances and long-term slow drift. Summary of the Invention
[0004] To address the problems existing in the prior art, this invention proposes a method and system for predicting measurement errors in smart meters. It proposes a prediction model based on the dual-path attention mechanism Transformer, which can capture the local features of input data in the short term and the overall features in the long-term time window, and fuse them into multi-scale features for measurement error prediction, thereby improving prediction accuracy.
[0005] The technical solution of the present invention is as follows: On the one hand, this invention proposes a method for predicting measurement errors in smart meters, comprising the following steps: Metering error data and environmental characteristic data of sample smart meters under different environmental conditions are collected to form a measurement error sequence, and the measurement error sequence is preprocessed. Based on the preprocessed measurement error sequence, several environmental features with strong correlation to measurement errors are selected from the environmental feature data to form a subset of environmental variables; a training sample set is constructed using the subset of environmental variables. An error prediction model based on Transformer is constructed, including an input layer, a dual-path attention module, a feature fusion layer, and an output layer. The dual-path attention module extracts local features of the data input from the input layer within a short time window and global features within the entire time window through two attention layers. The feature fusion layer is used to fuse local and global features. The output layer outputs the prediction measurement error of the last time step based on the fused features. The error prediction model is trained using a training sample set, and the measurement error of the target smart meter is predicted using the trained error prediction model. In a preferred embodiment, the step of preprocessing the measurement error sequence specifically includes: The original measurement error sequence is cleaned using a trend-constrained dynamic residual constant refinement method, the moving median is used to estimate the local trend, and the dynamic residuals are calculated. A robust normalized score is calculated by introducing the median absolute deviation, and abnormal candidate points are identified by setting a detection threshold. Combined with the local trend consistency condition, isolated pulse anomalies or anomaly segments are reconstructed and interpolated using adjacent trend information.
[0006] In a preferred embodiment, the step of selecting several environmental features that are strongly correlated with measurement errors from the environmental feature data specifically includes: Based on the preprocessed measurement error sequence, the mutual information between each environmental feature and the measurement error is calculated and normalized. Based on the normalized mutual information values, each environmental feature is sorted, and the top N environmental features with the highest ranking are selected to construct a subset of environmental variables.
[0007] In a preferred embodiment, the input layer of the error prediction model is further used to add learnable location embeddings to the input data and perform layer normalization.
[0008] In a preferred embodiment, the dual-path attention module employs a causal attention layer to extract local features of the input data and a self-attention layer without causal masking to extract global features of the input data.
[0009] In a preferred embodiment, the feature fusion layer introduces a gating mechanism to adaptively adjust the contribution of local features, and performs feature fusion calculation on local and global features based on the contribution to obtain fused features.
[0010] In a preferred embodiment, the error prediction model uses the mean squared error function as the loss function and employs the Adam optimizer for model training.
[0011] On the other hand, the present invention also proposes a smart meter measurement error prediction system, comprising: The data acquisition module is used to collect metering error data and environmental characteristic data of the sample smart meters under different environmental conditions, form a measurement error sequence, and preprocess the measurement error sequence. The sample construction module, based on the preprocessed measurement error sequence, selects several environmental features that are strongly correlated with the measurement error from the environmental feature data to form a subset of environmental variables; and constructs a training sample set through the subset of environmental variables. The model building module is used to build an error prediction model based on Transformer. It includes an input layer, a dual-path attention module, a feature fusion layer, and an output layer. The dual-path attention module extracts local features of the data input from the input layer within a short time window and global features within the entire time window through two attention layers. The feature fusion layer is used to fuse local and global features. The output layer outputs the prediction measurement error of the last time step based on the fused features. The error prediction module trains the error prediction model using a training sample set, and then uses the trained error prediction model to predict the measurement error of the target smart meter.
[0012] In another aspect, the present invention also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the smart meter measurement error prediction method as described in any embodiment of the present invention.
[0013] Furthermore, the present invention also proposes a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the smart meter measurement error prediction method as described in any embodiment of the present invention.
[0014] The beneficial effects of this invention are as follows: This invention designs a novel dual-path gated attention Transformer model. The dual-path structure of this model decouples short-term local dynamic fluctuations from long-term global temporal dependencies. The local attention branch handles short-term changes, while the global attention branch preserves the broader temporal context within the input window. Finally, the learned representations are adaptively fused through a gating mechanism, perfectly matching the complex temporal characteristics of smart meter error sequences, which simultaneously contain transient disturbances and slow drift behavior. Based on this model, the prediction accuracy of smart meter metering errors can be significantly improved.
[0015] Additional aspects and advantages of the invention will be set forth in the following description, and some of them will be obvious from the description, or may be learned by practicing the invention. Furthermore, various aspects and advantages of the invention may be realized and obtained by means of method steps and combinations particularly pointed out in the appended claims. Attached Figure Description
[0016] Figure 1 This is a structural example diagram of the prediction model proposed in the embodiments of the present invention; Figure 2 This is a schematic diagram illustrating environmental feature filtering based on mutual information in an embodiment of the present invention; Figure 3 This is a schematic diagram comparing the model performance of examples in the embodiments of the present invention; Figure 4 This is a schematic diagram of the prediction fitting curve and error distribution results of the prediction model in an embodiment of the present invention. Detailed Implementation
[0017] 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.
[0018] It should be understood that the step numbers used in the text are for ease of description only and are not intended to limit the order in which the steps are performed.
[0019] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0020] The terms “comprising” and “including” indicate the presence of the described feature, whole, step, operation, element and / or component, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.
[0021] The term “and / or” refers to any combination of one or more of the associated listed items, as well as all possible combinations, and includes these combinations.
[0022] This application proposes a method for predicting measurement errors in smart meters, including the following steps: S100: Collect metering error data and environmental characteristic data of sample smart meters under different environmental conditions, including metering error values under different current loads and environmental characteristic data of smart meters at different time periods such as temperature, humidity, air pressure, wind speed, light, precipitation and altitude, to form a measurement error sequence, and preprocess the measurement error sequence. In one embodiment, a trend-constrained dynamic residual constant refinement method is specifically used to clean the original measurement error sequence. The moving median is used to estimate the local trend. And calculate the dynamic residuals. .
[0023] in, , Indicates the first The original measurement error value at each moment; Indicated by Centered on the movement time window, for example Window length is ; This indicates taking the median. Indicates the first The dynamic residual at each time point is the degree of deviation between the original measurement error value and the local trend value.
[0024] A normalized score is calculated using the median absolute deviation, and anomaly candidate points are identified by setting a detection threshold. A local trend consistency condition is set to determine whether an anomaly candidate point is merely a sudden change deviating from the local trend, rather than a normal change in the true trend of the measurement error. Specifically, this can be set as follows: the non-anomaly neighboring points before and after the anomaly candidate point still conform to the local trend, i.e., their residual scores do not exceed the threshold, and the direction or magnitude of the trend change before and after remains consistent. Based on the normalized score and the local trend consistency condition, it is determined whether the anomaly candidate point belongs to a measurement anomaly requiring correction, and further distinguishes whether it belongs to an isolated pulse anomaly point or a continuous anomaly segment. Adjacent trend information is obtained, which comes from the non-anomaly measurement points on both sides of the anomaly candidate point or anomaly segment and their local trend values. This adjacent trend information is used to reconstruct and interpolate the isolated pulse anomaly point or anomaly segment, as shown in the following formula: ; In the formula, Indicates the first The robust normalized residual score at each time step is used to determine whether the point is an anomalous candidate point. This represents the median of the dynamic residual sequence within the local window, serving as the robust center value of the residuals. Indicates the first The median absolute deviation of the dynamic residuals within a local window at each time step, with a scaling correction factor of 1.4826, is used to convert the MAD to a scale approximately consistent with the standard deviation. It represents a number that is infinitely close to 0.
[0025] Anomaly candidate points are based on Initially identified potential anomaly locations. Pulse anomalies are a type of candidate anomaly, referring to isolated abrupt changes occurring at a single moment, such as... It is an abnormal candidate point, but None of them are abnormal candidate points.
[0026] Based on the above implementation scheme, this application proposes a trend-constrained dynamic residual constant refinement method. This method can effectively suppress pulse anomalies caused by acquisition noise and sensor instability, while preserving the true slow and gradual degradation trend of measurement errors. Compared with the method of directly deleting outliers, it greatly improves the quality of field measurement data and the integrity of the temporal structure.
[0027] S200. Based on the preprocessed measurement error sequence, select several environmental features that are strongly correlated with measurement errors from the environmental feature data to form a subset of environmental variables. In one embodiment, the step of filtering out several environmental features with strong correlation to measurement error from environmental feature data specifically employs mutual information for feature correlation analysis, including: Based on the preprocessed measurement error sequence, the mutual information between each environmental feature and the measurement error is calculated. After normalization, the formula for calculating mutual information is as follows: ; In the formula, For the first Environmental characteristic variables, such as temperature, humidity, air pressure, wind speed, sunlight, and precipitation, etc. This is the preprocessed measurement error sequence. Indicates environmental characteristics A value or discrete interval, Indicates measurement error A value or discrete interval, The environmental characteristic value is indicated. Measurement error is taken as: The joint probability at time; Represents the marginal probabilities of environmental characteristics and measurement errors, respectively; Indicates the first The mutual information value between an environmental feature and measurement error. The larger the value, the stronger the correlation between the environmental feature and the measurement error.
[0028] Based on the normalized mutual information values, each environmental feature is sorted, and the top N environmental features with the highest ranking are selected to construct a subset of environmental variables.
[0029] Traditional linear correlation analysis may underestimate variables with nonlinear dependencies, while mutual information can simultaneously quantify both linear and nonlinear dependencies between environmental explanatory features and measurement errors. This application's embodiments, through feature correlation analysis based on mutual information, select the most informative feature subset (such as temperature, humidity, and air pressure), removing redundant and weakly informative variables. This not only reduces model complexity but also enhances the interpretability of the prediction model.
[0030] Then, a training sample set is constructed using a subset of environment variables and a sliding window strategy, as follows: Let the selected subset of environment variables be:
[0031] The preprocessed measurement error data and the filtered environmental features are aligned by time to form the input vector for each time step:
[0032] in, This represents the preprocessed measurement error data. Indicates the first At the [time]th moment The values of each environmental feature. Let the sliding window length be... Then the first The training samples are:
[0033] The corresponding tags are:
[0034] That is, use continuous Based on historical measurement error data and environmental characteristics at each moment, the measurement error at the next moment is predicted. Before training, all input variables are normalized using the training set parameters, as shown in the following equation: ; In the formula, Indicates the first At the [time]th moment The original values of the input variables; This represents the normalized value; Indicates the first training set The mean of the input variables; Indicates the first training set The standard deviation of each input variable.
[0035] S300. Construct an error prediction model based on Transformer, see [link / reference]. Figure 1 The model specifically includes an input layer, a dual-path attention module, a feature fusion layer, and an output layer. The dual-path attention module extracts local features of the data input from the input layer within a short time window and global features within the entire time window through two attention layers. The feature fusion layer is used to fuse local and global features. The output layer outputs the prediction measurement error of the last time step based on the fused features. In one embodiment, since the self-attention mechanism cannot inherently encode temporal order, the input layer of the error prediction model is further used to add learnable positional embeddings to the input data and perform layer normalization, as shown in the following equation: ; ; In the formula, Indicates the first The input matrix corresponding to each sliding window can be represented by the dimension as follows: , For window length, For the dimensions of the input variables; This represents a learnable positional embedding used to provide temporal sequence information to the model; This represents the initial hidden representation after adding positional embedding; Presentation layer normalization operation; This represents the normalized input representation, which can be used as the base input for subsequent attention modules.
[0036] Specifically, the underlying time representation is extracted through a causal self-attention layer, ensuring that the representation at each time step depends only on the current and past observations, as shown in the following equation: ; In the formula, These represent the query matrix, key matrix, and value matrix, respectively, typically obtained from the input hidden representation through a linear transformation:
[0037] in, The dimension of the key vector. Used to scale the dot product results to avoid excessively large values.
[0038]
[0039] in, Indicates the number of attention heads; Indicates the first Each attention head output; This indicates that the outputs of multiple attention heads are concatenated; This indicates the output linear transformation matrix.
[0040] In one embodiment, the dual-path attention module employs a causal attention layer to extract local features of the input data, focusing on short-term temporal fluctuations, as shown in the following formula: ; in, Representation of local features; This represents a multi-head attention layer with causal constraints; This branch represents the base time representation of the input layer output. It is used to focus on short-term time fluctuations, such as transient interferences, sudden disturbances, or short-period changes in meter measurement errors.
[0041] A self-attention layer without causal masking is used to extract global features from the input data and capture the overall global dependencies within the input window, as shown in the following equation: ; in, Represents global feature representation; This represents a self-attention layer without a causal mask. Based on time representation.
[0042] In one embodiment, the feature fusion layer introduces a gating mechanism to adaptively adjust the contribution of local features. The formula for calculating the gating value is as follows: ; In the formula, This represents the gating value, used for adaptive control of the contribution ratio of local and global features; This represents the Sigmoid function, which makes... The value of is between 0 and 1; The weight matrix is a learnable weight matrix; This is a bias term.
[0043] Based on their contribution, local and global features are fused to obtain the fused features, as shown in the following formula: ; In the formula, Indicates the characteristics after fusion; This indicates element-wise multiplication; The output is normalized based on the fused features, as shown in the following equation: ; In the formula, The normalized fused features of the representation layer are used to stabilize model training and improve the problem of inconsistent scales of different features.
[0044] The above-described Transformer model is based on dual-path gated attention (DGPAformer). This model's dual-path structure decouples short-term local dynamic fluctuations from long-term global time dependencies. The local attention branch handles short-term changes, while the global attention branch preserves the broader temporal context within the input window. Finally, the learned representations are adaptively fused through a gating mechanism, perfectly matching the complex temporal characteristics of smart meter error sequences, which simultaneously contain transient disturbances and slow drift behavior.
[0045] The normalized representation of the last time step is selected as the final time state, and the predicted measurement error is output through a fully connected regression layer, as shown in the following formula: ; In the formula, This represents the measurement error predicted by the model for the next time step. express The hidden state corresponding to the last time step in the middle; Indicates the weights of the fully connected regression layer; This indicates the regression layer bias.
[0046] S400. The error prediction model is trained using the training sample set. The error prediction model uses the mean squared error function as the loss function and the Adam optimizer is used for model training. The loss function is shown in the following formula: ; In the formula, Indicates training loss; Indicates the number of training samples; Indicates the first The actual measurement error corresponding to each training sample; The model represents the first The prediction measurement error of the training sample output.
[0047] This loss function measures the mean squared deviation between the prediction error and the true error. During training, the Adam optimizer updates the learnable parameters in the Transformer model, including attention layer parameters, gating fusion parameters, location embedding parameters, and output regression layer parameters, by minimizing this loss function.
[0048] The measurement error of the target smart meter is predicted using a trained error prediction model. To verify the effectiveness and superiority of the method proposed in the embodiments of this application, a specific example is provided as follows: The validation was performed using millions of real-world operational data points collected between 2017 and 2024 from a typical environmental laboratory of the State Grid Corporation of China (characterized by high humidity, high temperature, and high salt spray). The dataset includes data from smart meters manufactured by companies A, B, and C.
[0049] like Figure 2 As shown, environmental features were screened using mutual information. The results showed that temperature had the highest mutual information value, followed by relative humidity, while wind speed, light, and precipitation had a weaker impact. Finally, temperature, relative humidity, and air pressure were selected as the main model inputs.
[0050] like Figure 3 As shown, MAE, RMSE, MAPE and As a performance evaluation metric, eight representative benchmark models were compared. Experimental results show that the measurement error prediction model (DGPAformer) proposed in this embodiment performs best on datasets from three companies. It exhibits high robustness under multi-manufacturer and extreme environmental conditions. Experiments demonstrate that this method achieves the best prediction performance among all compared models (including SVR, XGBoost, LSTM, Transformer, and PatchTST, etc.), with extremely low prediction errors (MAE, RMSE, MAPE) and good fit. Extremely high accuracy, providing an accurate and stable data-driven solution.
[0051] The prediction fitting curves and error distribution results of the Measurement Error Prediction Model (DGPAformer) on the datasets of the three companies are as follows: Figure 4 As shown.
[0052] This application also proposes a smart meter measurement error prediction system, including: The data acquisition module is used to collect metering error data and environmental characteristic data of the sample smart meters under different environmental conditions, form a measurement error sequence, and preprocess the measurement error sequence; this module is used to implement the function of step S100 in the method embodiment, which will not be described in detail here; The sample construction module, based on the preprocessed measurement error sequence, selects several environmental features that are strongly correlated with the measurement error from the environmental feature data to form a subset of environmental variables; and constructs a training sample set through the subset of environmental variables; this module is used to implement the function of step S200 in the method embodiment, and will not be described in detail here; The model building module is used to build a Transformer-based error prediction model, including an input layer, a dual-path attention module, a feature fusion layer, and an output layer. The dual-path attention module extracts local features of the data input from the input layer within a short time window and global features within the entire time window through two attention layers. The feature fusion layer is used to fuse the local and global features. The output layer outputs the prediction measurement error of the last time step based on the fused features. This module is used to implement the function of step S300 in the method embodiment, and will not be described in detail here. The error prediction module trains the error prediction model using a training sample set, and then uses the trained error prediction model to predict the measurement error of the target smart meter. This module is used to implement the function of step S400 in the method embodiment, and will not be described in detail here.
[0053] This application also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the smart meter measurement error prediction method as described in any embodiment of the present invention.
[0054] This application also proposes a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the smart meter measurement error prediction method as described in any embodiment of the present invention.
[0055] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, A and B simultaneously, or B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.
[0056] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of electronic hardware and software. 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.
[0057] 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.
[0058] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0059] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for predicting measurement errors in smart meters, characterized in that, Includes the following steps: Metering error data and environmental characteristic data of sample smart meters under different environmental conditions are collected to form a measurement error sequence, and the measurement error sequence is preprocessed. Based on the preprocessed measurement error sequence, several environmental features with strong correlation to measurement errors are selected from the environmental feature data to form a subset of environmental variables; a training sample set is constructed using the subset of environmental variables. An error prediction model based on Transformer is constructed, including an input layer, a dual-path attention module, a feature fusion layer, and an output layer. The dual-path attention module extracts local features of the data input from the input layer within a short time window and global features within the entire time window through two attention layers. The feature fusion layer is used to fuse local and global features. The output layer outputs the prediction measurement error of the last time step based on the fused features. The error prediction model is trained using a training sample set, and the measurement error of the target smart meter is predicted using the trained error prediction model.
2. The method for predicting measurement errors in a smart meter according to claim 1, characterized in that, The specific steps for preprocessing the measurement error sequence are as follows: The original measurement error sequence is cleaned using a trend-constrained dynamic residual constant refinement method, the moving median is used to estimate the local trend, and the dynamic residuals are calculated. A robust normalized score is calculated by introducing the median absolute deviation, and abnormal candidate points are identified by setting a detection threshold. Combined with the local trend consistency condition, isolated pulse anomalies or anomaly segments are reconstructed and interpolated using adjacent trend information.
3. The method for predicting measurement errors in a smart meter according to claim 1, characterized in that, The specific steps for selecting several environmental features that are strongly correlated with measurement errors from environmental feature data are as follows: Based on the preprocessed measurement error sequence, the mutual information between each environmental feature and the measurement error is calculated and normalized. Based on the normalized mutual information values, each environmental feature is sorted, and the top N environmental features with the highest ranking are selected to construct a subset of environmental variables.
4. The method for predicting measurement errors in a smart meter according to claim 1, characterized in that, The input layer of the error prediction model is also used to add learnable location embeddings to the input data and perform layer normalization.
5. The method for predicting measurement errors in a smart meter according to claim 4, characterized in that, In the dual-path attention module, a causal attention layer is used to extract local features of the input data, and a self-attention layer without causal masking is used to extract global features of the input data.
6. The method for predicting measurement errors in a smart meter according to claim 5, characterized in that, The feature fusion layer introduces a gating mechanism to adaptively adjust the contribution of local features, and performs feature fusion calculation on local and global features based on the contribution to obtain fused features.
7. The method for predicting measurement errors in a smart meter according to claim 1, characterized in that, The error prediction model uses the mean squared error function as the loss function and employs the Adam optimizer for model training.
8. A smart meter measurement error prediction system, characterized in that, include: The data acquisition module is used to collect metering error data and environmental characteristic data of the sample smart meters under different environmental conditions, form a measurement error sequence, and preprocess the measurement error sequence. The sample construction module, based on the preprocessed measurement error sequence, selects several environmental features that are strongly correlated with the measurement error from the environmental feature data to form a subset of environmental variables; and constructs a training sample set through the subset of environmental variables. The model building module is used to build an error prediction model based on Transformer. It includes an input layer, a dual-path attention module, a feature fusion layer, and an output layer. The dual-path attention module extracts local features of the data input from the input layer within a short time window and global features within the entire time window through two attention layers. The feature fusion layer is used to fuse local and global features. The output layer outputs the prediction measurement error of the last time step based on the fused features. The error prediction module trains the error prediction model using a training sample set, and then uses the trained error prediction model to predict the measurement error of the target smart meter.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the smart meter measurement error prediction method as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the smart meter measurement error prediction method as described in any one of claims 1 to 7.
