Power grid data processing method and system

By constructing noise and missing matrices, and combining spatiotemporal attention networks and physical rule loss functions, the problem of outliers and missing values ​​in power grid data was solved, achieving efficient data processing and improved accuracy.

CN122020534APending Publication Date: 2026-05-12TONGCHUAN POWER SUPPLY CO OF STATE GRID SHAANXI ELECTRIC POWER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TONGCHUAN POWER SUPPLY CO OF STATE GRID SHAANXI ELECTRIC POWER CO LTD
Filing Date
2026-01-27
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

The data collected by the power grid integration terminal suffers from problems such as non-standard data and inconsistent formats, outlier interference, and missing data, which makes it impossible to guarantee the reliability of the data and affects the accuracy and safety of power grid operation.

Method used

A noise matrix and a vacancy matrix are constructed. Power grid data is processed through a spatiotemporal attention network. Combined with a physical rule loss function, outlier removal and vacancy filling are achieved, and electrical and environmental features are fused.

Benefits of technology

It improves the accuracy of anomaly detection, reduces the risk of misjudgment, and enhances the credibility of power grid data and the reliability of engineering applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122020534A_ABST
    Figure CN122020534A_ABST
Patent Text Reader

Abstract

The invention discloses a power grid data processing method and system, and the method comprises the steps: constructing a noise matrix and a vacancy matrix based on power grid data, obtaining an input matrix based on the noise matrix and the vacancy matrix, and obtaining the time-space fusion features of the power grid data based on the input matrix; the space-time fusion features of the power grid data are added into the vacancy matrix, electrical features and environmental features are separated from the vacancy matrix, a high-frequency environmental quantity predicted value is generated based on the environmental features, and the high-frequency environmental quantity predicted value and the electrical features are aligned on a time axis; fusing the high-frequency environment quantity predicted value with the electrical characteristics to obtain fused characteristics; and explicitly embedding a physical rule loss function into a loss function of a space-time attention network, and processing the fusion feature based on the space-time attention network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power distribution network technology, and in particular to a power grid data processing method and system. Background Technology

[0002] With the rapid development of smart grids, grid integration terminals (such as distribution network smart terminals and IoT sensing devices) are widely deployed in various stages of power generation, transmission, substation, distribution, and consumption, serving as core nodes for data acquisition. This enables the real-time collection and transmission of massive amounts of data on grid operation status, equipment conditions, and environmental parameters. However, due to factors such as differences in equipment performance, communication interference, environmental noise, and human error, the data collected by these terminals generally suffers from problems such as non-standardized and inconsistent formats, outlier interference, and missing data. Non-standardized and inconsistent formats increase data preprocessing costs, reduce analysis efficiency, and can even lead to misjudgments due to unit confusion (e.g., incorrect alarms due to exceeding temperature thresholds). Outlier interference can distort statistical characteristics (e.g., mean and variance), leading to model training bias and even triggering false alarms (e.g., malfunctioning equipment overload protection). Missing data disrupts the temporal integrity of the data, affecting the accuracy of trend analysis (e.g., load forecasting) and state estimation (e.g., power flow calculation). For these problems, the lack of unified data quality assessment standards in current technologies makes it difficult to quantify indicators such as data integrity, accuracy, and consistency, resulting in a lack of data reliability. Downstream applications (such as fault diagnosis and optimized scheduling) may make incorrect decisions based on low-quality data, increasing the risk to power grid operation. Summary of the Invention

[0003] In response to the problems raised in the background art, the present invention provides a power grid data processing method and system to solve the problems of non-standard and inconsistent data formats, outlier interference and data loss in the data collected by the power grid convergence terminal, thereby improving the accuracy of anomaly detection.

[0004] One technical solution disclosed in this invention is:

[0005] A power grid data processing method, comprising: A noise matrix and a vacancy matrix are constructed based on the power grid data. An input matrix is ​​obtained based on the noise matrix and the vacancy matrix. The spatiotemporal fusion features of the power grid data are obtained based on the input matrix. The spatiotemporal fusion features of the power grid data are added to the gap matrix, and electrical features and environmental features are separated from the gap matrix. High-frequency environmental quantity prediction values ​​are generated based on the environmental features, and the high-frequency environmental quantity prediction values ​​are aligned with the electrical features on the time axis. The high-frequency environmental quantity prediction values ​​and the electrical features are fused to obtain fused features. The physical rule loss function is explicitly embedded into the loss function of the spatiotemporal attention network, and the fused features are processed based on the spatiotemporal attention network.

[0006] Furthermore, the construction of the noise matrix and the vacancy matrix based on the power grid data includes: Based on the physical constraints corresponding to different power grid data, abnormal data of the power grid data are determined, and a noise matrix is ​​constructed based on the abnormal data of the power grid data. A power grid topology graph is constructed based on the device ID and the physical connection of the device. The smoothness of the graph signal of the power grid topology graph is calculated to obtain the local graph smoothness anomaly score. A vacancy matrix is ​​obtained based on the local graph smoothness anomaly score.

[0007] Furthermore, obtaining the spatiotemporal fusion features of the power grid data based on the input matrix includes: extracting the spatial dimension features of the power grid data based on the input matrix; extracting the temporal dimension features of the power grid data based on the spatial dimension features of the power grid data; and fusing the spatial dimension features and temporal dimension features of the power grid data into the spatiotemporal fusion features of the power grid data.

