A power data quality repairing method and device for quantity fee accounting

CN122885349APending Publication Date: 2026-10-09JIANGSU FRONTIER ELECTRIC TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611348157.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-02
Publication Date
2026-10-09

AI Technical Summary

Benefits of technology

[0023](1)破解“数值平滑”难题,实现负荷特征的高保真还原与计费精准化。本申请针对电力结算中最为核心的峰谷电价准确性问题,在自治愈算法中创新性地引入了梯度一致性损失与周期性约束。相比传统插值法或统计填补法,本申请能有效避免数据的“过度平滑”现象,在峰谷保持率上提升约15%,完整保留了用电负荷的瞬时波动特征与日周期规律。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122885349A_ABST
    Figure CN122885349A_ABST
Patent Text Reader

Abstract

The application discloses a power data quality repairing method and device for tariff accounting, and the method comprises the following steps: acquiring full-amount electrical data and environmental data of a target substation area in a power system operation process, and constructing a multi-dimensional time sequence tensor; evaluating the multi-dimensional time sequence tensor by using a dynamic weighted evaluation index system to obtain a comprehensive score; intelligently diagnosing to obtain a data diagnosis result according to the comprehensive score; the data diagnosis result comprises qualified data, mode abnormal data and structural missing data; for the mode abnormal data, a generative adversarial network model containing gradient consistency loss is used to reconstruct a load curve; for the structural missing data, a coupling model based on a graph attention network and a bidirectional long short-term memory network is used to complete spatio-temporal correlation, and repaired data is obtained; and residual error of the repaired data is tested, if the residual error is greater than or equal to a dynamic convergence threshold, a closed-loop feedback mechanism is triggered, and the process is repeated until the residual error is less than the dynamic convergence threshold.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of intelligent power system technology, specifically relating to a method and apparatus for power data quality repair based on cost accounting. Background Technology

[0002] With the deepening of smart grid construction and the ongoing reform of the power market, the amount of data generated by power metering systems is growing exponentially. In the context of electricity billing (volume-based billing), data quality directly affects the fairness and accuracy of electricity transactions; even minor data deviations can lead to huge economic disputes. However, due to uncontrollable factors such as communication interference, equipment failure, harsh environments, and human error, power metering data inevitably suffers from quality defects such as missing data, anomalies, and distortions during collection and transmission.

[0003] Traditional data quality processing methods, such as cubic spline interpolation, statistical imputation, and simple machine learning models, have significant limitations in practical applications. Interpolation methods are often based on assumptions of linear or deterministic laws, which can produce a "numerical smoothing" effect when faced with nonlinear abrupt changes in electricity load. This leads to the loss of instantaneous fluctuation characteristics in electricity data, causing serious settlement discrepancies, especially in peak-valley pricing scenarios. For example, while conventional LSTM-based restoration methods consider time-series characteristics, they often ignore the inherent spatial topological relationships of electricity data and cannot effectively handle structural missing data. Traditional machine learning methods lack explicit modeling of the physical constraints of the power system, resulting in restoration results lacking physical interpretability.

[0004] In summary, the relevant technologies have four main defects: First, they cannot effectively preserve the peak and valley characteristics of power load, directly affecting the accuracy of quantity-based billing; second, they ignore the topological correlation between metering devices within the distribution area and fail to fully utilize spatial correlation for completion; third, they lack a physical consistency verification mechanism for the repair results, making it difficult to monitor the repair quality; and fourth, they do not consider data privacy protection, posing a risk of sensitive information leakage.

[0005] Therefore, there is an urgent need for a power data quality assessment and self-healing solution that can comprehensively consider spatiotemporal correlation, physical constraints, preservation of statistical characteristics, and privacy protection. Summary of the Invention

[0006] Objective: In view of at least one of the above technical problems, this application provides a method and apparatus for power data quality repair based on cost accounting, so as to achieve high-fidelity repair of power metering data.

[0007] The technical solution adopted in this application is as follows:

[0008] Firstly, this application provides a method for power data quality restoration based on cost accounting, including:

[0009] Step S1: Obtain all electrical and environmental data of the target transformer area during the operation of the power system, and construct a multi-dimensional time series tensor of all metering devices in the transformer area at all sampling times;

[0010] Step S2: The multidimensional temporal tensor is evaluated using a dynamic weighted evaluation index system for surface-to-surface cost scenarios to obtain a comprehensive score; wherein, the dynamic weighted evaluation index system includes physical conservation index, temporal abruptness index, and lateral outlier index;

[0011] Step S3: Based on the comprehensive score of the multidimensional time series tensor, intelligent diagnosis is performed using dynamic thresholds to obtain data diagnosis results; among which, the data diagnosis results include qualified data, data with abnormal patterns, and data with missing structures.

[0012] Step S4: For data with anomalous patterns, a generative adversarial network model including gradient consistency loss is used to reconstruct the load curve to obtain the repaired data; for data with structural missing information, a coupled model based on graph attention network and bidirectional long short-term memory network is used to complete the spatiotemporal correlation to obtain the repaired data.

[0013] Step S5: Perform residual testing on the repaired data, and calculate the weighted Frobenius norm ratio between the repaired data and the original data within the masked region as the residual.

[0014] If the residual is less than the dynamic convergence threshold, the repaired data is deemed acceptable.

[0015] If the residual is greater than or equal to the dynamic convergence threshold, the closed-loop feedback mechanism is triggered: return to step S4, use backpropagation to fine-tune and update the model parameters, and re-execute steps S4 to S5 until the residual is less than the dynamic convergence threshold.

[0016] Secondly, this application provides a power data quality repair device for cost accounting, including a processor and a storage medium;

[0017] The storage medium is used to store instructions;

[0018] The processor is configured to operate according to the instructions to execute the method according to the first aspect.

[0019] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0020] Fourthly, this application provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect.

[0021] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the method described in the first aspect.

