Power grid false data injection attack positioning method based on adaptive space-time diagram neural network
By introducing an adaptive spatiotemporal graph neural network into the detection of false data injection attacks in the power grid, the optimized reconnection adjacency matrix and performing global feature fusion, the problem of GNN poor performance in low homogeneity graphs in the prior art is solved, and more accurate attack detection and positioning is achieved.
Patent Information
- Application Number
- CN202411749093.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-12-02
AI Technical Summary
The detection method of the grid false data injection attack based on graph neural network in the prior art is poor in low homogeneity graphs, and it is difficult to fully utilize neighbor node information in the power grid for effective feature representation, and lacks robustness and adaptability in complex power grid environments.
A method of fictitious data injection attack positioning of power grid based on Adaptive Spatial-Time Graph Neural Network (ADSTGNN) is proposed. By obtaining power grid operation data, modeling it as a graph, introducing a sliding window mechanism, and generating a graph structure time series. Then, an optimized reconnected adjacency matrix is generated using the improved multi-head self-attention mechanism and the K-nearest neighbor minimum threshold method to achieve adaptive neighbor selection. Combining graph structure learning and node embedding, global feature fusion is carried out through the improved Transformer module, and fused with spatiotemporal features. Finally, input the classification layer to determine node exceptions.
This method performs excellently in low homogeneity graphs, has better robustness and adaptability, and can more accurately detect false data injection attacks in the power grid and locate the attacked busbars, improving the detection attack effect.
Smart Images