[0008] Furthermore, the step of determining abnormal data of the power grid data based on the physical constraints corresponding to different power grid data, and constructing a noise matrix based on the abnormal data of the power grid data, includes: Determine the tolerance coefficient corresponding to the power grid data based on different power grid data; Traverse the power grid data and determine outlier data in the power grid data based on the tolerance coefficient; Set the abnormal data to NAN and construct a noise matrix; The noise matrix is ​​composed of The device is At each time step Composition of dimensional feature observation sequences.

[0009] Furthermore, the formula for calculating the local graph smoothness anomaly score is as follows: ; in, Indicates the first One feature in Time, equipment Local plot smoothness anomaly score, Indicates device exist Time characteristics The actual observed value, Indicates device The set of first-order neighbor devices, Indicate neighboring devices Observations at the same time, Indicates device With neighboring devices Normalized spatial weights between them; The process of obtaining the missing matrix based on the local graph smoothness anomaly score includes: Set an exception threshold ; like If so, it is considered abnormal. Set to null values ​​to obtain the empty matrix. .

[0010] Furthermore, obtaining the input matrix based on the noise matrix and the missing matrix includes: Construct a binary mask matrix based on the noise matrix; Use zero values ​​to fill empty matrices Fill in the missing values ​​to obtain the initialized tensor. ; Initialize the tensor The input matrix is ​​obtained by concatenating the binary mask matrix along its feature dimension. ; The spatiotemporal fusion features of the power grid data obtained based on the input matrix include: computing devices With neighboring devices The correlation coefficient between them is calculated using the following formula: ; in, For neighboring devices For equipment Importance coefficient, Representing the equipment and neighboring equipment eigenvectors, The weight matrix is ​​a learnable linear transformation. For learnable attention vectors, It is a non-linear activation function; The coefficients are normalized using the Softmax function to obtain the final attention weights. ; Multi-weighted aggregation: ; in, For equipment High-dimensional feature representation that integrates spatial information from the neighborhood. For feature splicing operations, It is a non-linear activation function. For the number of attention heads, For the first Normalized attention weights calculated from each attention head For the first The weight matrix of each attention head, For neighboring devices eigenvectors.

[0011] All devices across the network At all times aggregation features Stack them to form a spatial feature tensor ; Feature extraction based on Bi-LSTM network: ; ; ; in, For spatial feature tensors At any moment slices, For at any time The spatiotemporal fusion characteristics of the power grid data For a moment The forward hidden state, For a moment The forward hidden state, For a moment The backward hidden state, For a moment The backward hidden state.

[0012] Furthermore, the step of generating high-frequency environmental quantity prediction values ​​based on the environmental characteristics includes: MLP is used to analyze low-frequency environmental observations. Mapping to the latent state space yields the latent states of the environmental observations at low-frequency moments; Using the potential state of environmental observations at low-frequency times as the initial value, the potential state of environmental observations at high-frequency target times is derived by integration using the ODE solver. The potential state of environmental observations at high-frequency target times is the predicted value of high-frequency environmental quantities. The derivation formula is as follows: ; in, It is a parameterized neural network. Represents the initial potential state. Let be the integration variable, representing the integral from... arrive continuous time, An intermediate state represents a single instant on the integration path. The potential state.

[0013] Furthermore, the expression for the physical rule loss function is: ; in, For physical rule loss function, For power flow equation constraints. Constrained by Kirchhoff's current law, Constrained by Ohm's law, To implement boundary constraints, The weight parameters are adaptively determined through a dynamic weight adjustment mechanism. The expression for the power flow equation constraint is: ; in, Indicates power, Indicates voltage. Represents current. Indicates the number of devices. Represents the square of the L2 norm; The expression for the Kirchhoff's law constraint is: ; in, Indicates from device Flow to equipment The branch current value, Indicates from device Flow to equipment The branch current value; The expression for the Ohm's law constraint is: ; in, This represents the total number of lines in the power grid. Indicates device The voltage phasor difference at both ends, Indicates from device Flow to equipment The branch current value, Indicates device The physical impedance phasor difference at both ends; The expression for the running boundary constraint is: ; in, Indicates the number of devices. equipment voltage, These represent the upper and lower limits of the physical security allowed by the device, respectively; The expression for the dynamic weight adjustment mechanism is: ;

[0014] in, Indicates the first The degree of violation of a physical constraint, Indicates the tolerance threshold. This represents the sensitivity coefficient.

[0015] Furthermore, the expression for the loss function in which the physical rule loss function is explicitly embedded into the spatiotemporal attention network is: ; in, For the total loss, To use zero values ​​to fill the empty matrix The task loss for filling in missing values. The weights for physical losses.

[0016] Based on the above-described power grid data processing method, the present invention also provides a power grid data processing system, comprising: The data preprocessing module is used to construct a noise matrix and a gap matrix based on the power grid data, obtain an input matrix based on the noise matrix and the gap matrix, and obtain the spatiotemporal fusion features of the power grid data based on the input matrix. The data fusion module is used to add the spatiotemporal fusion features of the power grid data to the gap matrix, separate electrical features and environmental features from the gap matrix, generate high-frequency environmental quantity prediction values ​​based on the environmental features, and align the high-frequency environmental quantity prediction values ​​with the electrical features on the time axis; and fuse the high-frequency environmental quantity prediction values ​​with the electrical features to obtain fused features. The data processing module is used to explicitly embed the physical rule loss function into the loss function of the spatiotemporal attention network, and to process the fused features based on the spatiotemporal attention network.