[0022] Compared with the prior art, this application has the following significant advantages: The power data quality repair method and apparatus for cost accounting provided in this application have the following advantages:

[0023] (1) Solving the problem of “numerical smoothing” and achieving high-fidelity restoration of load characteristics and accurate billing. This application addresses the most critical issue in electricity settlement, the accuracy of peak-valley electricity prices, by innovatively introducing gradient consistency loss and periodic constraints into the self-healing algorithm. Compared with traditional interpolation or statistical imputation methods, this application can effectively avoid the phenomenon of “over-smoothing” of data, improve the peak-valley retention rate by about 15%, and fully preserve the instantaneous fluctuation characteristics and daily cycle patterns of electricity load.

[0024] (2) Integrating spatiotemporal multidimensional correlations to construct a highly reliable self-healing closed loop under physical constraints. This application achieves a technological leap from a single time dimension to spatiotemporal multidimensional inference by coupling graph attention network (GAT) with bidirectional LSTM, which significantly improves the data reconstruction accuracy under extreme conditions such as long-term equipment downtime.

[0025] (3) Balancing governance efficiency and data security, and meeting the stringent privacy compliance requirements of the energy industry. This application constructs a full-link security defense system from the edge to the cloud, integrating cutting-edge desensitization technologies such as differential privacy noise injection, k-anonymization and l-diversity generalization at the beginning of data collection and processing, thereby achieving a balance between data availability and privacy protection. Attached Figure Description

[0026] Figure 1 This is a flowchart illustrating a power data quality repair method based on a method for calculating volumetric fees according to an embodiment of this application. Detailed Implementation

[0027] The present application will be further described below with reference to the accompanying drawings and embodiments. The following embodiments are only used to more clearly illustrate the technical solutions of the present application, and should not be used to limit the scope of protection of the present application.

[0028] In the description of this application, "several" means one or more, "multiple" means two or more, "greater than," "less than," and "exceeding" are understood to exclude the stated number, while "above," "below," and "within" are understood to include the stated number. The use of "first" and "second" in the description is merely for distinguishing technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the order of the indicated technical features.

[0029] In the description of this application, the terms "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0030] The term "and / or" simply describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0031] Example 1: This example provides a method for power data quality repair based on cost accounting, such as... Figure 1 As shown, it includes:

[0032] Step S1: Obtain all electrical and environmental data of the target transformer area during the operation of the power system, and construct a multi-dimensional time series tensor of all metering devices in the transformer area at all sampling times;

[0033] Step S2: The multidimensional temporal tensor is evaluated using a dynamic weighted evaluation index system for surface-to-surface cost scenarios to obtain a comprehensive score; wherein, the dynamic weighted evaluation index system includes physical conservation index, temporal abruptness index, and lateral outlier index;

[0034] Step S3: Based on the comprehensive score of the multidimensional time series tensor, intelligent diagnosis is performed using dynamic thresholds to obtain data diagnosis results; among which, the data diagnosis results include qualified data, data with abnormal patterns, and data with missing structures.

[0035] Step S4: For data with anomalous patterns, a generative adversarial network model including gradient consistency loss is used to reconstruct the load curve to obtain the repaired data; for data with structural missing information, a coupled model based on graph attention network and bidirectional long short-term memory network is used to complete the spatiotemporal correlation to obtain the repaired data.

[0036] Step S5: Perform residual testing on the repaired data, and calculate the weighted Frobenius norm ratio between the repaired data and the original data within the masked region as the residual.

[0037] If the residual is less than the dynamic convergence threshold, the repaired data is deemed acceptable.

[0038] If the residual is greater than or equal to the dynamic convergence threshold, the closed-loop feedback mechanism is triggered: return to step S4, use backpropagation to fine-tune and update the model parameters, and re-execute steps S4 to S5 until the residual is less than the dynamic convergence threshold.

[0039] The steps are explained in detail below.

[0040] Step S1: Obtain all electrical and environmental data of the target transformer area during the operation of the power system, and construct a multi-dimensional time series tensor of all metering devices in the transformer area at all sampling times;

[0041] The total electrical data includes voltage, current, active power, reactive power, harmonic distortion rate, and power factor angle; the environmental data includes ambient temperature.

[0042] In some embodiments, a 7-dimensional feature vector is constructed for each metering device at each sampling time:

[0043] ;

[0044] in, This represents the 7-dimensional feature vector collected by the metering device at time t. The voltage collected by the metering device at time t reflects the power grid voltage level. The current collected by the metering device at time t reflects the magnitude of the load current. The active power collected by the metering device at time t is the core metering parameter for quantity-based billing. Let t be the reactive power collected by the metering device at time t, reflecting the reactive power consumption characteristics of the load; The harmonic distortion rate collected by the metering device at time t reflects the power quality status. The power factor angle collected by the metering device at time t reflects the power factor characteristics of the load. Let t be the ambient temperature collected by the metering device at time t, used to compensate for the influence of temperature on the accuracy of the metering equipment.

[0045] The 7-dimensional feature vectors of all measuring devices at all sampling times are organized into a 3D temporal tensor. ;in, This represents the total number of metering devices within the station area. The number of feature dimensions for each metering device (in this embodiment) ), This is the length of the time series (i.e., the number of consecutive sampling points for each metering device in each feature dimension).

[0046] In some embodiments, before constructing the multidimensional time series tensor, preprocessing is performed on the full electrical and environmental data at the edge side, specifically including: performing outlier detection, normalization and missing label generation on the edge side for the full electrical and environmental data, and performing differential privacy noise injection and sensitive attribute generalization desensitization operations.

[0047] More specifically, this includes the following operations:

[0048] (1) Outlier removal. Based on the 3-sigma criterion, the original readings were initially screened and outliers were removed: the mean of each feature dimension within a preset time window was calculated. and standard deviation The deviation from the mean will exceed The readings are marked as statistical outliers and removed to avoid contaminating subsequent evaluation results with "outliers" caused by equipment malfunctions or electromagnetic interference.