Figure CN119696841A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of smart grid security technology, and in particular relates to a method for locating false data injection attacks in a power grid based on an adaptive spatiotemporal graph neural network. Background Art
[0002] In the context of global informatization and intelligence, modern smart grids are gradually transforming into power information-physical systems. Smart grids integrate information and communication technologies into large-scale power networks to generate, transmit and distribute power more efficiently. Terminal acquisition units and vector measurement units are used to obtain physical measurements and pass them to the monitoring and data acquisition system. After analyzing these measurements, state estimation provides the control center with the best estimate of the system state. Its accuracy is crucial to the stable operation of the power grid. The interaction of a large amount of data between the physical layer and the network layer brings high efficiency while increasing the risk of network attacks. False Data Injection Attack (FDIA) destroys the integrity of power grid data and poses a great threat to the security of the power system. It constructs specific attack vectors to bypass the system's bad data detection mechanism and affect the results of the power system state estimation. The wrong estimation results cause the control center to make wrong decisions, affecting the normal operation of the power grid and causing huge economic losses.
[0003] In order to detect false data injection attacks, artificial intelligence has developed rapidly with the advent of the big data era. At the same time, the power grid generates an increasingly large amount of data. In order to cope with the data security issues brought about by the huge amount of data, advanced neural network algorithms are used to analyze the characteristics of power grid operation data, and then implement a data-driven approach to FDIA detection. The anomaly detection method based on the Graph Neutral Network (GNN) in the prior art takes into account the topological structure information of the power grid and has shown certain advantages in the FDIA detection of the power grid. The traditional GNN model propagates and aggregates features through a fixed adjacency matrix, which is more suitable for graphs with high homogeneity of nodes. Homogeneity refers to the similar distribution of members in a population on certain features or attributes. In graph structured data, homogeneity is often manifested as connected nodes having similar features and the same labels.
[0004] Most existing graph neural networks assume that the graph has high homomorphism and perform poorly in low-homogeneous graphs. Due to the dynamic and complex topological structure of the power grid, the load characteristics of each bus are different, and the power characteristics of adjacent buses with physical connections may also be quite different. The detection methods based on graph neural networks in the existing technology are difficult to fully utilize the neighbor node information in the power grid for effective feature representation.
[0005] Therefore, there is an urgent need for a power grid false data injection attack location method based on adaptive spatial temporal graph neural network (ADSTGNN) to solve the problem that GNN in the existing technology performs poorly in low-homogeneity graphs, and has better robustness and adaptability in complex power grid environments, thereby improving the detection attack effect. Summary of the invention
[0006] The purpose of the present invention is to provide a method for locating false data injection attacks in a power grid based on an adaptive spatiotemporal graph neural network, which is characterized by comprising the following steps:
[0007] Step S1, obtain the operation data of the power grid, model the power grid as a graph, obtain graph structure data, introduce a sliding window mechanism, and generate a graph structure time series X (Input) of historical data;
[0008] Step S2: Based on the graph structure time series X (Input), combine graph structure learning and node embedding to generate an optimized reconnection adjacency matrix A * , to achieve adaptive neighborhood selection;
[0009] Step S3: Based on the graph structure time series X (Input), the improved Transformer module is used to perform global feature fusion to obtain the fused feature vector X fusion ; The fused feature vector X fusion With the original feature vector X o Connection as a self-embedding of nodes X ego ;
[0010] Step S4: embed the node's self into X ego Concatenate with the neighbor embedding output by the spatiotemporal feature fusion module to obtain the total embedding X of the connected nodes C ; The neighbor embedding output by the spatiotemporal feature fusion module includes: reconnected neighbor embedding and the neighbor embeddings of the node and
[0011] Step S5: embed the total number of connected nodes into X C Input to the improved Transformer module, fuse multi-source features, and obtain the final node embedding X out , embed the final node into X out The input is sent to the classification layer to determine node anomalies and locate false data injection attacks in the power grid.
[0012] The step S1 of obtaining the operation data of the power grid includes: selectively reading the historical data of the control monitoring and data acquisition system SCADA in the power system; selecting the bus phase angle, voltage amplitude, active and reactive injection power of the bus and active and reactive injection power of each branch to form an original data set Z; performing de-averaging and normalization processing on the original data set Z;
[0013] The power grid is modeled as a graph, and obtaining graph structure data includes: taking the busbars in the power grid as nodes and the connection relationship between the busbars in the power grid as edges, and converting the original data set Z into graph structure data according to the number of nodes and the number of features of each node;
[0014] The introducing of the sliding window mechanism includes: setting the sliding step length of the sliding window mechanism to 1 time step.
[0015] The step S2 combines graph structure learning and node embedding to generate an optimized reconnection adjacency matrix A. * include:
[0016] Input the graph structure time series X(Input) of historical data, use the improved multi-head self-attention mechanism to calculate the attention scores between nodes, jointly apply the K nearest neighbor and minimum threshold methods, select the node with the highest attention score as the new neighboring node of the target node, and generate the optimized reconnection adjacency matrix A * ;
[0017] The optimized reconnection adjacency matrix A * is: a sparse and reliable reconnection adjacency matrix.
[0018] The improved multi-head self-attention mechanism is:
[0019] Q i =XW i Q (1)
[0020]
[0021] S=Mean(head1, head2,..., head n ) (3)
[0022] In the formula, Q i is the query matrix obtained by linear transformation of X, where X represents the node feature matrix, and W i Q is the learnable weight matrix of the i-th head (i=1,...,n); represents the normalized Qi; for The transposed matrix of iThe cosine score between each pair of row vectors in generates the cosine score matrix head i ∈R n×n ; Mean means to average the score matrices of all attention heads to obtain a symmetric attention score matrix S∈R n×n , where the element S ij The value range is between [-1, 1].
[0023] The K nearest neighbor and minimum threshold method includes:
[0024] Define a positive integer γ and a non-negative threshold ∈, retain the attention scores greater than ∈ or belonging to the first γ largest elements in the corresponding row, set the remaining attention scores to 0, and reconnect the adjacency matrix A * ∈R n×n It is expressed as:
[0025]
[0026] In the formula, represents the set of the first γ largest elements in the i-th row of the matrix S.
[0027] The specific process of using the improved Transformer module to perform global feature fusion is as follows:
[0028] X o =ReLU(XW0+b0) (5)
[0029] Q i =X o W i Q (6)
[0030] K i =X o W i K (7)
[0031] V i =X o W i V (8)
[0032] X MHSA =Concat(head1, head2,..., head n ) (9)
[0033]
[0034] Where, X ois the feature representation of the input node feature matrix X after linear transformation and ReLU activation, W0 is the weight matrix, b0 is the bias vector, Q i , K i and V i They are respectively o The query, key and value matrices obtained by linear transformation, W i Q , W i K and W i V Learnable weight matrices corresponding to query, key, and value matrices respectively; X MHSA is the result output by the multi-head self-attention mechanism. K i The transposed matrix, d k is the vector dimension of query and key matrices;
[0035] In order to overcome the gradient vanishing problem and alleviate overfitting, residual connection and Dropout operation are introduced:
[0036] X fusion = Dropout(X o +X MHSA )+X o (11)
[0037] Where, X fusion is the output of the improved Transformer module;
[0038] The output X of the improved Transformer module fusion Simplified representation is FusionBlock(X):
[0039] X fusion =FusionBlock(X) (12)
[0040] The fused feature vector X fusion With the original feature vector X o Connection as a self-embedding of nodes X ego for:
[0041] X ego =X fusion ||X o (13).
[0042] The node's self-embedding X ego Concatenate with the neighbor embedding output by the spatiotemporal feature fusion module to obtain the total embedding X of the connected nodes C include:
[0043] A temporal convolutional network is used to extract features from input time series data across time steps;
[0044] Adopt extended causal convolution with gating mechanism to effectively obtain long-term dependencies of data;
[0045] Using extended causal convolution, the expansion factor is introduced. For the extended causal convolution network with dilation = [1, 2, 4], the number of convolutions in each layer remains unchanged, and convolution expansion is performed in the next layer;
[0046] Introduce the gating mechanism and define the gated temporal convolution layer:
[0047]
[0048] In the formula, the initial input is self-embedded X ego ,σ represents the sigmoid activation function, and are the convolution kernel parameters used to generate the main feature signal and the gating signal, respectively, l+1 and c l+1 is the corresponding bias term, ⊙ is the element-wise multiplication, ★ represents the extended causal convolution, is the input feature tensor of the lth layer at time step t;
[0049] The convolution kernel at time step t can learn the parameters and The convolution operation is expressed as:
[0050]
[0051] Where M is the length of the convolution kernel; is the sth parameter in the convolution kernel; d is the expansion factor, whose size controls the jump distance, that is, one input is selected every d steps;
[0052] The final output of the temporal convolution module is X t As the input of the spatial feature extraction module, the initial adjacency matrix A is used for feature aggregation:
[0053]
[0054] Where k = 1, 2, ..., K, represents the number of feature aggregations, represents the normalized adjacency matrix with self-loops, D = diag((A+I)1 n ) is the degree matrix of A with self-loops, I∈R n×n is the identity matrix; and Defined as the neighbor embedding of a node;
[0055] Using the generated reconnection adjacency matrix A * To perform feature aggregation:
[0056]
[0057] In the formula, It is a standardized A * , D * =diag(A * 1 n ) is A * The degree matrix of the feature aggregation It is called reconnected neighbor embedding;
[0058] Concatenate the self-embedding, reconnected neighbor embedding, and node neighbor embedding into the total embedding of the node X C :
[0059]
[0060] X C Perform Dropout to generate a learnable weight vector w, the dimension of which is the same as the output dimension of the weight vector w. C Perform Hadamard product operation to highlight X C Important feature dimensions:
[0061] X out =ReLU(w⊙X C ) (19).
[0062] The step S5 specifically includes:
[0063] Again, the improved Transformer module is used to transform X out Processing; Based on the multi-label classification results output by the model and the probability of the node output at the last time step, the nodes with higher abnormal probability are determined as the targets of attack;
[0064] The final node is embedded in X out Input to the classification layer to judge the node anomalies include:
[0065] The Softmax layer outputs the probability of each node being abnormal, and determines the nodes that may be attacked and the corresponding positions; the specific process is: after the classification layer, the node abnormality mode is determined
[0066] output=softmax(FusionBlock(X out W1)) (20)
[0067] Where W1 is the trainable weight matrix; X outis the final total node embedding; output is the multi-label classification result.
[0068] Another object of the present invention is to provide a power grid false data injection attack locating device according to the power grid false data injection attack locating method based on an adaptive spatiotemporal graph neural network according to the present invention, characterized in that it comprises:
[0069] Data acquisition module: used to obtain the operation data of the power grid and generate a graph-structured time series of historical data;
[0070] Preprocessing module: used to preprocess the acquired power grid operation data, including normalizing the data, converting it into graph structure data, and introducing a sliding window mechanism to obtain processed power grid operation data;
[0071] Adaptive spatiotemporal graph neural network model module: inputs the processed data into the trained model to obtain the probability of each node being attacked, thereby locating the attacked bus and taking further protective measures;
[0072] The adaptive spatiotemporal graph neural network model includes: a graph structure learning module, a global feature fusion module, a spatiotemporal feature fusion module and a Softmax classification module; the graph structure learning module is used to mine the intrinsic associations between nodes and identify new reliable neighbors for each node; the global feature fusion module fuses more valuable information from the entire graph; the spatiotemporal feature fusion module extracts the temporal and spatial features of the data; the Softmax classification module is used to classify the input data and output the final detection results.
[0073] The beneficial effects of the present invention are:
[0074] The present invention discloses a method for locating and detecting false data injection attacks based on an adaptive spatiotemporal graph neural network, and inputs the collected power grid operation data into a pre-trained model to obtain labels for determining possible locations where false data injection attacks exist. Compared with the prior art, the present invention establishes a reconnected graph structure through a graph structure learning module, a global feature fusion module, and a spatiotemporal feature fusion module, identifies more reliable neighbors for each node in the graph, and integrates valuable information from the entire graph. The specific beneficial effects include the following:
[0075] (1) An improved multi-head self-attention mechanism is used to mine the intrinsic connections between nodes from the original graph data. The ideas of K-nearest neighbor and minimum threshold methods are combined to identify reliable neighbors for each node, thereby generating a reconnected adjacency matrix.
[0076] (2) Using the improved Transformer module, more valuable information is fused from the entire graph and the fused feature vector is combined with the initial feature vector to form node self-embedding.
[0077] (3) The spatiotemporal feature fusion module fully captures the temporal dependence and spatial characteristics of the data, and the original adjacency matrix and the reconnected adjacency matrix are respectively subjected to feature aggregation to form the neighbor embedding of the node. The generated node embeddings are connected, so that the model can better identify local and global information, which is conducive to more accurate detection of power grid FDIA and determination of the location of the attacked bus. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] Figure 1 It is a flow chart of a method for locating false data injection attacks in a power grid based on an adaptive spatiotemporal graph neural network according to the present invention;
[0079] Figure 2 A schematic diagram of a false data injection attack detection process according to an embodiment of the present invention;
[0080] FIG3( a ) is a schematic diagram of a graph structure learning module and a global feature fusion module in the overall architecture of an adaptive spatiotemporal graph neural network according to an embodiment of the present invention;
[0081] FIG3( b ) is a schematic diagram of a spatiotemporal feature fusion module and a classifier in the overall architecture of an adaptive spatiotemporal graph neural network according to an embodiment of the present invention;
[0082] Figure 4 A schematic diagram of a sliding window mechanism for graph structure data according to an embodiment of the present invention;
[0083] Figure 5 Schematic diagram of the extended causal convolution structure of an embodiment of the present invention. DETAILED DESCRIPTION
[0084] The present invention provides a method for locating false data injection attacks in a power grid based on an adaptive spatiotemporal graph neural network. The present invention is further described in detail below in conjunction with the accompanying drawings.
[0085] like Figure 1 The embodiment of the present invention shown discloses a method for locating false data injection attacks in a power grid based on an adaptive spatiotemporal graph neural network, comprising:
[0086] Step S1, obtain the operation data of the power grid, model the power grid as a graph, obtain graph structure data, introduce a sliding window mechanism, and generate a graph structure time series X (Input) of historical data;
[0087] Step S2: Based on the graph structure time series X (Input), combine graph structure learning and node embedding to generate an optimized reconnection adjacency matrix A *, to achieve adaptive neighborhood selection;
[0088] Step S3: Based on the graph structure time series X (Input), the improved Transformer module is used to perform global feature fusion to obtain the fused feature vector X fusion ; The fused feature vector X fusion With the original feature vector X o Connection as a self-embedding of nodes X ego ;
[0089] Step S4: embed the node's self into X ego Concatenate with the neighbor embedding output by the spatiotemporal feature fusion module to obtain the total embedding X of the connected nodes C ; The neighbor embedding output by the spatiotemporal feature fusion module includes: reconnected neighbor embedding and the neighbor embeddings of the node and
[0090] Step S5: embed the total number of connected nodes into X C Input to the improved Transformer module, fuse multi-source features, and obtain the final node embedding X out , embed the final node into X out The input is sent to the classification layer to determine node anomalies and locate false data injection attacks in the power grid.
[0091] In this embodiment, the false data injection attack detection process is implemented as follows: Figure 2 As shown, the purpose of applying the detection process is to input the collected power grid operation data into the pre-trained model to obtain labels for determining possible locations where false data injection attacks exist. Compared with the prior art, the present invention establishes a reconnected graph structure through a graph structure learning module, a global feature fusion module, and a spatiotemporal feature fusion module, identifies more reliable neighbors for each node in the graph, and integrates valuable information from the entire graph.
[0092] In this embodiment, in order to achieve the purpose of the detection process, the following technical solutions are specifically adopted:
[0093] Obtain the normal operation data of the power grid and generate a graph-structured time series X (Input) of historical data;
[0094] The historical data of the Supervisory Control And Data Acquisition (SCADA) system in the power system is selectively read, and the bus phase angle, voltage amplitude, active and reactive injection power of the bus, and active and reactive injection power of each branch are selected to form the original data set Z and then de-averaged and normalized.
[0095] The power grid is modeled as a graph, with the busbars in the grid as nodes and the connection relationship between the busbars in the grid as edges. According to the number of nodes and the number of features of each node, the original data set Z is converted into graph structure data.
[0096] In order to fully explore the temporal dependencies between historical data and capture the short-term dynamics and local patterns of data, a sliding window mechanism is introduced.
[0097] Combine graph structure learning and node embedding to generate an optimized reconnection adjacency matrix A * , realize adaptive neighborhood selection; provide more reliable neighbor information for each node.
[0098] The processed graph structure data is input, and the improved multi-head self-attention mechanism is used to calculate the attention scores between nodes. Then, the K-nearest neighbor and minimum threshold methods are jointly applied to select the nodes with the highest attention scores as the new neighboring nodes of the target node, and a sparse, connected and reliable reconnected adjacency matrix is obtained.
[0099] The improved Transformer module is used to help the model identify more valuable features in the entire graph and focus more on these features. The identified features are fused with the initial node features as the node self-embedding and input into the subsequent spatiotemporal feature fusion module.
[0100] The spatiotemporal feature fusion module is constructed. First, it passes through the time-related layer, which is composed of an extended causal convolution with a gating mechanism to learn the temporal dependency between input data. Then it passes through the spatial-related layer, which is composed of a graph convolutional neural network to extract spatial features. The initial adjacency matrix and the established reconnected adjacency matrix work together. The initial adjacency matrix is input to obtain the neighbor embedding of the node, and the reconnected adjacency matrix is input to obtain the reconnected neighbor embedding. Finally, the two obtained node embeddings are connected with the node's self-embedding, which includes the node's own features and domain information, and integrates local and global information, making it easier to identify subsequent attacks.
[0101] Construct a multi-label classification layer, with the total embedding of the connected nodes as input. After the linear transformation of the fully connected layer extracts the features, the Softmax layer outputs the probability of each node being abnormal, thereby determining the nodes that may be attacked and their corresponding locations, so that subsequent decision makers can take further repair measures.
[0102] The present invention discloses a method for locating false data injection attacks in power grids based on an adaptive spatiotemporal graph neural network. The internal correlation between nodes is captured through graph structure learning to identify more reliable neighbors for the nodes. And through node feature fusion, more valuable information in the graph for the detection task is integrated. Finally, an extended causal convolution with a gating mechanism is introduced in combination with a graph convolutional network to capture the temporal dependency of node information and further extract spatial features, thereby improving the detection and positioning capabilities of FDIA in the power grid. The present invention solves the problem of poor performance of GNN in low-homogeneity graphs, and has better robustness and adaptability in complex power grid environments.
[0103] The overall architecture of the adaptive spatiotemporal graph neural network of the embodiment of the present invention is as follows Figure 3(a) and 3(b) As shown, FIG3(a) is a schematic diagram of a graph structure learning module and a global feature fusion module; FIG3(b) is a schematic diagram of a spatiotemporal feature fusion module and a classifier.
[0104] The implementation process of each step is specifically introduced below with reference to the accompanying drawings.
[0105] Step S1, obtain the operation data of the power grid, model the power grid as a graph, obtain graph structure data, introduce a sliding window mechanism, and generate a graph structure time series X (Input) of historical data;
[0106] The step S1 of obtaining the operation data of the power grid includes:
[0107] The historical data of the control monitoring and data acquisition system SCADA in the power system is selectively read, and the bus phase angle, voltage amplitude, active and reactive injection power of the bus, and active and reactive injection power of each branch are selected to form the original data set Z and perform de-averaging and normalization processing.
[0108] The power grid is modeled as a graph, with the busbars in the grid as nodes and the connection relationship between the busbars in the grid as edges. According to the number of nodes and the number of features of each node, the original data set Z is converted into graph structure data.
[0109] In order to fully explore the temporal dependency between historical data and capture the short-term dynamics and local patterns of data, a sliding window mechanism is introduced, and the sliding step is set to 1 time step. The processing mechanism is as follows Figure 4 shown.
[0110] Step S2: Based on the graph structure time series X (Input), combine graph structure learning and node embedding.
[0111] Generate optimized reconnection adjacency matrix A * , to achieve adaptive neighborhood selection;
[0112] In this embodiment, a reconnected adjacency matrix is generated. The graph neural network designed based on the high homogeneity assumption cannot be fully applied to low homogeneity graphs such as power grids. To solve this problem, a reconnected adjacency matrix is constructed through graph structure learning to provide reliable neighbor information for each node.
[0113] The multi-head self-attention (MHSA) mechanism is used to calculate the attention scores between nodes to explore their intrinsic connections. Considering the focus on the generation of undirected graphs, the MHSA mechanism is modified.
[0114] The improved multi-head self-attention mechanism is:
[0115] Q i =XW i Q (1)
[0116]
[0117] S=Mean(head1, head2,..., head n ) (3)
[0118] In the formula, Q i is the query matrix obtained by linear transformation of X, where X represents the node feature matrix, and W i Q is the learnable weight matrix of the i-th head (i=1,...,n); represents the normalized Qx; for The transposed matrix of i The cosine score between each pair of row vectors in generates the cosine score matrix head i ∈R n×n ; Mean means to average the score matrices of all attention heads to obtain a symmetric attention score matrix S∈R n×n , where the element S ij The value range is between [-1, 1].
[0119] In this embodiment, the calculation matrix Q is i The cosine score between each pair of row vectors in generates the cosine score matrix head i ∈R n×n To ensure that the generated reconnection adjacency matrix conforms to the properties of an undirected graph and better describes the intrinsic relationship between nodes, it is different from the multi-head self-attention mechanism in the prior art. Calculate the weighted similarity using To calculate, so as to ensure that the obtained attention score matrix is symmetrical; the score matrix of all attention heads is averaged to obtain a symmetrical attention score matrix S∈R n×n , where the element S ij The value range is between [-1, 1].
[0120] The MHSA mechanism can be used to construct multiple fully connected graphs, so that each node can be connected to all other nodes. This ability enables each node to aggregate features from any other node, but it also brings too much computational burden and introduces noise. To solve this problem, the idea of K-nearest neighbor (KNN) and minimum threshold method is combined to select the most reliable neighbor of each node. The K-nearest neighbor and minimum threshold method include:
[0121] Define a positive integer γ and a non-negative threshold ∈, retain the attention scores greater than ∈ or belonging to the first γ largest elements in the corresponding row, and set the remaining attention scores to 0. The new adjacency matrix A * ∈R n×n It is expressed as:
[0122]
[0123] In the formula, represents the set of the first γ largest elements in the i-th row of the matrix S.
[0124] At this point, the sparse, non-negative and reliable reconnection adjacency matrix A is obtained at each moment * . Make sure to reconnect the adjacency matrix A * The sparsity and high reliability of the proposed method can realize the adaptive neighborhood selection of nodes in the power grid.
[0125] Those skilled in the art should know that the reconnection adjacency matrix A regenerated in this embodiment is * The sparsity and high reliability are to better fit the physical topology in reality. In the actual power grid, due to cost and other considerations, it is impossible for each bus of the power grid to be connected by a branch. As few branches as possible are needed to ensure the connectivity of the power grid. The adjacency matrix after the power grid is modeled as a graph must also be a sparse matrix. The similarity between the node and all other nodes is calculated through the multi-head self-attention mechanism. If no subsequent minimum threshold processing is performed, it is a fully connected graph, which is obviously contrary to reality and increases the computational complexity. Therefore, sparsity is an essential feature of the power grid modeling as a graph, and high reliability is because the top few nodes with higher rankings in the calculated similarity to all nodes are selected and identified as new neighborhoods.
[0126] Step S3: Based on the graph structure time series X (Input), the improved Transformer module is used to perform global feature fusion to obtain the fused feature vector X fusion ; The fused feature vector X fusion With the original feature vector X o Connection as a self-embedding of nodes X ego ;
[0127] In this embodiment, step S3 performs global feature fusion of the graph, including: using an improved Transformer module to identify more valuable features in the entire graph; fusing the identified features with the initial node features to generate a richer initial feature representation for the node, which is used as the self-embedding of the node and input into subsequent modules;
[0128] In this embodiment, based on the graph structure time series X(Input), the improved Transformer module is used to perform global feature fusion to obtain the fused feature vector X fusion ; Considering that it is difficult to capture long-range dependencies in graph neural networks, it may not be possible to capture the associations between distant nodes only by aggregating neighborhood information. The improved Transformer module helps the model identify important features of the entire graph and pay more attention to the important features.
[0129] The improved Transformer module includes: a double-layer Dropout and a residual connection layer;
[0130] Compared with the original Transformer architecture in the prior art, the improved Transformer module omits the regularization and Feed Forward fully connected layers. Specifically, there is an imbalance in the number of nodes and edges in the graph data. Regularization can easily bring too much weight penalty to low-degree nodes. The use of Dropout, which can be randomly discarded, can avoid this situation while effectively reducing the risk of overfitting. In addition, the Feed Forward layer is omitted, and the focus is placed on the multi-head self-attention mechanism to capture the beneficial information of the entire graph, reducing the computational complexity.
[0131] The specific process of using the improved Transformer module to perform global feature fusion is as follows:
[0132] X o =ReLU(XW0+b0) (5)
[0133] Q i =X o W i Q (6)
[0134] K i =X o Wi K (7)
[0135] V i =X o W i V (8)
[0136] X MHSA =Concat(head1, head2,..., head n ) (9)
[0137]
[0138] Where, X o is the feature representation of the input node feature matrix X after linear transformation and ReLU activation, W0 is the weight matrix, b0 is the bias vector, Q i , K i and V i They are respectively o The query, key, and value matrices obtained by linear transformation, W i Q , W i K and W i V Learnable weight matrices corresponding to query, key, and value matrices respectively; X MHSA is the result output by the multi-head self-attention mechanism. K i The transposed matrix, d k is the vector dimension of query and key matrix;
[0139] In order to overcome the gradient vanishing problem and alleviate overfitting, residual connection and Dropout operation are introduced:
[0140] X fusion = Dropout(X o +X MHSA )+X o (11)
[0141] Where, X fusion is the output of the improved Transformer module;
[0142] To facilitate the subsequent description, the output X of the improved Transformer module is fusion Simplified representation is FusionBlock(X):
[0143] Xfusion =FusionBlock(X) (12)
[0144] In this embodiment, global feature fusion of the graph is performed, including: using an improved Transformer module to identify more valuable features in the entire graph; fusing the identified features with the initial node features to generate a richer initial feature representation for the node, which is used as the self-embedding of the node and input into subsequent modules;
[0145] The fused feature vector X fusion With the original feature vector X o Connection as a self-embedding of nodes X ego for:
[0146] X ego =X fusion ||X o (13)
[0147] Step S4: embed the node's self into X ego Concatenate with the neighbor embedding output by the spatiotemporal feature fusion module to obtain the total embedding X of the connected nodes C ; The neighbor embedding output by the spatiotemporal feature fusion module includes: reconnected neighbor embedding and the neighbor embeddings of the node and
[0148] In this embodiment, step S4 connects the fused feature vector with the original feature vector as the self-embedding of the node, inputs the spatiotemporal feature fusion module, and obtains the total embedding of the connected nodes, including: passing through the time-related layer, the time dependency between the input data is learned by the extended causal convolution with a gating mechanism; passing through the space-related layer, composed of a graph convolutional neural network, is used to extract spatial features; the initial adjacency matrix and the established reconnection adjacency matrix are combined to work together; the initial adjacency matrix is input to obtain the neighbor embedding of the node, and the reconnected adjacency matrix is input to obtain the reconnected neighbor embedding; the two obtained node embeddings are connected with the node's self-embedding, and the node's own features and domain information are included at the same time, and the local and global information are integrated to obtain the total embedding of the connected nodes.
[0149] The node's self-embedding X ego Concatenate with the neighbor embedding output by the spatiotemporal feature fusion module to obtain the total embedding X of the connected nodes C include:
[0150] To extract temporal features, a temporal convolutional network is used to extract features across time steps of the input time series data;
[0151] Adopt extended causal convolution with gating mechanism to effectively obtain long-term dependencies of data;
[0152] Specifically, it includes: using extended causal convolution with a gating mechanism to effectively obtain the long-term dependency of data; TCN is a convolutional neural network architecture that uses a causal convolution layer to process time series data. In this embodiment, an extended causal convolution with a gating mechanism is used;
[0153] Using extended causal convolution, the dilation factor is introduced. For the temporal convolution network with dilation = [1, 2, 4], its structure is as follows Figure 5 As shown in the figure, the number of convolutions in each layer remains unchanged, and convolution expansion is performed in the next layer.
[0154] In order to fully model the nonlinear relationship in the time dimension, a gating mechanism is introduced and the gated temporal convolution layer is defined as follows:
[0155]
[0156] In the formula, the initial input is self-embedded X ego ,σ represents the sigmoid activation function, and are the convolution kernel parameters used to generate the main feature signal and the gating signal, respectively, l+1 and c l+1 is the corresponding bias term, ⊙ is the element-wise multiplication, ★ represents the extended causal convolution, is the input feature tensor of the lth layer at time step t;
[0157] Given The convolution kernel at time step t can learn the parameters and The convolution operation is expressed as:
[0158]
[0159] Where M is the length of the convolution kernel; is the sth parameter in the convolution kernel; d is the expansion factor, whose size controls the jump distance, that is, one input is selected every d steps;
[0160] Then, the final output X of the temporal convolution module is t As the input of the spatial feature extraction module, the initial adjacency matrix A is used for feature aggregation:
[0161]
[0162] In the formula, k = 1, 2, ..., K, represents the number of feature aggregations, represents the normalized adjacency matrix with self-loops, D = diag((A+I)1 n ) is the degree matrix of A with self-loops, I∈R n×n is the identity matrix; and Defined as the neighbor embedding of a node;
[0163] Similarly, using the generated reconnection adjacency matrix A * To perform feature aggregation:
[0164]
[0165] In the formula, It is a standardized A * , D * =diag(A * 1 n ) is A * The degree matrix of the feature aggregation It is called reconnected neighbor embedding;
[0166] Concatenate the self-embedding, reconnected neighbor embedding, and node neighbor embedding into the total embedding of the node:
[0167]
[0168] X C Perform Dropout to generate a learnable weight vector w, the dimension of which is the same as the output dimension of the weight vector w. C Perform Hadamard product operation to highlight X C Important feature dimensions:
[0169] X out =ReLU(w⊙X C ) (19)
[0170] Step S5: embed the total number of connected nodes into X C Input to the improved Transformer module, fuse multi-source features, and obtain the final node embedding X out , embed the final node into X out The input is sent to the classification layer to determine node anomalies and locate false data injection attacks in the power grid.
[0171] In this embodiment, step S5 again uses the improved Transformer module to transform X out The purpose of this process is to optimize the final total node embedding, integrate the node’s own information, the original neighbor relationship and the reconnected neighbor relationship information, fuse multi-source features, and generate a more robust high-quality node embedding.
[0172] Through the multi-label classification results output by the model, based on the probability of the node output at the last time step, the nodes with higher abnormal probability are determined as the targets of attack.
[0173] The final node is embedded in X out Input to the classification layer to judge the node anomalies include:
[0174] The Softmax layer outputs the probability of each node being abnormal, and determines the nodes that may be attacked and the corresponding positions; the specific process is: after the classification layer, the node abnormality mode is determined
[0175] output=softmax(FusionBlock(X out W1)) (20)
[0176] Where W1 is the trainable weight matrix; X out is the final total node embedding; output is the multi-label classification result.
[0177] Another embodiment of the present invention discloses a power grid false data injection attack location device according to the power grid false data injection attack location method based on an adaptive spatiotemporal graph neural network according to the present invention, comprising:
[0178] Data acquisition module: used to obtain the operation data of the power grid and generate a graph-structured time series of historical data;
[0179] Preprocessing module: used to preprocess the acquired power grid operation data, including normalizing the data, converting it into graph structure data, and introducing a sliding window mechanism to obtain processed power grid operation data;
[0180] Adaptive spatiotemporal graph neural network model module: inputs the processed data into the trained model to obtain the probability of each node being attacked, thereby locating the attacked bus and taking further protective measures;
[0181] The adaptive spatiotemporal graph neural network model includes: a graph structure learning module, a global feature fusion module, a spatiotemporal feature fusion module and a Softmax classification module; the graph structure learning module is used to mine the intrinsic associations between nodes and identify new reliable neighbors for each node; the global feature fusion module fuses more valuable information from the entire graph; the spatiotemporal feature fusion module extracts the temporal and spatial features of the data; the Softmax classification module is used to classify the input data and output the final detection results.
[0182] In this embodiment, the power grid false data injection attack locating device is used to implement the power grid false data injection attack locating method based on adaptive spatiotemporal graph neural network disclosed in the present invention.
[0183] In order to verify the effectiveness of the power grid false data injection attack positioning method based on adaptive spatiotemporal graph neural network disclosed in the present invention, the following comparative verification experiment was carried out.
[0184] The evaluation indicators used in the comparative verification experiment include:
[0185] Accuracy
[0186] Accuracy
[0187] Recall
[0188] F1 score
[0189] The experimental results of the comparative verification experiment are shown in Table 1. It can be seen from Table 1 that the experimental results of the power grid false data injection attack positioning method based on the adaptive spatiotemporal graph neural network disclosed in the present invention represented by Ours have achieved better experimental results in terms of accuracy, precision, recall rate and F1 score compared with other network structures in the prior art.
[0190] Table 1 Comparative experimental results statistics
[0191]
[0192] Note: The model definitions in Table 1
[0193] LSTM (Long Short-Term Memory): Long Short-Term Memory Network
[0194] GRU (Gated Recurrent Unit): Gated Recurrent Unit
[0195] Gated-TCN (Gated Temporal Convolutional Network): Gated Temporal Convolutional Network
[0196] Transformer: Transformer model
[0197] GCN (Graph Convolutional Networks): Graph Convolutional Networks
[0198] GAT (Graph Attention Network): Graph Attention Network
[0199] GGNN (Gated Graph Neural Network): Gated Graph Neural Network
[0200] STGCN (Spatial-Temporal Graph Convolutional Network): Spatial-Temporal Graph Convolutional Network
[0201] In order to evaluate the importance of each module in the power grid false data injection attack location method based on adaptive spatiotemporal graph neural network disclosed in the present invention, ablation experiments are carried out from the following four aspects. In this embodiment, the ablation experiment includes the following four aspects:
[0202] 1. Remove the reconnected neighbor embeddings in the final total embedding;
[0203] 2. Remove node self-embedding from the final total embedding;
[0204] 3. Remove the improved Transformer module after the final total embedding;
[0205] 4. Remove the module for temporal feature extraction, i.e. the extended causal convolution module with gating mechanism;
[0206] The experimental results of the ablation experiment are shown in Table 2. It can be seen from Table 2 that the complete power grid false data injection attack localization method based on adaptive spatiotemporal graph neural network disclosed in the present invention represented by Ours has achieved better experimental results in terms of accuracy, precision, recall rate and F1 score compared to removing some modules.
[0207] Table 2 Statistics of ablation experiment results
[0208]
[0209] In this embodiment, through comparative verification experiments on other network structures in the prior art and ablation experiments on the method itself, it is proved that the power grid false data injection attack positioning method based on the adaptive spatiotemporal graph neural network disclosed in the present invention can solve the problem of poor performance of GNN in low homogeneity graphs in the prior art, and has better robustness and adaptability in complex power grid environments, thereby improving the attack detection effect.
Claims
1. A method for locating false data injection attacks in power grids based on an adaptive spatiotemporal graph neural network, characterized in that: The steps include: Step S1, obtain the operation data of the power grid, model the power grid as a graph, obtain graph structure data, introduce a sliding window mechanism, and generate a graph structure time series X (Input) of historical data; Step S2: Based on the graph structure time series X (Input), combine graph structure learning and node embedding to generate an optimized reconnection adjacency matrix A * , to achieve adaptive neighborhood selection; Step S3: Based on the graph structure time series X(lnput), the improved Transformer module is used to perform global feature fusion to obtain the fused feature vector X fusion ; The fused feature vector X fusion With the original feature vector X o Connection as a self-embedding of nodes X ego ; Step S4: embed the node's self into X ego Concatenate with the neighbor embedding output by the spatiotemporal feature fusion module to obtain the total embedding X of the connected nodes C ; The neighbor embedding output by the spatiotemporal feature fusion module includes: reconnected neighbor embedding and the neighbor embeddings of the node and Step S5: embed the total number of connected nodes into X C Input to the improved Transformer module, fuse multi-source features, and obtain the final node embedding X out , embed the final node into X out The input is sent to the classification layer to determine node anomalies and locate false data injection attacks in the power grid.
2. The method for locating false data injection attacks in power grids based on an adaptive spatiotemporal graph neural network according to claim 1 is characterized in that: The step S1 of obtaining the operation data of the power grid includes: selectively reading the historical data of the control monitoring and data acquisition system SCADA in the power system; selecting the bus phase angle, voltage amplitude, active and reactive injection power of the bus and active and reactive injection power of each branch to form an original data set Z; performing de-averaging and normalization processing on the original data set Z; The power grid is modeled as a graph, and obtaining graph structure data includes: taking the busbars in the power grid as nodes and the connection relationship between the busbars in the power grid as edges, and converting the original data set Z into graph structure data according to the number of nodes and the number of features of each node; The introducing of the sliding window mechanism includes: setting the sliding step length of the sliding window mechanism to 1 time step.
3. The method for locating false data injection attacks in power grids based on an adaptive spatiotemporal graph neural network according to claim 1 is characterized in that: The step S2 combines graph structure learning and node embedding to generate an optimized reconnection adjacency matrix A. * include: Input the graph structure time series X(lnput) of historical data, use the improved multi-head self-attention mechanism to calculate the attention scores between nodes, jointly apply the K nearest neighbor and minimum threshold method, select the node with the highest attention score as the new neighbor node of the target node, and generate the optimized reconnection adjacency matrix A * ; The optimized reconnection adjacency matrix A * is: a sparse and reliable reconnection adjacency matrix.
4. The method for locating false data injection attacks in power grids based on an adaptive spatiotemporal graph neural network according to claim 3 is characterized in that: The improved multi-head self-attention mechanism is: S=Mean(head1,head2,...,head n ) (3) In the formula, Q i is the query matrix obtained by linear transformation of X, where X represents the node feature matrix, is the learnable weight matrix of the i-th head (i=1,...,n); represents the normalized Q i ; for The transposed matrix of i The cosine score between each pair of row vectors in generates the cosine score matrix head i ∈R n×n ; Mean means to average the score matrices of all attention heads to obtain a symmetric attention score matrix S∈R n×n , where the element S ij The value range is between [-1, 1].
5. The method for locating false data injection attacks in power grids based on an adaptive spatiotemporal graph neural network according to claim 3 is characterized in that: The K nearest neighbor and minimum threshold method includes: Define a positive integer γ and a non-negative threshold ∈, retain the attention scores greater than ∈ or belonging to the first γ largest elements in the corresponding row, set the remaining attention scores to 0, and reconnect the adjacency matrix A * ∈R n×n It is expressed as: In the formula, represents the set of the first γ largest elements in the i-th row of the matrix S.
6. The method for locating false data injection attacks in power grids based on an adaptive spatiotemporal graph neural network according to claim 1 is characterized in that: The specific process of using the improved Transformer module to perform global feature fusion is as follows: X o =ReLU(XW0+b0) (5) X MHSA =Concat(head1,head2,...,head n ) (9) Where, X o is the feature representation of the input node feature matrix X after linear transformation and ReLU activation, W0 is the weight matrix, b0 is the bias vector, Q i , K i and V i They are respectively o The query, key and value matrices obtained by linear transformation, and Learnable weight matrices corresponding to query, key, and value matrices respectively; X MHSA is the result output by the multi-head self-attention mechanism. K i The transposed matrix, d k is the vector dimension of query and key matrix; In order to overcome the gradient vanishing problem and alleviate overfitting, residual connection and Dropout operation are introduced: X fusion =Dropout(X o +X MHSA )+X o (11) Where, X fusion is the output of the improved Transformer module; The output X of the improved Transformer module fusion Simplified representation is FusionBlock(X): X fusion =FusionBlock(X) (12) The fused feature vector X fusion With the original feature vector X o Connection as a self-embedding of nodes X ego for: X ego =X fusion ||X o (13)。 7. The method for locating false data injection attacks in power grids based on an adaptive spatiotemporal graph neural network according to claim 1 is characterized in that: The node's self-embedding X ego Concatenate with the neighbor embedding output by the spatiotemporal feature fusion module to obtain the total embedding X of the connected nodes C include: A temporal convolutional network is used to extract features from input time series data across time steps; Adopt extended causal convolution with gating mechanism to effectively obtain long-term dependencies of data; Using extended causal convolution, the expansion factor is introduced. For the extended causal convolution network with dilation = [1, 2, 4], the number of convolutions in each layer remains unchanged, and convolution expansion is performed in the next layer; Introduce the gating mechanism and define the gated temporal convolution layer: In the formula, the initial input is self-embedded X ego ,σ represents the sigmoid activation function, and are the convolution kernel parameters used to generate the main feature signal and the gated signal, respectively, and b l+1 and c l+1 is the corresponding bias term, ⊙ is the element-wise multiplication, ★ represents the extended causal convolution, is the input feature tensor of the lth layer at time step t; The convolution kernel at time step t can learn the parameters and The convolution operation is expressed as: Where M is the length of the convolution kernel; is the sth parameter in the convolution kernel; d is the expansion factor, whose size controls the jump distance, that is, one input is selected every d steps; The final output of the temporal convolution module is X t As the input of the spatial feature extraction module, the initial adjacency matrix A is used for feature aggregation: In the formula, k = 1, 2, ..., K, represents the number of feature aggregations, represents the normalized adjacency matrix with self-loops, D = diag((A+I)1 n ) is the degree matrix of A with self-loops, I∈R n×n is the identity matrix; and Defined as the neighbor embedding of a node; Using the generated reconnection adjacency matrix A * To perform feature aggregation: In the formula, It is a standardized A * , D * =diag(A * 1 n ) is A * The degree matrix of the feature aggregation It is called reconnected neighbor embedding; Concatenate the self-embedding, reconnected neighbor embedding, and node neighbor embedding into the total embedding of the node X C : X C Perform Dropout to generate a learnable weight vector w, the dimension of which is the same as the output dimension of the weight vector w. C Perform Hadamard product operation to highlight X C Important feature dimensions: X out =ReLU(w⊙X C ) (19)。 8. The method for locating false data injection attacks in power grids based on an adaptive spatiotemporal graph neural network according to claim 1 is characterized in that: The step S5 specifically includes: Again, the improved Transformer module is used to transform X out Processing; Based on the multi-label classification results output by the model and the probability of the node output at the last time step, the nodes with higher abnormal probability are determined as the targets of attack; The final node is embedded in X out Input to the classification layer to judge the node anomalies include: The Softmax layer outputs the probability of each node being abnormal, and determines the nodes that may be attacked and the corresponding positions; the specific process is: after the classification layer, the node abnormality mode is determined output=softmax(FusionBlock(X out W1)) (20) Where W1 is the trainable weight matrix; X out is the final total node embedding; output is the multi-label classification result.
9. A power grid false data injection attack location device according to the power grid false data injection attack location method based on an adaptive spatiotemporal graph neural network according to any one of claims 1 to 8, characterized in that: include: Data acquisition module: used to obtain the operation data of the power grid and generate a graph-structured time series of historical data; Preprocessing module: used to preprocess the acquired power grid operation data, including normalizing the data, converting it into graph structure data, and introducing a sliding window mechanism to obtain processed power grid operation data; Adaptive spatiotemporal graph neural network model module: inputs the processed data into the trained model to obtain the probability of each node being attacked, thereby locating the attacked bus and taking further protective measures; The adaptive spatiotemporal graph neural network model includes: a graph structure learning module, a global feature fusion module, a spatiotemporal feature fusion module and a Softmax classification module; the graph structure learning module is used to mine the intrinsic associations between nodes and identify new reliable neighbors for each node; the global feature fusion module fuses more valuable information from the entire graph; the spatiotemporal feature fusion module extracts the temporal and spatial features of the data; the Softmax classification module is used to classify the input data and output the final detection results.
Citation Information
Patent Citations
Machine room anomaly detection method and device based on graph structure and abnormal attention mechanism
CN115018021A
Motion recognition method and system based on fusion graph convolutional network and Transform network
CN115100574A
Complex multi-step attack detection method and system for power system
CN115604032A
Multivariate time series prediction method based on graph neural network and Transform
CN117113054A
Space-time normalized graph convolutional neural network traffic flow prediction method and system, and medium
CN117392830A
Cited By
Multi-layer network flow dynamic monitoring and analysis method based on graph neural network
CN120110940A
Power system false data positioning and recovering system based on deep learning
CN120508996A
A smart grid false data injection attack detection method and device
CN122554247A