[0017] The beneficial effects of this invention are as follows: The power grid data processing method and system disclosed in this invention construct a noise matrix and a gap matrix based on the power grid data, obtain an input matrix based on the noise matrix and the gap matrix, obtain the spatiotemporal fusion features of the power grid data based on the input matrix, and perform coarse screening and fine screening on the power grid data to achieve outlier removal and gap filling; by adding the spatiotemporal fusion features of the power grid data to the gap matrix, electrical features and environmental features are separated from the gap matrix, and high-frequency environmental quantity prediction values ​​are generated based on the environmental features, which are aligned with the electrical features on the time axis; the high-frequency environmental quantity prediction values ​​and the electrical features are fused to obtain fusion features. Addressing the problem of inconsistent sampling frequencies and time scales between electrical quantity data and environmental sensing data, a latent state modeling and continuous-time evolution mechanism is used to map low-frequency environmental data to the high-frequency electrical quantity time axis, achieving temporal alignment and fusion of multimodal data. By explicitly embedding the physical rule loss function into the loss function of the spatiotemporal attention network, and processing the fused features based on the spatiotemporal attention network, the filling result not only approaches the true value numerically, but also conforms to the operating rules of the power system, reducing the risk of misjudgment caused by data distortion and improving the credibility of engineering applications. Attached Figure Description

[0018] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0019] Figure 1 This is a flowchart illustrating a power grid data processing method according to the present invention.

[0020] Figure 2 This is a system block diagram of a power grid data processing system according to the present invention. Detailed Implementation

[0021] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0022] Many specific details are set forth in the following description in order to provide a full understanding of the invention, but the invention may also be practiced in other ways different from those described herein; obviously, the embodiments in the specification are only some embodiments of the invention, and not all embodiments.

[0023] In power data acquisition, missing values ​​and outliers often coexist. For example, sensor malfunctions may lead to missing data, while communication interruptions may cause data stagnation (time blind spots). Traditional methods (such as linear interpolation) may have a mean imputation error (MAE) exceeding 10% when the missing data rate exceeds 30%, thus misleading anomaly detection results. Regarding the coupling problem between missing data and anomaly detection in power time-series data, traditional methods (such as linear interpolation and mean imputation) show significantly reduced effectiveness when the missing data rate is high or the outlier distribution is complex. Based on these issues, this invention proposes a joint detection-repair framework that combines spatiotemporal correlation modeling with an adaptive imputation strategy to improve data quality enhancement.

[0024] The specific implementation of the technical solution of the present invention includes the following:

[0025] Example 1:

[0026] refer to Figure 1 A power grid data processing method, comprising: S1, construct a noise matrix and a gap matrix based on the power grid data, obtain an input matrix based on the noise matrix and the gap matrix, and obtain the spatiotemporal fusion features of the power grid data based on the input matrix; S2, add the spatiotemporal fusion features of the power grid data to the gap matrix, separate electrical features and environmental features from the gap matrix, generate high-frequency environmental quantity prediction values ​​based on the environmental features, and align the high-frequency environmental quantity prediction values ​​with the electrical features on the time axis; fuse the high-frequency environmental quantity prediction values ​​with the electrical features to obtain fused features; S3, explicitly embed the physical rule loss function into the loss function of the spatiotemporal attention network, and process the fused features based on the spatiotemporal attention network.

[0027] In step S1, constructing the noise matrix and the gap matrix based on the power grid data includes: S11, determine the abnormal data of the power grid data based on the physical constraints corresponding to different power grid data, and construct a noise matrix based on the abnormal data of the power grid data; the specific steps are: The tolerance coefficient corresponding to the power grid data is determined based on different power grid data, for example, by setting: ; in, This refers to voltage tolerance, indicating that a 20% overload fluctuation is permissible. Traverse the power grid data and determine outlier data in the power grid data based on the tolerance coefficient. Specifically, the following settings can be configured: Voltage determination: If the sampled value If so, it is considered an outlier; Current determination: If the sampled value If so, it is considered an outlier; Power determination: If the sampled value If so, it is considered an outlier; Environmental parameters are determined based on common physical principles, such as relative humidity. Or wind speed It is directly marked as an exception.

[0028] Set the abnormal data to NAN and construct a noise matrix; Outlier data is labeled as NAN to mark invalid or unreliable points in power grid data, preventing outliers from interfering with spatiotemporal fusion feature extraction and model training. Anomaly identification based on physical constraints and tolerance coefficients scientifically cleans the data, improving the accuracy of subsequent analyses (such as fault detection and state estimation) and ensuring the safety and stability of power grid operation. NAN indicates missing data, facilitating subsequent algorithms to ignore or impute it, ensuring robust processing.

[0029] The steps to set up NAN are as follows: First, set the tolerance factor (e.g., voltage) according to the power grid data type. Traverse the data sequence and apply a decision rule to each sampling point: if the voltage... Not here If the range is within the specified range, then the value at that point is set to NAN; current and power Similar treatment. Environmental parameters are based on basic physics principles, such as relative humidity. Exceeding [0%, 100%] or wind speed When the outlier is found, it is directly labeled as NAN. Then, all outliers are replaced with NAN. Finally, a noise matrix is ​​constructed: this matrix has the same dimension as the original data, and outlier positions are filled with NAN, while normal positions can be filled with 0 or retain the original value, to identify the noise state of the data points, which is used for subsequent input matrix construction and spatiotemporal feature extraction.