[0049] (2) Dimensionless normalization. The Z-score normalization method is used to map electrical features of different dimensions to the same standard normal distribution interval: for each feature dimension, its mean and standard deviation are calculated, and the original value is subtracted from the mean and then divided by the standard deviation to make each feature dimension have the same scale, so as to avoid the problem of large numerical features dominating small numerical features in subsequent entropy weight evaluation and neural network training due to the difference in dimensions.

[0050] (3) Missing marker generation. A mask matrix for missing markers is generated synchronously based on the gaps in the data stream. The availability status of each data point is marked by binary elements: if the data of a point is normal, it is marked as 0; if the data of the point is missing or has been removed, it is marked as 1. This enables precise location of missing positions and provides location guidance for subsequent hierarchical diagnosis and targeted repair.

[0051] (4) Differential privacy noise injection. Differential privacy mechanisms are used to inject random noise conforming to a Laplace distribution into non-sensitive statistical data. The differential privacy noise injection and sensitive attribute generalization desensitization operations include:

[0052] Differential privacy mechanism is used to inject random noise conforming to the Laplace distribution into the collected full electrical and environmental data;

[0053] Perform k-anonymization on the user identifier attribute, where k is a positive integer not less than 5;

[0054] The geographic location information is generalized using the l-diversity method, where l is a positive integer not less than 3.

[0055] Through the aforementioned edge-side preprocessing and desensitization operations, the privacy leakage chain is completely blocked while preserving the statistical characteristics and spatial topological correlation of the data.

[0056] Step S2: Use the dynamic weighted evaluation index system of surface vector cost scenario to evaluate the multidimensional time series tensor to obtain a comprehensive score; wherein, the dynamic weighted evaluation index system includes physical conservation index, time series mutation index and lateral outlier index.

[0057] An evaluation index system comprising three core dimensions is constructed. Unlike traditional general evaluation methods, this application addresses the sensitivity of peak-valley electricity prices and the physical constraints of line loss in distribution areas under the context of quantity-based billing, completing scenario-specific adaptations for each index.

[0058] The comprehensive score of the dynamic weighted evaluation index system is expressed as follows:

[0059] ;

[0060] in, The comprehensive score is based on a dynamically weighted evaluation index system. As a physical conservation index, As an index of temporal abrupt change, As a horizontal outlier index, , , These are the weights corresponding to the three indicators.

[0061] In some embodiments, the weight , , The dynamic determination process includes: using information entropy to calculate the dispersion of physical conservation index, temporal mutation index and lateral outlier index, introducing anti-entropy weighting method to eliminate the negative impact of extreme value index on scoring, and combining the coefficient of variation of each index to perform real-time correction of weights, and constructing a dynamic weight matrix that reflects real-time business characteristics.

[0062] (1) Physical conservation index:

[0063] Data anomalies in metered billing scenarios primarily originate from abnormal current shunting caused by electricity theft and current leakage caused by poor contact in metering circuits. Both types of anomalies manifest at the data level as the inflow and outflow currents and zero-sequence current phasors at circuit nodes failing to satisfy Kirchhoff's Current Law (KCL). Traditional KCL verification is only applicable to ideal three-phase balanced operating conditions. However, three-phase imbalance is common in actual operation of low-voltage distribution areas, and directly applying traditional KCL verification can easily misjudge normal three-phase imbalance as data anomalies. Therefore, this application introduces a three-phase imbalance penalty factor based on KCL to construct a billing-level physical conservation index adapted to the actual operating conditions of low-voltage distribution areas. This index is used to identify abnormal active power flow caused by electricity theft or poor contact in metering circuits from the perspective of power system physical laws.

[0064] Based on Kirchhoff's current law, this application calculates in real time the vector difference between the three-phase currents (A, B, and C) and the zero-sequence current flowing into and out of the circuit nodes. It uses the degree to which the current residual of the circuit nodes deviates from the rated value to characterize the physical and logical reliability of the location of the metering device.

[0065] In some embodiments, the physical conservation index Represented as:

[0066] ;

[0067] in, It is the sum of the phasors of the three-phase currents A, B, and C flowing into the circuit node. This is the sum of the phasors of the three-phase currents A, B, and C flowing out of the circuit node. For zero-sequence current phasors, Represents the L2 norm, The rated current of the circuit node. To prevent extremely small positive numbers with a denominator of zero, this embodiment takes... ; This indicates taking the larger of the values. The three-phase current imbalance at the circuit node. This is the three-phase imbalance penalty coefficient, a dimensionless scalar with a value range of 0.1-0.3 (0.15 in this embodiment); it is used to adjust the weight of the influence of three-phase imbalance on the KCL residual. When the three-phase imbalance is large, the overall weight is multiplied by 0.1. The assessment values ​​are appropriately amplified to provide a more rigorous evaluation of data quality under severely unbalanced operating conditions.

[0068] It should be noted that, The L2 norm of the phasor difference maps a complex vector to a non-negative real scalar, representing the total magnitude of the current imbalance at the circuit nodes. Under ideal conditions, this value is 0; a larger value indicates a more significant deviation from the laws of physical conservation.

[0069] The physical conservation index It can identify abnormal active power flow caused by electricity theft and poor contact in metering circuits, and its residual calculation is more in line with the physical characteristics of transformer area line loss compared to traditional KCL. The smaller the value, the more the circuit node current data conforms to Kirchhoff's current law, and the higher the reliability of the physical logic.

[0070] (2) Temporal abrupt change index :

[0071] Electricity billing is highly sensitive to sudden load changes during peak-valley electricity price transitions, directly affecting the accuracy of billing. Traditional interpolation and statistical filling algorithms suffer from numerical smoothing effects when handling load abrupt changes, flattening load peaks and raising load troughs, leading to calculation errors during peak and valley periods. Existing wavelet transform-based data quality assessments mostly target single voltage or current channels; however, load abrupt changes are a physical process involving the coordinated response of multiple electrical parameters. Active power determines the magnitude of the change, voltage and current are used to distinguish between genuine and false changes, and harmonics and power factor characterize the nature of the change. Single-channel detection alone cannot distinguish between genuine load abrupt changes and false changes caused by data acquisition equipment failures. This application adopts an active power-dominated, multi-dimensional auxiliary fusion strategy, which, while preserving the characteristics of peak-valley load abrupt changes, filters out false changes caused by equipment failures through multi-dimensional physical consistency verification.

[0072] For 7-dimensional features (active power) ,Voltage Current reactive power Harmonic distortion rate Power factor angle Ambient temperature The db4 wavelet transform is performed on each feature in a 3-level decomposition. The high-frequency detail energy ratio of each feature is calculated, and asymmetric weighted fusion is performed to obtain the temporal abruptness index. Represented as:

[0073] ;

[0074] ;

[0075] ;

[0076] in, For the first The proportion of high-frequency detail energy in each feature For the first The wavelet detail coefficients of the j-th layer of features For the first The third-level approximation coefficient of each feature , , , , , , Active power ,Voltage Current reactive power Harmonic distortion rate Power factor angle Ambient temperature The proportion of high-frequency detail energy. , , For asymmetric fusion weights, The time-weighted factor; in some embodiments, the peak time period Take 1.2, for the normal period. Take 1.0, during the valley period. The weighting is increased to 0.8 to enhance the assessment of abnormal fluctuations in electricity prices during sensitive periods. The smaller the value, the more stable the time-series data of the metering device, the less interference from sudden changes, and the higher the data quality.

[0077] It should be noted that, The larger the value, the more significant the high-frequency mutation component of the feature is within the analysis window.

[0078] Weights satisfy In this embodiment, we take , , .

[0079] For example, a db4 wavelet is used to perform a three-level decomposition on the metering data, focusing on capturing the clustering features of high-frequency coefficients within the electricity price switching window (e.g., 8:00, 21:00). No wavelet transform is performed on the overall 7-dimensional features; instead, active power is used. The main core evaluation object is voltage. Current As an auxiliary verification object, reactive power Harmonic distortion rate Power factor angle Ambient temperature As a constraint marker object; active power is directly related to the electricity consumption result of the billing calculation; voltage and current are used to verify whether the active power change comes from the actual electricity consumption behavior. If the active power changes suddenly, but the voltage and current do not change synchronously, it is judged as a failure of the acquisition terminal; the constraint object does not participate in the main score of the change degree, and a correction mark is output when abnormal high-frequency disturbances occur during the peak-valley switching period.

[0080] (3) Horizontal outlier index:

[0081] Load changes of metering devices within the same distribution area and branch box exhibit group similarities, with residential users showing synchronous characteristics during evening peak hours and industrial users exhibiting synchronous high loads during daytime shifts. When the operating status of a single metering device significantly deviates from that of other metering devices at the same topological level, there is a high probability of equipment failure or data tampering. Traditional outlier detection calculates the global Euclidean distance for all metering devices in the distribution area, without considering differences in device capacity. Large-capacity devices are easily misclassified as outliers, while genuine failures and tampering cases are overlooked. This application avoids misjudgments caused by device capacity by relying on topological hierarchical structure and constructs an adaptive outlier threshold using the standard deviation of neighbor sets to accurately locate faults and data tampering behaviors.

[0082] This application, based on the topological hierarchical clustering results of the transformer substation, calculates the Euclidean distance deviation between the target metering device and adjacent metering devices in the 7-dimensional feature space only within the same topological level (e.g., meters under the same branch box), and the lateral outlier index. Represented as:

[0083] ;

[0084] in, This is a 7-dimensional feature vector of the target metering device, where the 7-dimensional features include voltage. Current Active power reactive power Harmonic distortion rate Power factor angle and ambient temperature ; The 7-dimensional feature vectors of adjacent metering devices, A set of adjacent metering devices. This represents the characteristic mean vector of all adjacent metering devices within the same topological level. It represents the standard deviation of the distance between the 7-dimensional feature vectors and the feature mean vectors of all adjacent metering devices within the same topological level.

[0085] The denominator is the sum of the maximum deviation distance and the standard deviation. When the dispersion of the neighborhood samples is high, the denominator automatically increases to suppress misjudgments caused by normal load differences. When the operating status of the neighborhood samples is highly similar, the denominator decreases, and even minor anomalies can amplify the index output to detect faults and tampering behavior. The smaller the value, the better the consistency between the target metering device and its neighboring data at the same level, the lower the degree of lateral outlier, and the higher the data quality.

[0086] (4) Method for dynamically determining weights

[0087] Physical conservation, temporal abrupt change, and lateral outlier characteristics characterize data quality from the perspectives of physical laws, time dimension, and spatial dimension, respectively. The distinguishing ability of these three indicators dynamically changes across different transformer substations, seasons, and operating periods. In summer, concentrated air conditioning loads and prominent three-phase imbalance disturbances increase the importance of the physical conservation indicator. In winter, concentrated heating loads and abrupt peak-valley variations intensify, increasing the importance of the temporal abrupt change indicator. In scenarios where user load patterns are highly similar across transformer substations, the distinguishing ability of lateral outlier characteristics decreases, and its weight should be reduced. Conventional entropy weighting methods automatically assign weights based on data dispersion; extreme sample values ​​can cause a sharp drop in entropy, leading to an overemphasis on indicator weights and a veto effect. This application employs an anti-entropy weighting method to suppress extreme sample interference and incorporates a sliding window variation coefficient for real-time correction, ensuring that the weights match the distinguishing ability under current operating conditions while considering both resistance to extreme samples and adaptive characteristics to operating conditions.

[0088] Step S3: Comprehensive scoring based on multidimensional temporal tensors Intelligent diagnosis is performed using dynamic thresholds to obtain data-based diagnostic results; wherein, the dynamic thresholds include a first threshold. Second threshold The data diagnostic results include qualified data, data with abnormal patterns, and data with missing structures.