[0030] The noise matrix is ​​composed of The device is At each time step The dimensional feature observation sequence is composed of, for example, a noise matrix, as follows: ,Depend on The device is At each time step It consists of observation sequences of dimensional features (such as voltage, current, temperature, etc.).

[0031] S12, construct a power grid topology map based on device ID and device physical connection, calculate the smoothness of the graph signal of the power grid topology map, obtain the local graph smoothness anomaly score, and obtain the vacancy matrix based on the local graph smoothness anomaly score.

[0032] Constructing a power grid topology based on device IDs and physical device connections: (1); in, Indicates a device node. This indicates the physical connection between devices.

[0033] Constructing the Laplacian matrix and calculating outliers: (2); in, The graph Laplacian matrix is ​​used to measure the smoothness of a graph signal. It is a diagonal matrix, with diagonal elements Equal to equipment The degree, It is a symmetric matrix that reflects the physical connections of the power grid.

[0034] In a power grid, the electrical states (such as voltage and phase angle) of physically connected devices (e.g., transformers, buses) are spatially correlated, meaning that data from adjacent devices should transition smoothly. The graph Laplace matrix L is a core tool in graph theory, and its quadratic form... Quantizable graph signal (e.g., the smoothness of the device voltage vector across the entire network, i.e., the sum of squared differences between adjacent devices). The smaller the value, the smoother and more consistent the overall network state. When an anomaly occurs, the state of the fault point will differ drastically from its surroundings, causing a sharp deterioration in its local smoothness. By calculating the local graph smoothness anomaly score for each device, anomaly points that contradict the topology can be accurately located. The data corresponding to these locations are considered unreliable missing values, thus constructing a missing value matrix. This method transforms the physical connection relationship of the power grid into mathematical constraints, upgrading anomaly detection from single-point judgment to collaborative sensing based on network topology.

[0035] In this step, obtaining the spatiotemporal fusion features of the power grid data based on the input matrix includes: extracting the spatial dimension features of the power grid data based on the input matrix; extracting the temporal dimension features of the power grid data based on the spatial dimension features; and fusing the spatial dimension features and temporal dimension features of the power grid data into the spatiotemporal fusion features of the power grid data.

[0036] In the above steps, the formula for calculating the local map smoothness anomaly score is: (3); The calculation of the local graph smoothness anomaly score is based on the aforementioned Laplacian matrix. The core application of the theory. This fraction is typically defined as the sum of the squares of the differences between the signal (e.g., voltage) of device i and the signals of all its neighbors, mathematically expressed as: ,in It is the set of neighbors of device i. This is essentially equivalent to computing the graph signal vector. The contribution of the component corresponding to device i after multiplication with the Laplace matrix L, i.e. Therefore, this score directly quantifies the degree to which each device disrupts the smoothness of its surrounding local topology. A higher score indicates that the device's data is more disruptive to the smoothness of its physical connections (matrix). The greater the deviation from the expected smooth state (as defined), the more accurately the topological anomalies can be located, providing a basis for constructing the missing matrix.

[0037] in, Indicates the first One feature in Time, equipment Local plot smoothness anomaly score, Indicates device exist Time characteristics The actual observed value, Indicates device The set of first-order neighbor devices, Indicate neighboring devices Observations at the same time, Indicates device With neighboring devices Normalized spatial weights between them;

[0038] The process of obtaining the missing matrix based on the local graph smoothness anomaly score includes: Set an exception threshold ; like If so, it is considered abnormal. Set to null values ​​to obtain the empty matrix. .

[0039] Furthermore, obtaining the input matrix based on the noise matrix and the missing matrix includes: A binary mask matrix is ​​constructed based on the noise matrix, specifically generating the binary mask matrix. ,like If it is NAN, then Otherwise ; Use zero values ​​to fill empty matrices Fill in the missing values ​​to obtain the initialized tensor. Specific; Initialize the tensor The input matrix is ​​obtained by concatenating the binary mask matrix along its feature dimension. ; The spatiotemporal fusion features of the power grid data obtained based on the input matrix include: computing devices With neighboring devices The correlation coefficient between them is calculated using the following formula: (4); in, For neighboring devices For equipment Importance coefficient, Representing the equipment and neighboring equipment eigenvectors, The weight matrix is ​​a learnable linear transformation. For learnable attention vectors, It is a non-linear activation function; The coefficients are normalized using the Softmax function to obtain the final attention weights. ; Multi-weighted aggregation: (5); in, For equipment High-dimensional feature representation that integrates spatial information from the neighborhood. For feature splicing operations, It is a non-linear activation function. For the number of attention heads, For the first Normalized attention weights calculated from each attention head For the first The weight matrix of each attention head, For neighboring devices eigenvectors.

[0040] All devices across the network At all times aggregation features Stack them to form a spatial feature tensor ; Feature extraction based on Bi-LSTM network: (6); (7); (8); in, For spatial feature tensors At any moment slices, For at any time The spatiotemporal fusion characteristics of the power grid data For a moment The forward hidden state, For a moment The forward hidden state, For a moment The backward hidden state, For a moment The backward hidden state.