[0089] like The data was deemed acceptable.

[0090] like This data was identified as having an abnormal pattern.

[0091] like This was determined to be structurally missing data;

[0092] in, The first threshold, This is the second threshold.

[0093] The dynamic threshold is dynamically calculated based on the quality score distribution of normal data from the same historical period; furthermore, the 75th percentile of the quality score of normal data from the same historical period is used as the first threshold. The 25th percentile is used as the second threshold. .

[0094] Step S4: For data with anomalous patterns, a generative adversarial network model including gradient consistency loss is used to reconstruct the load curve to obtain the repaired data; for data with structural missing information, a coupled model based on graph attention network and bidirectional long short-term memory network is used to complete the spatiotemporal correlation to obtain the repaired data.

[0095] In some embodiments, in step S4, for structurally missing data, a coupled model based on graph attention network and bidirectional long short-term memory network is used for spatiotemporal correlation completion, including:

[0096] Metering devices within the transformer area are mapped as graph vertices. An edge set is constructed based on the line loss topology of the transformer area, forming an adjacency matrix. The edge weights are determined based on the electrical distance between vertices.

[0097] The spatial weight contribution of adjacent vertices to the target vertex in the power grid topology is calculated using the graph attention mechanism. An electrical distance bias term is introduced into the attention coefficient, and the conductor impedance and geographical distance are integrated as prior guidance.

[0098] The formula for calculating the attention coefficient is:

[0099] ;

[0100] in, As vertices With vertex Attention coefficient between, This represents the LeakyReLu activation function. This is a learnable attention weight vector. This is the transpose of the learnable attention weight vector. Represents the learnable weight matrix. , Vertices ,vertex Features This represents a vector concatenation operation; Represents a vertex and vertex The features are then linearly transformed and concatenated. For physical bias weights, As vertices With vertex Electrical distance between To prevent the logarithmic operation from diverging to extremely small positive numbers; further, in this embodiment... Take 0.3, Pick ;

[0101] A bidirectional long short-term memory network captures the time series correlation before and after the missing position, a forward LSTM captures the trend from the past to the future, and a backward LSTM captures the retrospective information from the future to the past. The outputs of the two are concatenated and then linearly mapped to obtain the complete value.

[0102] An iterative completion strategy is adopted, in which the completed values ​​are resubmitted into the graph structure and the process is repeated until the rate of change of the mask region loss is less than a preset threshold.

[0103] For example, in this embodiment, a coupled model based on graph attention network and bidirectional long short-term memory network is used:

[0104] There are a total of [number] units within the [area name] area. Each of the following measuring devices is used at a specific time. collection Electrical characteristics (voltage) Current Active power reactive power Harmonic distortion rate Power factor angle Ambient temperature The time window length is Structural missing data is defined as data that is completely missing at three or more consecutive time points.

[0105] The model input includes: the original data tensor The missing positions are determined by the generated mask matrix. Indicator; Topological adjacency matrix of transformer substations , Indicates metering device and There is an electrical connection between them. This indicates no direct connection. The model output is the completed data tensor. The original missing positions are filled with predicted values, while the original normal positions remain unchanged.

[0106] This model adopts a coupled architecture of "physically guided graph attention network (GAT) + bidirectional long short-term memory network (BiLSTM)".

[0107] Model training:

[0108] (1) Training data preparation: Extract complete data from historically operating transformer substations that have been manually reviewed and confirmed to be free of anomalies. A metering device in Data from consecutive time points were used as training samples. A self-supervised masking training strategy was adopted: a subset of data points were randomly selected for masking, the masked data was used as model input, and the original real data was used as the prediction target. The prediction error was calculated and backpropagated to update the model parameters. The masking types used in training included random masking (randomly masking 5% to 20% of data points to simulate random data loss), continuous masking (continuously masking all features from 3 to 12 time points to simulate structural loss due to communication interruption), and block masking (masking partial feature dimensions from 3 to 5 consecutive time points to simulate partial channel failure). These three masking types were used in a mixed ratio during training to enhance the model's adaptability to different loss patterns. The training set and validation set were divided in an 8:2 ratio.

[0109] (2) Overall loss function for model training for:

[0110] ;

[0111] Where: reconstruction loss The mean square error of the masked region is used to measure the deviation between the completed value and the true value; physical constraint loss. The KCL residuals of the completed data are used to force the completion result to conform to Kirchhoff's current law; regularization loss is also used. : Regularization term, , For all trainable parameters of the model A set of rules used to prevent overfitting; The physical constraint loss weight is set to 0.1. For regularization weights (take) ).

[0112] (3) Optimizer and training parameters

[0113] The Adam optimizer is used, with an initial learning rate set to The learning rate decays to 0.9 times its current value after every 50 training epochs. The batch size is set to 32, the maximum number of training epochs is 300, and an early stopping strategy is adopted (training stops when the validation set loss does not decrease for 20 consecutive training epochs). The weights of GAT and BiLSTM are initialized using a Xavier uniform distribution, and the bias is initialized to 0.

[0114] Training is completed on a cloud GPU server (NVIDIA A100 40GB). After training, the model parameters are fixed and deployed to an edge-side intelligent fusion terminal for inference.

[0115] In some embodiments, step S4 involves reconstructing the load curve using a generative adversarial network model incorporating gradient consistency loss for the pattern anomaly data, including:

[0116] A generative adversarial network (GAN) model is constructed, which includes a generator and a discriminator. The generator loss function consists of four parts: adversarial loss, reconstruction loss, gradient consistency loss, and periodic constraint loss.

[0117] Gradient consistency loss is used to force the generated data to maintain the same rate of change as the original load, so as to preserve the peak and valley abrupt characteristics of the power load.

[0118] Periodic constraints are used to ensure that the generated curve conforms to the daily cycle of electricity consumption.

[0119] For example, in this embodiment, an adversarial network model is generated:

[0120] Abnormal data refers to measurement sequences that are structurally complete (without missing values) but have amplitude drift or morphological distortion—the data are close to the normal load curve in overall trend, but the numerical range deviates from the historical normal level, or the curve shape undergoes atypical changes.

[0121] The input consists of two parts: anomaly data tensor (Includes only data points identified as pattern anomalies, with complete structure), and the statistical characteristics of the historical normal data of the metering device (mean). Standard deviation Typical daily curve template The output is the reconstructed corrected data tensor. In this process, outlier points are replaced by generated values, while the remaining points remain unchanged.

[0122] This model employs a Generative Adversarial Network (GAN) architecture, which consists of two adversarial neural networks: a generator and a discriminator.

[0123] (1) Generator network structure

[0124] The generator is responsible for mapping random noise and conditional information to the reconstructed load curve. This application adopts a conditional GAN ​​architecture, using the contextual information of the anomalous data (i.e., normal data adjacent to the anomalous points) as conditional input.

[0125] The generator uses an encoder-decoder structure:

[0126] Encoder:

[0127] Input layer: Acceptance dimension is The input tensor (containing the context window of the outlier data, with a window size of ) (This corresponds to 24 hours of data, with one sampling point every 15 minutes).

[0128] One-dimensional convolutional layer 1: Input channel The output channel is 64, the kernel size is 5, the stride is 2, the padding is 2, followed by BatchNorm and ReLU activation;

[0129] One-dimensional convolutional layer 2: 64 input channels, 128 output channels, kernel size 5, stride 2, padding=2, followed by BatchNorm and ReLU activation;

[0130] One-dimensional convolutional layer 3: 128 input channels, 256 output channels, kernel size 5, stride 2, padding=2, followed by BatchNorm and ReLU activation;

[0131] Bottleneck layer: Dimension Output encoded feature vector (Use global average pooling).

[0132] Decoder:

[0133] Fully connected layer: encodes features Mapped to Feature map;

[0134] One-dimensional transposed convolutional layer 1: 256 input channels, 128 output channels, kernel size 5, stride 2, followed by BatchNorm and ReLU activation;

[0135] One-dimensional transposed convolutional layer 2: 128 input channels, 64 output channels, kernel size 5, stride 2, followed by BatchNorm and ReLU activation;

[0136] One-dimensional transposed convolutional layer 3: 64 input channels, 64 output channels The convolution kernel size is 5, the stride is 2, followed by Tanh activation (output normalized to...). (Interval).

[0137] Generator output reconstructed load curve The momentum parameter for all BatchNorm layers in the generator is set to 0.9.

[0138] (2) Discriminator network structure

[0139] The discriminator is responsible for distinguishing whether the input is real data or data generated by the generator.

[0140] Input layer: Acceptance dimension is The input tensor (real curve or generated curve);

[0141] One-dimensional convolutional layer 1: Input channel The output channel is 64, the kernel size is 5, the stride is 2, the padding is 2, and it is followed by LeakyReLU activation (negative slope 0.2).

[0142] One-dimensional convolutional layer 2: 64 input channels, 128 output channels, kernel size 5, stride 2, padding=2, followed by BatchNorm and LeakyReLU activation (negative slope 0.2).

[0143] One-dimensional convolutional layer 3: 128 input channels, 256 output channels, kernel size 5, stride 2, padding=2, followed by BatchNorm and LeakyReLU activation (negative slope 0.2).

[0144] Fully connected layer: Flattens the convolutional output and maps it to a 1-dimensional scalar, then activates it with a sigmoid function to output the discriminant probability. .

[0145] Overall loss function of the generator It consists of four parts:

[0146] ;

[0147] Among them: counter-loss The least squares GAN (LSGAN) adversarial loss method is used to make training more stable.

[0148] Reconstruction loss Measure the difference between the generated curve and the target curve (i.e., normal reference data available near the outlier).

[0149] Gradient consistency loss The fundamental reason for the "numerical smoothing" effect produced by traditional interpolation methods is that they only focus on the accuracy of the numerical value itself, while ignoring the dynamic characteristics of numerical changes. This application forces the generated data to maintain the same rate of change as the original normal data at adjacent time points through gradient consistency loss, effectively preserving the load jump characteristics during peak load periods.

[0150] Periodic constraints The electricity load curve exhibits a clear daily cycle pattern—residential electricity consumption shows a double-peak characteristic in the morning and evening, while industrial electricity consumption shows a high load characteristic during the daytime. Periodic constraints, by introducing a daily cycle alignment regularization term, ensure that the repaired load curve conforms to the daily cycle pattern of electricity consumption.

[0151] The values ​​of each loss weight are: , , The weight values ​​were obtained through grid search on the validation set.

[0152] Training process:

[0153] (1) Training data preparation

[0154] Complete load curves, manually reviewed and confirmed to be anomaly-free, are extracted from historically operating transformer data to serve as true samples (positive samples). Abnormal curves identified as "mode anomalies" in step S3 are extracted as negative samples. Simultaneously, augmented negative samples are constructed based on normal curves by artificially adding amplitude offsets (±10% to ±30%) and time-series distortions (local time axis scaling) to enhance the model's generalization ability. The training, validation, and test sets are divided in a 7:1.5:1.5 ratio.

[0155] (2) The adversarial training strategy adopts an alternating training strategy: the generator is trained once after each training of the discriminator. The batch size is set to 64, and the initial learning rate is set to... The Adam optimizer is used, with a first moment decay factor of 0.5 and a second moment decay factor of 0.999. The maximum number of training epochs is 500, and an early stopping strategy is adopted (training stops when the generator loss does not decrease for 30 consecutive training epochs).

[0156] (3) Training stabilization measures: To prevent mode collapse and gradient vanishing, the following measures are taken: LSGAN loss is used to replace the cross-entropy loss of traditional GAN; BatchNorm is used in all discriminators (except for the input and output layers); Dropout (dropout rate 0.1) is used in the generator; Label smoothing: the labels of real samples are smoothed from 1 to 0.9, and the labels of generated samples are smoothed from 0 to 0.1.