[0041] In power grid data processing, accurate extraction of temporal features is crucial. Power grid operating states (such as voltage and power) exhibit significant temporal dependencies and state continuity; their changes are influenced not only by historical states but also by near-future trends. Traditional unidirectional LSTMs can only capture historical information and struggle to model such bidirectional temporal dependencies. Bi-LSTMs, by introducing two independent forward and backward LSTM layers, can simultaneously learn past and future contextual information of the sequence, thus more comprehensively capturing complex temporal patterns such as load periodic fluctuations and dynamic fault propagation. Compared to traditional time-series models, it effectively alleviates the gradient vanishing problem and improves the ability to model long-sequence dependencies. In this scheme, Bi-LSTM acts as a temporal feature extractor, performing deep temporal modeling on spatial features aggregated through a graph attention network to form reliable spatiotemporal fusion features. This lays a precise temporal dynamic foundation for subsequent separation of electrical / environmental features, high-frequency prediction, and embedding of physical rule losses, representing a core technical step in improving the performance of power grid state perception and prediction models.

[0042] Output mapping and prediction generation, spatiotemporal fusion features By mapping back to the dimensions of the original data through an output layer, a unique predicted value is obtained. ;

[0043] In this embodiment, the output layer maps back to the empty matrix. Dimensions ( This refers to the "clean" version of the original power grid data after cleaning. Its goal is to predict... The specific values ​​of all locations marked as abnormal missing points (generated by the smoothness determination of the local graph) are included, including electrical characteristics such as voltage, current, and power, as well as environmental characteristics such as temperature and humidity, thus generating a complete and reliable data tensor. This is used in subsequent residual fusion steps. (To repair the data.)

[0044] Further residual fusion is performed using a mask. Fill the missing positions with the predicted values, while keeping the original observed values ​​unchanged; (9); In the above formula, The repaired complete data matrix; : Binary mask matrix, marking the original normal data (1) and the abnormal missing positions (0); : Element-wise multiplication (Hadamard product); X_clean: Original data that still contains missing data after cleaning; The model generates predicted values ​​for the missing parts; : Invert the mask to indicate the missing positions that need to be filled.

[0045] in," The symbol "" represents element-wise multiplication, also known as the Hadamard product. Specifically, it means multiplying the elements at the same positions of two matrices (or tensors) with identical dimensions one-to-one, thus generating a new matrix of the same dimension. This is used in the residual fusion step. The key role of:

[0046] in, : It's a binary mask (1 for normal data, 0 for empty data). This operation acts like a "filter," only allowing... The original valid data is passed through (multiplied by 1 to remain unchanged), while the data in the missing positions is set to zero (multiplied by 0).

[0047] It inverts the mask (1 for empty spaces, 0 for normal spaces). This operation acts as a "filler," selecting only... The predicted value corresponding to the missing position is retained (multiplied by 1), while the predicted value corresponding to the original valid data position is discarded (multiplied by 0).

[0048] Modal separation is then performed, specifically including: Modal separation of electrical output: from The electrical characteristics (voltage, current, etc.) separated from it.

[0049] Modal separation of environmental output: from Environmental characteristics (temperature, humidity, etc.) separated from it.

[0050] In step S2, generating high-frequency environmental quantity prediction values ​​based on the environmental characteristics includes: MLP is used to analyze low-frequency environmental observations. Mapping to the latent state space yields the latent states of the environmental observations at low-frequency moments; In power grid data, environmental quantities (such as temperature and humidity) are typically collected much less frequently than electrical quantities (such as voltage and current). This frequency mismatch limits the accuracy of fusion analysis. Traditional interpolation methods (such as linear and spline methods) cannot capture complex nonlinear dynamics, leading to prediction distortion.

[0051] Therefore, this invention introduces the concept of "latent state space" modeling. Its core is to encode low-frequency discrete environmental observations into a continuous, high-dimensional latent feature space using a multilayer perceptron (MLP). As a powerful nonlinear function approximator, the MLP can learn from sparse observations and extract continuous state representations containing physical laws (such as thermodynamics and diffusion processes). This latent state constitutes a compact encoding of the system dynamics, laying a solid foundation for subsequent continuous-time high-frequency extrapolation using Neural ODEs. This bridges the gap between discrete low-frequency observations and continuous dynamic models.

[0052] Using the potential state of environmental observations at low-frequency times as the initial value, the potential state of environmental observations at high-frequency target times is derived by integration using the ODE solver. The potential state of environmental observations at high-frequency target times is the predicted value of high-frequency environmental quantities. The derivation formula is as follows: (10); in, It is a parameterized neural network. Represents the initial potential state. Let be the integration variable, representing the integral from... arrive continuous time, An intermediate state represents a single instant on the integration path. The potential state.

[0053] The ODE equations are defined to transform discrete observation data into a continuous physical evolution process: (11); in, It is a parameterized neural network used to learn the physical derivative relationship of environmental parameters (such as temperature and humidity) over time.

[0054] In this embodiment, the latent state space is a continuous dynamic representation obtained by encoding low-frequency environmental observations using an MLP (Multi-Level Programming) algorithm, capturing the inherent evolutionary laws of environmental quantities. The predicted high-frequency environmental quantities are numerical estimates obtained by integrating the latent state along the time axis using a neural ordinary differential equation (ODE) with the latent state as the initial value. The predicted value is the instantiated output of the latent state space at the target time; the two are related as "encoding" and "decoding output," not the same concept. The latent state acts as an intermediate bridge, enabling continuous derivation from low-frequency observations to high-frequency predictions.

[0055] The Neural ODE solver used in this invention is an innovative technology. Its core idea is to model the evolution of environmental quantities (such as temperature diffusion and humidity change) as a continuous differential equation system parameterized by a neural network. Here It is a learnable neural network used to approximate the "dynamic laws" of system evolution. In short, the ODE solver is the key tool here to realize "learning the physical dynamic laws and making continuous-time, high-resolution scientific deductions based on these laws", connecting discrete data points into a dynamic trajectory that conforms to physics.

[0056] The calculated high-frequency latent state is output through the decoder. By mapping back to the data space through the decoder, high-frequency environmental quantity predictions that are perfectly aligned with the electrical quantity time axis are generated. .

[0057] Perform modal fusion, and Concatenate along the feature dimension; (12); In step S3, the expression for the physical rule loss function is: (13); in, For physical rule loss function, For power flow equation constraints. Constrained by Kirchhoff's current law, Constrained by Ohm's law, To implement boundary constraints, The weight parameters are adaptively determined through a dynamic weight adjustment mechanism. The expression for the power flow equation constraint is: (14); in, Indicates power, Indicates voltage. Represents current. Indicates the number of devices. Represents the square of the L2 norm; The expression for the Kirchhoff's law constraint is: (15); in, Indicates from device Flow to equipment The branch current value, Indicates from device Flow to equipment The branch current value; The expression for the Ohm's law constraint is: (16); in, This represents the total number of lines in the power grid. Indicates device The voltage phasor difference at both ends, Indicates from device Flow to equipment The branch current value, Indicates device The physical impedance phasor difference at both ends; The expression for the running boundary constraint is: (17); in, Indicates the number of devices. equipment voltage, These represent the upper and lower limits of the physical security allowed by the device, respectively; The expression for the dynamic weight adjustment mechanism is: (18);

[0058] in, Indicates the first The degree of violation of a physical constraint, Indicates the tolerance threshold. This represents the sensitivity coefficient.

[0059] In this step, the expression for the loss function that explicitly embeds the physical rule loss function into the spatiotemporal attention network is: (19); in, For the total loss, To use zero values ​​to fill the empty matrix The task loss for filling in missing values. The weights for physical losses.

[0060] In this embodiment, gradient calculation is based on the calculated total loss, and the chain rule is used to calculate the loss relative to the parameters of each layer in the network. gradient The calculation formula is: (20); The formula for weight update is: (twenty one); in, The learning rate is used. Through multiple rounds of iterative training, the model gradually converges, and the finally trained ST-GAT network can automatically balance "data fidelity" and "physical consistency" when filling in missing values.

[0061] In this step, the fused features are based on a spatiotemporal attention network (i.e., ST-GAT). The processing is a supervised training and reasoning process with physical laws as rigid constraints.

[0062] Specifically, the concatenated fused features are first input into the spatiotemporal coding layer of ST-GAT (graph attention layer and Bi-LSTM) for deep feature extraction. The network's training objective consists of two parts: minimizing task loss (e.g., the difference between predicted and true values) and minimizing physical rule loss. The latter explicitly embeds the core physical laws of the power grid (power flow equations, Kirchhoff's current law, Ohm's law, and operating boundaries), and uses a dynamic weighting mechanism to severely penalize violations of these physical rules. During backpropagation, the total loss... The gradient originates from both data errors and the degree of violation of physical constraints, driving the network parameter updates. Therefore, this process forces ST-GAT to not only fit the statistical regularity of the data during learning and inference, but also to strictly follow the physical principles of power grid operation, ultimately generating highly reliable results (such as repair values ​​or state estimates) that combine data accuracy and physical consistency.

[0063] ST-GAT (Spatiotemporal Graph Attention Network) is a deep learning architecture designed for spatiotemporal sequence data with a well-defined topological structure, such as power grids. Its core background lies in the difficulty of traditional temporal models (such as LSTM) or spatial models (such as CNN) simultaneously and effectively capturing the dynamic spatial relationships and complex temporal dependencies between devices. ST-GAT addresses this problem by integrating a Graph Attention Network (GAT) and a temporal encoder (such as Bi-LSTM): the GAT layer adaptively learns the dynamic influence weights between device nodes in the power grid topology, accurately aggregating spatial information; the temporal layer analyzes the evolution of the characteristics of each device node over time. In this scheme, its innovation is further reflected in the explicit embedding of a physical rule loss function, using the power flow equations and Kirchhoff's laws of the power grid as soft constraints to guide training. This ensures that the spatiotemporal representation learned by the network is consistent with the underlying physical mechanisms, thereby guaranteeing both high accuracy driven by data and the credibility of physical laws in data repair and prediction tasks.

[0064] The ST-GAT in this technical solution is not a general-purpose architecture, but rather a core engine designed to achieve the specific goal of "power grid data repair through physical information fusion." Its uniqueness lies in:

[0065] Customized input and processing: its input It is a matrix that has been preprocessed with strict physical rules (tolerance threshold, graph smoothness) and then concatenated with a mask, ensuring that the model learns from physically reliable data.

[0066] Spatiotemporal modeling for power grids: Spatially, a graph attention (GAT) layer is specifically used to model the power grid topology, dynamically learning the mutual influence weights between devices based on physical connections (such as line impedance); temporally, a Bi-LSTM captures the temporal evolution of the device's own state. The two work together to accurately extract the spatiotemporal correlation features specific to the power grid.

[0067] Explicit driving of physical rules: Its core innovation lies in explicitly embedding the physical rule loss function (covering power flow, KCL, Ohm's law, and operating boundary) as a hard constraint into the total loss function. Furthermore, a dynamic weighting mechanism is used to strengthen the penalty for serious physical violations. This ensures that the learning process of ST-GAT is guided by physical laws, and the repair and prediction values ​​it generates are not only statistically accurate but also physically reliable, conforming to the basic laws of power grid operation.

[0068] Therefore, the ST-GAT proposed in this scheme is an interpretable, strongly constrained learning model that deeply couples the prior knowledge of the power grid topology with physical laws, and is the key to achieving high-reliability data repair and fusion prediction.

[0069] Example 2:

[0070] refer to Figure 2 Based on the power grid data processing method of Embodiment 1, this embodiment provides a power grid data processing system, including: The data preprocessing module is used to construct a noise matrix and a gap matrix based on the power grid data, obtain an input matrix based on the noise matrix and the gap matrix, and obtain the spatiotemporal fusion features of the power grid data based on the input matrix. The data fusion module is used to add the spatiotemporal fusion features of the power grid data to the gap matrix, separate electrical features and environmental features from the gap matrix, generate high-frequency environmental quantity prediction values ​​based on the environmental features, and align the high-frequency environmental quantity prediction values ​​with the electrical features on the time axis; and fuse the high-frequency environmental quantity prediction values ​​with the electrical features to obtain fused features. The data processing module is used to explicitly embed the physical rule loss function into the loss function of the spatiotemporal attention network, and to process the fused features based on the spatiotemporal attention network.

[0071] The specific implementation method of this embodiment is the same as that of Embodiment 1, and will not be repeated here. Please refer to the description of Embodiment 1 for details.

[0072] The methods and systems described in the above embodiments solve the following technical problems:

[0073] 1. Coupling interference between outliers and missing values: By constructing a two-layer anomaly detection mechanism, the anomaly identification process is brought forward and combined with missing value imputation, avoiding the contamination of imputation results by outlier data, while providing a more reliable data foundation for subsequent modeling, and significantly improving the overall data quality.

[0074] 2. Improve filling accuracy by leveraging the grid topology and spatiotemporal correlation: Introduce a graph attention mechanism to model the grid topology relationship, which can adaptively capture the spatial dependencies between devices and extract network characteristics based on time dimension features to depict the evolution of the operating state, thereby maintaining high filling accuracy and stability even in scenarios with high missing rates or topology changes.

[0075] 3. Enhance the model's ability to perceive complex multimodal operating states: Through cross-modal alignment and fusion mechanisms, collaborative modeling of electrical quantity data and environmental perception data is achieved under a unified time series and feature space, effectively improving the ability to characterize complex operating conditions and complex abnormal scenarios.

[0076] 4. Ensure the physical rationality and engineering usability of the filling results: Embed the physical constraints of the power grid into the model optimization process, so that the filling results are not only close to the true values ​​in terms of numerical values, but also conform to the operating rules of the power system, reducing the risk of misjudgment caused by data distortion and improving the credibility of engineering applications.

[0077] 5. Improved anomaly detection accuracy: Multimodal fusion improves the F1 score by 17%, especially for compound anomalies (such as overload + harmonics), the recognition rate is improved by 23%.

[0078] Those skilled in the art will understand that although some embodiments herein include certain features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention and form different embodiments.

[0079] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A power grid data processing method, characterized in that, include: A noise matrix and a vacancy matrix are constructed based on the power grid data. An input matrix is ​​obtained based on the noise matrix and the vacancy matrix. The spatiotemporal fusion features of the power grid data are obtained based on the input matrix. The spatiotemporal fusion features of the power grid data are added to the gap matrix, and electrical features and environmental features are separated from the gap matrix. High-frequency environmental quantity prediction values ​​are generated based on the environmental features, and the high-frequency environmental quantity prediction values ​​are aligned with the electrical features on the time axis. The high-frequency environmental quantity prediction values ​​and the electrical features are fused to obtain fused features. The physical rule loss function is explicitly embedded into the loss function of the spatiotemporal attention network, and the fused features are processed based on the spatiotemporal attention network.

2. The power grid data processing method according to claim 1, characterized in that, The construction of the noise matrix and the gap matrix based on the power grid data includes: Based on the physical constraints corresponding to different power grid data, abnormal data of the power grid data are determined, and a noise matrix is ​​constructed based on the abnormal data of the power grid data. A power grid topology graph is constructed based on the device ID and the physical connection of the device. The smoothness of the graph signal of the power grid topology graph is calculated to obtain the local graph smoothness anomaly score. A vacancy matrix is ​​obtained based on the local graph smoothness anomaly score.

3. The power grid data processing method according to claim 1, characterized in that, The step of obtaining the spatiotemporal fusion features of the power grid data based on the input matrix includes: extracting the spatial dimension features of the power grid data based on the input matrix; extracting the temporal dimension features of the power grid data based on the spatial dimension features of the power grid data; and fusing the spatial dimension features and temporal dimension features of the power grid data into the spatiotemporal fusion features of the power grid data.

4. The power grid data processing method according to claim 2, characterized in that, The process of determining anomalous data in the power grid data based on physical constraints corresponding to different power grid data, and constructing a noise matrix based on the anomalous data in the power grid data, includes: Determine the tolerance coefficient corresponding to the power grid data based on different power grid data; Traverse the power grid data and determine outlier data in the power grid data based on the tolerance coefficient; Set the abnormal data to NAN and construct a noise matrix; The noise matrix is ​​composed of The device is At each time step Composition of dimensional feature observation sequences.

5. The power grid data processing method according to claim 2, characterized in that, The formula for calculating the local graph smoothness anomaly score is as follows: ; in, Indicates the first One feature in Time, equipment Local plot smoothness anomaly score, Indicates equipment exist Time characteristics The actual observed value, Indicates equipment The set of first-order neighbor devices, Indicate neighboring devices Observations at the same time, Indicates equipment With neighboring devices Normalized spatial weights between them; The process of obtaining the missing matrix based on the local graph smoothness anomaly score includes: Set an exception threshold If the local graph smoothness score is abnormal If so, it is considered abnormal. Set to null values ​​to obtain the empty matrix. .

6. The power grid data processing method according to claim 1, characterized in that, The process of obtaining the input matrix based on the noise matrix and the missing matrix includes: Construct a binary mask matrix based on the noise matrix; Use zero values ​​to fill empty matrices Fill in the missing values ​​to obtain the initialized tensor. ; Initialize the tensor The input matrix is ​​obtained by concatenating the binary mask matrix along its feature dimension. ; The spatiotemporal fusion features of the power grid data obtained based on the input matrix include: computing devices With neighboring devices The correlation coefficient between them is calculated using the following formula: ; in, For neighboring devices For equipment Importance coefficient, Representing the equipment and neighboring equipment eigenvectors, The weight matrix is ​​a learnable linear transformation. For learnable attention vectors, It is a non-linear activation function; The coefficients are normalized using the Softmax function to obtain the final attention weights. ; The formula for multi-weighted aggregation is: ; in, For equipment High-dimensional feature representation that integrates spatial information from the neighborhood. For feature splicing operations, It is a non-linear activation function. For the number of attention heads, For the first Normalized attention weights calculated from each attention head For the first The weight matrix of each attention head, For neighboring devices eigenvectors; All devices across the network At all times aggregation features Stack them to form a spatial feature tensor ; Feature extraction is performed based on a Bi-LSTM network, and the calculation formula is as follows: ; ; ; in, For spatial feature tensors At any moment slices, For at any time The spatiotemporal fusion characteristics of the power grid data For a moment The forward hidden state, For a moment The forward hidden state, For a moment The backward hidden state, For a moment The backward hidden state.

7. The power grid data processing method according to claim 1, characterized in that, The generation of high-frequency environmental quantity prediction values ​​based on the environmental characteristics includes: MLP is used to analyze low-frequency environmental observations. Mapping to the latent state space yields the latent states of the environmental observations at low-frequency moments; Using the potential state of environmental observations at low-frequency times as the initial value, the potential state of environmental observations at high-frequency target times is derived by integration using the ODE solver. The potential state of environmental observations at high-frequency target times is the predicted value of high-frequency environmental quantities. The derivation formula is as follows: ; in, It is a parameterized neural network. Represents the initial potential state. Let be the integration variable, representing the integral from... arrive continuous time, An intermediate state represents a single instant on the integration path. The potential state.

8. The power grid data processing method according to claim 1, characterized in that, The expression for the physical rule loss function is: ; in, For physical rule loss function, For power flow equation constraints. Constrained by Kirchhoff's current law, Constrained by Ohm's law, To implement boundary constraints, The weight parameters are adaptively determined through a dynamic weight adjustment mechanism. The expression for the power flow equation constraint is: ; in, Indicates power, Indicates voltage. Represents current. Indicates the number of devices. Represents the square of the L2 norm; The expression for the Kirchhoff's law constraint is: ; in, Indicates from device Flow to equipment The branch current value, Indicates from device Flow to equipment The branch current value; The expression for the Ohm's law constraint is: ; in, This represents the total number of lines in the power grid. Indicates equipment The voltage phasor difference at both ends, Indicates from device Flow to equipment The branch current value, Indicates equipment The physical impedance phasor difference at both ends; The expression for the running boundary constraint is: ; in, Indicates the number of devices. equipment voltage, These represent the upper and lower limits of the physical security allowed by the device, respectively; The expression for the dynamic weight adjustment mechanism is: ; in, Indicates the first The degree of violation of a physical constraint, Indicates the tolerance threshold. This represents the sensitivity coefficient.

9. A power grid data processing method according to claim 8, characterized in that, The expression for the loss function that explicitly embeds the physical rule loss function into the spatiotemporal attention network is as follows: ; in, For the total loss, To use zero values ​​to fill the empty matrix The task loss for filling in missing values. The weights for physical losses.

10. A power grid data processing system, characterized in that, include: The data preprocessing module is used to construct a noise matrix and a gap matrix based on the power grid data, obtain an input matrix based on the noise matrix and the gap matrix, and obtain the spatiotemporal fusion features of the power grid data based on the input matrix. The data fusion module is used to add the spatiotemporal fusion features of the power grid data to the gap matrix, separate electrical features and environmental features from the gap matrix, generate high-frequency environmental quantity prediction values ​​based on the environmental features, and align the high-frequency environmental quantity prediction values ​​with the electrical features on the time axis; and fuse the high-frequency environmental quantity prediction values ​​with the electrical features to obtain fused features. The data processing module is used to explicitly embed the physical rule loss function into the loss function of the spatiotemporal attention network, and to process the fused features based on the spatiotemporal attention network.