[0157] Training is completed on a cloud GPU server. After training, the generator parameters are fixed and deployed to an edge-side intelligent fusion terminal for inference.

[0158] Step S5: Perform residual testing on the repaired data, calculate the weighted Frobenius norm ratio of the repaired data and the original data within the masked region, and use this ratio as the residual. :

[0159] ;

[0160] in, For the repaired data, The original data before repair. For the mask matrix, This represents the total number of metering devices within the station area. The number of feature dimensions for each metering device, The value represents the length of the time series. "1" indicates that the location was identified as an area requiring repair, while "0" indicates that the location was originally acceptable. For element-wise multiplication, It is the Frobenius norm. To prevent values ​​with a denominator of zero.

[0161] If residuals The repaired data was deemed acceptable. This is the dynamic convergence threshold.

[0162] If residuals This triggers a closed-loop feedback mechanism: returning to step S4, fine-tuning the model parameters using backpropagation, and re-executing steps S4 to S5 until... .

[0163] It should be noted that the purpose of residual testing is to quantify the degree of deviation between the repaired data and the original available data within the repair area, thereby determining whether the repair results have statistical convergence.

[0164] In this embodiment, the dynamic convergence threshold is determined based on the 95th percentile of the residual values ​​of the current transformer area's recent normal historical data. The reason for using 95% instead of the maximum value is that allowing the current repaired residual to fall within 95% of the historical normal fluctuation range is considered acceptable, avoiding an overly broad threshold due to individual extreme historical samples; under the assumption of a standard normal distribution, the 95th percentile corresponds to approximately 1.645 times the standard deviation. A typical value range is... When the distribution area is operating stably and the data quality is high, the historical residual distribution is concentrated, and the threshold can be as low as 0.03; when the load of the distribution area fluctuates drastically and the accuracy of the metering equipment is limited, the threshold can be relaxed to 0.08.

[0165] The dynamic convergence threshold is recalculated every 30 days, using historical data from the most recent 30 days as a window for sliding updates, so that the threshold can be adaptively adjusted to follow the long-term operating characteristics of the transformer area (such as equipment aging and changes in load structure).

[0166] After passing the residual test, qualified data is marked as "reliable" and input into the electricity billing engine as the basic data source for quantity-based billing and transformer area line loss analysis. The input data is simultaneously written back to the historical database as samples for subsequent residual threshold updates and model iteration training.

[0167] Example 2: Based on Example 1, this example provides a power data quality repair device for cost-based accounting, including a processor and a storage medium;

[0168] The storage medium is used to store instructions;

[0169] The processor is configured to operate according to the instructions to execute the method according to Embodiment 1.

[0170] Example 3: Based on Example 1, this example provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in Example 1.

[0171] Example 4: Based on Example 1, this example provides a computer device, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described in Example 1.

[0172] Example 5: Based on Example 1, this example provides a computer program product, including a computer program that, when executed by a processor, implements the method described in Example 1.

[0173] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0174] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0175] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0176] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0177] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for power data quality restoration based on cost accounting, characterized in that, include: Step S1: Obtain all electrical and environmental data of the target transformer area during the operation of the power system, and construct a multi-dimensional time series tensor of all metering devices in the transformer area at all sampling times; Step S2: The multidimensional temporal tensor is evaluated using a dynamic weighted evaluation index system for surface-to-surface cost scenarios to obtain a comprehensive score; wherein, the dynamic weighted evaluation index system includes physical conservation index, temporal abruptness index, and lateral outlier index; Step S3: Based on the comprehensive score of the multidimensional time series tensor, intelligent diagnosis is performed using dynamic thresholds to obtain data diagnosis results; among which, the data diagnosis results include qualified data, data with abnormal patterns, and data with missing structures. Step S4: For data with anomalous patterns, a generative adversarial network model including gradient consistency loss is used to reconstruct the load curve to obtain the repaired data; for data with structural missing information, a coupled model based on graph attention network and bidirectional long short-term memory network is used to complete the spatiotemporal correlation to obtain the repaired data. Step S5: Perform residual testing on the repaired data, and calculate the weighted Frobenius norm ratio between the repaired data and the original data within the masked region as the residual. If the residual is less than the dynamic convergence threshold, the repaired data is deemed acceptable. If the residual is greater than or equal to the dynamic convergence threshold, the closed-loop feedback mechanism is triggered: return to step S4, use backpropagation to fine-tune and update the model parameters, and re-execute steps S4 to S5 until the residual is less than the dynamic convergence threshold.

2. The method according to claim 1, characterized in that, The total electrical data includes voltage, current, active power, reactive power, harmonic distortion rate, and power factor angle; the environmental data includes ambient temperature. For each metering device, a 7-dimensional feature vector is constructed at each sampling time: ; in, This represents the 7-dimensional feature vector collected by the metering device at time t. Let t be the voltage collected by the metering device at time t. Let t be the current collected by the metering device at time t. Let t be the active power collected by the metering device at time t. Let t be the reactive power collected by the metering device. Let t be the harmonic distortion rate collected by the metering device at time t. Let t be the power factor angle collected by the metering device at time t. Let t be the ambient temperature collected by the metering device at time t; The 7-dimensional feature vectors of all measuring devices at all sampling times are organized into a 3D temporal tensor. ;in, This represents the total number of metering devices within the station area. The number of feature dimensions for each metering device, This represents the length of the time series.

3. The method according to claim 1, characterized in that, Before constructing the multidimensional time series tensor, preprocessing is performed on the full electrical and environmental data at the edge. Specifically, this includes performing outlier detection, normalization, and missing data marker generation on the edge for the full electrical and environmental data, as well as performing differential privacy noise injection and sensitive attribute generalization desensitization operations. The differential privacy noise injection and sensitive attribute generalization desensitization operations include: Differential privacy mechanism is used to inject random noise conforming to the Laplace distribution into the collected full electrical and environmental data; Perform k-anonymization on the user identifier attribute, where k is a positive integer not less than 5; The geographic location information is generalized using the l-diversity method, where l is a positive integer not less than 3.

4. The method according to claim 1, characterized in that, The comprehensive score of the dynamic weighted evaluation index system is expressed as follows: ; in, The comprehensive score is based on a dynamically weighted evaluation index system. As a physical conservation index, As an index of temporal abrupt change, As a horizontal outlier index, , , These are the weights corresponding to the three indicators.

5. The method according to claim 1, characterized in that, The physical conservation index Represented as: ; in, It is the sum of the phasors of the three-phase currents A, B, and C flowing into the circuit node. This is the sum of the phasors of the three-phase currents A, B, and C flowing out of the circuit node. For zero-sequence current phasors, Represents the L2 norm, The rated current of the circuit node. To prevent extremely small positive numbers with a denominator of zero, This indicates taking the larger of the values. The three-phase current imbalance at the circuit node. This is the penalty coefficient for three-phase imbalance; And / or, temporal abrupt change index The temporal abruptness index is obtained by performing a 3-level decomposition of each feature in the multidimensional temporal tensor using db4 wavelet transform, calculating the high-frequency detail energy proportion of each feature, and then performing asymmetric weighted fusion. Represented as: ; ; ; in, For the first The proportion of high-frequency detail energy in each feature For the first The wavelet detail coefficients of the j-th layer of features For the first The third-level approximation coefficient of each feature , , , , , , Active power ,Voltage Current reactive power Harmonic distortion rate Power factor angle Ambient temperature The proportion of high-frequency detail energy. , , For asymmetric fusion weights, The time-weighted factor; And / or, Lateral Outlier Index: Based on the topological hierarchical clustering results of the transformer area, the Euclidean distance deviation between the target metering device and its neighboring metering devices in each feature space of the multidimensional time-series tensor is calculated only within the same topological level. Represented as: ; in, This is a 7-dimensional feature vector of the target metering device, where the 7-dimensional features include voltage. Current Active power reactive power Harmonic distortion rate Power factor angle and ambient temperature ; The 7-dimensional feature vectors of adjacent metering devices, A set of adjacent metering devices. This represents the characteristic mean vector of all adjacent metering devices within the same topological level. It represents the standard deviation of the distance between the 7-dimensional feature vectors and the feature mean vectors of all adjacent metering devices within the same topological level.

6. The method according to claim 1, characterized in that, Step S3: Comprehensive scoring based on multidimensional temporal tensors Intelligent diagnosis using dynamic thresholds yields data-driven diagnostic results, including: like The data was deemed acceptable. like This data was identified as having an abnormal pattern. like This was determined to be structurally missing data; in, The first threshold, The second threshold; The dynamic threshold is dynamically calculated based on the quality score distribution of normal data from the same historical period; furthermore, the 75th percentile of the quality score of normal data from the same historical period is used as the first threshold. The 25th percentile is used as the second threshold. .

7. The method according to claim 1, characterized in that, For structurally missing data, a coupled model based on graph attention network and bidirectional long short-term memory network is used for spatiotemporal correlation completion, including: Metering devices within the transformer area are mapped as graph vertices. An edge set is constructed based on the line loss topology of the transformer area, forming an adjacency matrix. The edge weights are determined based on the electrical distance between vertices. The spatial weight contribution of adjacent vertices to the target vertex in the power grid topology is calculated using the graph attention mechanism. An electrical distance bias term is introduced into the attention coefficient, and the conductor impedance and geographical distance are integrated as prior guidance. The formula for calculating the attention coefficient is: ; in, As vertices With vertex Attention coefficient between, This represents the LeakyReLu activation function. This is a learnable attention weight vector. This is the transpose of the learnable attention weight vector. Represents the learnable weight matrix. , Vertices ,vertex Features This represents a vector concatenation operation; Represents a vertex and vertex The features are then linearly transformed and concatenated. For physical bias weights, As vertices With vertex Electrical distance between To prevent logarithmic operations from diverging to the smallest positive numbers; A bidirectional long short-term memory network captures the time series correlation before and after the missing position, a forward LSTM captures the trend from the past to the future, and a backward LSTM captures the retrospective information from the future to the past. The outputs of the two are concatenated and then linearly mapped to obtain the complete value. An iterative completion strategy is adopted, in which the completed values ​​are resubmitted into the graph structure and the process is repeated until the rate of change of the mask region loss is less than a preset threshold.

8. The method according to claim 1, characterized in that, For data exhibiting anomalous patterns, a generative adversarial network model incorporating gradient consistency loss is used to reconstruct the load curve, including: A generative adversarial network (GAN) model is constructed, which includes a generator and a discriminator. The generator loss function consists of four parts: adversarial loss, reconstruction loss, gradient consistency loss, and periodic constraint loss. Gradient consistency loss is used to force the generated data to maintain the same rate of change as the original load, so as to preserve the peak and valley abrupt characteristics of the power load. Periodic constraints are used to ensure that the generated curve conforms to the daily cycle of electricity consumption.

9. The method according to claim 1, characterized in that, Calculate the weighted Frobenius norm ratio of the repaired data to the original data within the masked region, and use this as the residual. , is represented as: ; in, For the repaired data, The original data before repair. For the mask matrix, This represents the total number of metering devices within the station area. The number of feature dimensions for each metering device, The value represents the length of the time series. "1" indicates that the location is identified as an area that needs repair, while "0" indicates that the location was originally qualified. For element-wise multiplication, It is the Frobenius norm. To prevent values ​​with a denominator of zero.

10. A power data quality repair device based on cost accounting, characterized in that, Including processor and storage media; The storage medium is used to store instructions; The processor is configured to operate according to the instructions to perform the method according to any one of claims 1 to 9.