A fast N-1 fault analysis method and system based on a graph neural network
By employing a fast N-1 fault analysis method based on graph neural networks, the problem of excessive computational burden in large-scale power systems is solved, achieving efficient power system fault analysis and improving the operational safety and decision-making capabilities of the power grid.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NARI TECH CO LTD
- Filing Date
- 2025-05-13
- Publication Date
- 2026-07-10
AI Technical Summary
Traditional N-1 security analysis is computationally burdensome in large-scale power systems, making it difficult to meet real-time operational requirements. Furthermore, with the integration of renewable energy and demand-side flexibility, the complexity of power systems increases, exacerbating computational bottlenecks.
A fast N-1 fault analysis method based on graph neural networks is adopted. Particle swarm optimization is used to identify transmission line parameters, construct a power system graph, enhance features using a mask encoder, and combine a graph neural network architecture with topology adaptive graph convolution to embed node power and voltage constraints of the power system and train a dedicated GNN model to predict the power flow distribution after a fault.
It significantly reduces the computational burden, improves computational efficiency, can accurately predict the power flow distribution of the power system after a fault, meets the needs of real-time security analysis, and has good scalability and reliability.
Smart Images

Figure CN120492848B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to power system security analysis technology, specifically to a fast N-1 fault analysis method and system based on graph neural networks. Background Technology
[0002] N-1 safety analysis is a criterion for determining the safety of a power system, also known as the single-failure safety criterion. Specifically, it means that under normal operating conditions, if any independent component (such as a generator, transmission line, transformer, etc.) among the N components in the power system fails and is disconnected, the power system should be able to maintain stable operation, other components should not experience overload, short circuit, or damage, and the normal power supply to important users should not be affected, nor should voltage collapse or other accidents occur.
[0003] Traditional N-1 security analysis relies on repeated power flow calculations, which imposes a huge computational burden on large-scale power systems and struggles to meet the demands of real-time operation. With the increasing integration of renewable energy and demand-side flexibility, power systems are becoming more complex, and the need for security analysis is growing, further exacerbating the computational bottleneck.
[0004] In recent years, the development of artificial intelligence and machine learning technologies has provided new approaches to solving this problem. Graph Neural Networks (GNNs), with their ability to capture complex network relationships, have shown great potential in power system analysis. By utilizing the graph structure of the power system, GNNs can learn the patterns between voltage and power flow, thereby achieving efficient and accurate power flow calculations. Existing research has shown that GNNs have achieved significant results in tasks such as state estimation and fault location.
[0005] Therefore, there is an urgent need to develop a fast N-1 fault analysis technology based on GNN, which aims to avoid repetitive online power flow calculations, reduce computational burden, achieve real-time security analysis, and enhance the resilience and operational decision-making capabilities of the power grid. Summary of the Invention
[0006] To address the shortcomings of existing technologies, this invention provides a fast N-1 fault analysis method and system based on graph neural networks. By training a specialized GNN model to predict branch power flow after a fault, it avoids the repetitive online power flow calculations in traditional methods, thus significantly improving computational efficiency.
[0007] To achieve the above-mentioned objectives, the present invention adopts the following technical solution:
[0008] Firstly, a fast N-1 fault analysis method based on graph neural networks includes the following steps:
[0009] Particle swarm optimization algorithm is used to identify transmission line parameters based on real-time measurement data;
[0010] Each bus in the power system is regarded as a node in the graph, and each transmission line is regarded as an edge connecting two nodes in the graph. Based on the identification results of transmission line parameters, node features and edge features are extracted to construct the power system graph.
[0011] Based on whether the node features in the power system diagram are known, a mask encoder is used to enhance the features of the unknown parts to obtain the encoded feature vector.
[0012] A graph neural network architecture based on topology-adaptive graph convolution is constructed. This architecture includes a message-passing part and a topology-adaptive graph convolution part. In the message-passing part, each node in layer l receives information from its neighboring nodes, performs local computation, and then passes the updated information to its neighboring nodes, along with the updated feature vector. With the original feature vector X l The features are added together to obtain a new feature vector. In the topological adaptive graph convolution part, the new feature vector is processed by the K-hop topological adaptive graph convolution layer to obtain the l+1 layer feature vector.
[0013] The node power balance constraints and node voltage magnitude constraints of the power system are embedded into the loss function of the graph neural network in the form of soft constraints. For each credible N-1 fault, a dedicated graph neural network model is trained using power flow solution data that includes normal operation state and fault state.
[0014] For each credible N-1 fault, a corresponding trained graph neural network model is used to predict the power flow distribution of the power system after the fault, for subsequent analysis.
[0015] Furthermore, the particle swarm optimization algorithm is used to identify transmission line parameters based on real-time measurement data. The steps are as follows:
[0016] (1) Initialize the particle swarm: Each particle represents a set of candidate parameters μ h =[G h B h H particles are randomly generated, where 1 ≤ h ≤ H, and the initial velocity v of each particle is randomly set. h ; where G h B represents the line conductance. h Represents line susceptance;
[0017] (2) Define the fitness function: The fitness function is the root mean square error (RMSE) of the measurement error.
[0018]
[0019] Where h(·) is the line model equation, z p Let u be the measurement data of the p-th sample, where P is the total number of measurement data samples. p This is the input used to calculate the predicted value for the p-th sample;
[0020] Using the current particle parameter μ h The predicted value h(μ) is calculated using the line model. h ,u p Compare the predicted value with the actual measured value z. p Calculate RMSE;
[0021] (3) At each iteration, calculate the fitness value of each particle. If the current fitness is better than the historical best value, then update the individual's best value p. best =μ h The particle with the best fitness in the population is selected as the global optimum g. best Update the velocity and position of each particle according to the following formula:
[0022]
[0023] Where ω is the inertia weight, c1 and c2 are learning factors, and r1 and r2 are random numbers taking values within [0,1].
[0024] If the parameters exceed the search space, force the parameters to be pulled back to the boundary.
[0025] (4) Terminate when the maximum number of iterations is reached or the change in the global optimal fitness is less than the threshold.
[0026] Furthermore, the power system diagram G is represented as:
[0027] G = (N, ε, x, e)
[0028] Where N represents the set of nodes, ε represents the set of edges, x represents the set of node features, and e represents the set of edge features;
[0029] For node n i Node feature vector x i Represented as:
[0030] x i =[P i Q i ,|V i |,θ i ]
[0031] Where P i Q represents the active power of the load. i For the reactive power of the load, |V i | represents the voltage amplitude, θ i This refers to the voltage phase angle;
[0032] For each edge ε ij The edge feature vector is represented as:
[0033] e ij =[G ij B ij ]
[0034] Among them G ij B is the line conductance obtained after parameter identification. ij The line susceptance is obtained after parameter identification.
[0035] Furthermore, feature enhancement is performed on the unknown parts using a mask encoder, including:
[0036] For each node n i Define a mask vector m i ∈{0,1} d Where d is the number of node features; and the mask vector m i The elements indicate whether the corresponding feature is known, with 0 indicating known and 1 indicating unknown;
[0037] Use a mask encoder to mask vector m i Transform into a continuous feature vector m i This can be achieved using a fully connected layer.
[0038] m i ′=W1(σ(W0m i +b0))+b1
[0039] Where W0 and W1 are weight matrices, b0 and b1 are bias terms, and σ is the activation function;
[0040] The output m of the mask encoder i ′ and original feature x i Perform concatenation or addition operations to obtain the encoded feature vector x. i ":
[0041] x i " = x i +m i ′
[0042] Encoding feature vector x i "It contains both known and unknown parts of the node features, where the unknown parts are masked and encoded by the vector m." i Enhance.
[0043] Furthermore, in the message passing section, for each node i, the message it receives is calculated using the following formula:
[0044]
[0045] in, Let N(i) represent the feature vector of node i in the l-th layer, and let N(i) represent the set of neighboring nodes of node i. The eigenvector of edge (i,j) contains the conductance and susceptance of the line; σ represents the nonlinear activation function. These are trainable parameters; [·] indicates feature concatenation.
[0046] Furthermore, in the topological adaptive graph convolution part, the feature vector calculation formula is as follows:
[0047]
[0048] Where S = D -1 / 2 AD -1 / 2 It is the normalized adjacency matrix, and K is the order of the adjacency matrix A. σ represents the learnable weights at each order, and σ denotes the nonlinear activation function.
[0049] Furthermore, the nodal power balance constraints and nodal voltage magnitude constraints of the power system are embedded in the loss function of the graph neural network in the form of soft constraints, as follows:
[0050] (1) Define the basic loss function to fit the power flow data:
[0051]
[0052] Where M is the total number of samples in the training set of the graph neural network. For the power flow of the m-th sample predicted by the graph neural network, y m The actual value;
[0053] (2) Define the physical constraint loss function:
[0054] Node power balance constraints: predicted power flow Node power balance must be satisfied:
[0055] L power =||P calc -P inj || 2 +||Q calc -Q inj || 2
[0056] Where P calc Q calc It is the active and reactive power injection vector calculated through the AC power flow equations; P inj Q injThese are known active and reactive power injection vectors; the formulas for calculating the active and reactive power injection of the i-th node in the power network are as follows:
[0057]
[0058] Where j is the node connected to node i, θ ij =θ i -θ j G represents the phase angle difference between node i and node j. ij B ij These are the conductance and susceptance of branch ij, respectively;
[0059] Voltage amplitude constraint: Node voltages must meet the voltage amplitude constraint:
[0060]
[0061] in V represents the node voltage magnitude predicted by the graph neural network. max V min These represent the maximum and minimum node voltages, respectively.
[0062] (3) Define the joint loss function:
[0063] L total =L data +λ1L power +λ2L voltage
[0064] λ1 and λ2 are weight hyperparameters used to balance fitting accuracy and physical consistency.
[0065] Secondly, a fast N-1 fault analysis system based on graph neural networks includes:
[0066] The line parameter identification module is used to identify transmission line parameters based on real-time measurement data using the particle swarm optimization algorithm.
[0067] The power system graph construction module is used to treat each bus in the power system as a node in the graph, and each transmission line as an edge connecting two nodes in the graph. Based on the identification results of transmission line parameters, node features and edge features are extracted to construct the power system graph.
[0068] The mask encoder module is used to enhance the features of unknown parts based on whether the node features in the power system diagram are known, and obtain the encoded feature vector.
[0069] The network construction module is used to build a graph neural network architecture based on topology-adaptive graph convolution. This architecture includes a message-passing part and a topology-adaptive graph convolution part. In the message-passing part, each node in layer l receives information from its neighboring nodes, performs local computation, and then passes the updated information to its neighboring nodes, along with the updated feature vector. With the original feature vector X l The features are added together to obtain a new feature vector. In the topological adaptive graph convolution part, the new feature vector is processed by the K-hop topological adaptive graph convolution layer to obtain the l+1 layer feature vector.
[0070] The network training module is used to embed the node power balance constraints and node voltage magnitude constraints of the power system into the loss function of the graph neural network in the form of soft constraints. For each credible N-1 fault, a dedicated graph neural network model is trained using power flow solution data that includes normal operation state and fault state.
[0071] The power flow prediction module is used to predict the power flow distribution of the power system after each credible N-1 fault using the corresponding trained graph neural network model, for subsequent analysis.
[0072] Thirdly, the present invention also provides a computer device, comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, wherein when the programs are executed by the processors, they implement the fast N-1 fault analysis method based on graph neural networks as described in the first aspect.
[0073] Fourthly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the fast N-1 fault analysis method based on graph neural networks as described in the first aspect.
[0074] Compared with the prior art, the present invention has the following beneficial effects:
[0075] (1) Based on real-time measurement data, the parameters of the transmission line are identified to ensure the accuracy of the physical parameters of the power system diagram; the power system is transformed into a graph structure, which can naturally represent the complex topological relationships and electrical connections between the components in the power system, providing a more suitable model basis for subsequent fault analysis; the mask encoder enhances the node features of the unknown parts, thereby improving the model's ability to process incomplete or uncertain information.
[0076] (2) A graph neural network architecture based on topology adaptive graph convolution is adopted, which can automatically adapt to the topology changes of the power system. In the message passing part, local electrical characteristics are captured by the interaction and integration of neighbor node information; in the topology adaptive graph convolution part, the K-hop topology adaptive graph convolution layer is used to process feature vectors, which can capture long-distance dependencies in the power system and better reflect the global characteristics of the power system.
[0077] (3) During training, the node power balance constraints and node voltage amplitude constraints of the power system are embedded into the loss function of the graph neural network in the form of soft constraints. This combines physical knowledge with data-driven methods, which not only utilizes a large amount of power flow calculation data, but also ensures that the prediction results of the model conform to the physical laws of the power system, thereby improving the reliability and generalization ability of the model.
[0078] (4) By training a specialized GNN model to predict branch power flow after a fault, the repetitive online power flow calculations in traditional methods are avoided, significantly improving computational efficiency. Utilizing the powerful learning capabilities of GNNs and their effective use of power system graph structures, branch power flow after a fault can be accurately predicted, meeting the needs of practical applications.
[0079] (5) The proposed GNN model has good scalability and can be applied to larger-scale power systems. In addition, the framework proposed in this invention can be combined with other relevant factors (such as dynamic stability assessment) to further expand its application scope. Attached Figure Description
[0080] Figure 1 This is a flowchart of the method of the present invention;
[0081] Figure 2 This is a structural diagram of a mask encoder;
[0082] Figure 3 This is a graph neural network architecture diagram based on topology adaptive graph convolution. Detailed Implementation
[0083] The technical solutions in the embodiments of the present invention will now be clearly and completely described in conjunction with the accompanying drawings.
[0084] This invention provides a fast N-1 fault analysis method based on graph neural networks, referring to... Figure 1 The method includes the following steps:
[0085] Step 1: Transmission line parameter identification. The particle swarm optimization algorithm is used to identify transmission line parameters based on real-time measurement data, ensuring the accuracy of the physical parameters in the power system diagram. This includes the following steps:
[0086] 11) Initialize the particle swarm. Each particle represents a set of candidate parameters μ.h =[G h B h ], where G h B represents the line conductance. h Represents the line susceptance; H particles are randomly generated (1≤h≤H), and the initial velocity v of each particle is randomly set. h ;
[0087] 12) Define the fitness function. The fitness function is the root mean square error (RMSE) of the measurement error:
[0088]
[0089] Where h(·) is the line model equation, z p Let u be the measurement data of the p-th sample (voltage V, current I, active power P, reactive power Q), where P is the total number of measurement data samples. p This is the input used to calculate the predicted value for the p-th sample.
[0090] Using the current particle parameter μ h The predicted value h(μ) is calculated using the line model. h ,u p Compare the predicted value with the actual measured value z. p Calculate RMSE;
[0091] 13) At each iteration, calculate the fitness value of each particle. If the current fitness is better than the historical best value, then update the individual's best value p. best =μ h The particle with the best fitness in the population is selected as the global optimum g. best Update the velocity and position of each particle according to the following formula:
[0092]
[0093] Where ω is the inertia weight, c1 and c2 are learning factors, and r1 and r2 are random numbers taking values within [0,1].
[0094] If the parameters exceed the search space, force the parameters to be pulled back to the boundary.
[0095] 14) Terminate when the maximum number of iterations is reached or the change in the global optimal fitness is less than the threshold.
[0096] Step 2: Construct a power system graph, representing the buses and transmission lines in the power system as nodes and edges in the graph, and extract node and edge features, including the following steps:
[0097] 21) Establish nodes and edges.
[0098] Each bus in the system is considered a node in a graph, denoted as n. i (i = 1, 2, ..., N), where N is the total number of buses. For each transmission line, it is considered as an edge connecting two nodes in the graph, denoted as ε. ij (i,j=1,2,...,N), where i and j are the node numbers of the two nodes connected by the edge.
[0099] 22) Extract node features.
[0100] For each node n i Extracting the active power P of the load i Reactive power of load Q i Voltage amplitude |V i |and voltage phase angle θ i As a fundamental feature, the node feature vector x i It can be represented as;
[0101] x i =[P i Q i ,|V i |,θ i (4)
[0102] 23) Extract edge features.
[0103] For each edge ε ij Extract the line conductance G that describes its physical characteristics. ij and line susceptance B ij As a fundamental feature. Here G ij and B ij All of these are results obtained from parameter identification in step one. Therefore, the edge feature vector can be represented as:
[0104] e ij =[G ij B ij (5)
[0105] 24) Establish the relationship between nodes and edges.
[0106] Based on the actual connection situation of the power system, an adjacency matrix is used to establish the connection relationship between nodes and edges. The element A in the i-th row and j-th column of the adjacency matrix... ij =1 indicates that there is an edge between node i and node j, A ij =0 indicates that there is no edge between node i and node j.
[0107] 25) Complete the construction of the power system diagram.
[0108] By integrating all nodes, edges, and feature information, a complete power system graph G is formed, which can be represented as:
[0109] G=(N,ε,x,e) (6)
[0110] Where N represents the set of nodes, ε represents the set of edges, x represents the set of node features, and e represents the set of edge features.
[0111] Step 3: Process known and unknown features using a mask encoder, including the following steps:
[0112] 31) Define the mask vector.
[0113] For each node n i Define a mask vector
[0114] m i ∈{0,1} d (7)
[0115] Where d is the number of node features; the mask vector m i The elements in the mask vector m indicate whether the corresponding feature is known. If the feature is known, the corresponding element is 0; if the feature is unknown, the corresponding element is 1. For example, for a node with 4 features, if the first two features are known and the last two features are unknown, then the mask vector m... i The value is [0,0,1,1]. Note that the edge features are known fixed features and do not require masking.
[0116] 32) Convert the mask vector.
[0117] Use a mask encoder to transform the mask vector m i Transform into a continuous feature vector m i This can be achieved using a fully connected layer:
[0118] m i ′=W1(σ(W0m i +b0))+b1 (8)
[0119] Where W0 and W1 are weight matrices, b0 and b1 are bias terms, and σ is an activation function, such as ReLU or sigmoid;
[0120] 33) The output of the mask encoder is fused with the original features.
[0121] The output m of the mask encoder i ′ and original feature x i Perform concatenation or addition operations to obtain the encoded feature vector x. i ":
[0122] x i " = x i +m i ′ (9)
[0123] Encoding feature vector x i "It contains both known and unknown parts of the node features, where the unknown parts are masked and encoded by the vector m." i 'Enhance;
[0124] 34) Input the encoded feature vector into the graph neural network for further processing.
[0125] The structure of the mask encoder is as follows Figure 2 As shown.
[0126] Step 4: Construct a graph neural network architecture based on topology-adaptive graph convolution, including the following steps:
[0127] 41) One-hop message passing. Each node receives information from its neighboring nodes, performs local computation, and then passes the updated information to its neighboring nodes;
[0128] For each node i, the message it receives is calculated using the following formula:
[0129]
[0130] in, Let N(i) represent the feature vector of node i in the l-th layer, and let N(i) represent the set of neighboring nodes of node i. σ represents the eigenvector of edge (i,j), containing the conductance and susceptance of the line. σ represents a nonlinear activation function, such as ReLU. These are trainable parameters. [·] indicates feature concatenation.
[0131] The feature vector after message passing With the original feature vector X l Adding them together yields a new feature vector:
[0132]
[0133] 42) Use a K-hop topological adaptive graph convolutional layer to process the new feature vectors and obtain the feature vectors of the next layer;
[0134] The formula is as follows:
[0135]
[0136] Where S = D -1 / 2 AD -1 / 2 It is the normalized adjacency matrix, and K is the order of the adjacency matrix A established in step 24). σ represents the learnable weights at each order, and σ represents the non-linear activation function, such as ReLU.
[0137] 43) Repeat steps 41) and 42) until the predetermined number of layers L is reached.
[0138] 44) In the last layer, layer L, only step 41) is used, and step 42) is not used, to obtain the final node feature vector. The final node feature vector is the power flow distribution of the power system predicted by the neural network under a certain credible N-1 fault.
[0139] Graph neural network architecture based on topology adaptive graph convolution, such as Figure 3 As shown, the coded diagram refers to the power system diagram after step three, and the output diagram is the power system diagram after step four.
[0140] Step 5: Embed the nodal power balance constraints and nodal voltage magnitude constraints of the power system into the loss function of the graph neural network in the form of soft constraints, including the following steps:
[0141] 51) Define the basic loss function. Traditional supervised loss (such as mean squared error) is used to fit the power flow data.
[0142]
[0143] Where M is the total number of samples in the training set of the graph neural network. For the power flow of the m-th sample predicted by the graph neural network, y m This is the actual value.
[0144] 52) Define the physical constraint loss function.
[0145] Node power balance constraints: predicted power flow Node power balance (Kirchhoff's laws) must be satisfied.
[0146] L power =||P calc -P inj || 2 +||Q calc -Q inj || 2 (14)
[0147] Where P calc Q calc It is the active and reactive power injection vector calculated using the AC power flow equations. P inj Q inj These are known active and reactive power injection vectors. The formulas for calculating the active and reactive power injection of the i-th node in a power network are as follows:
[0148]
[0149] Where j is the node connected to node i, θij =θ i -θ j G represents the phase angle difference between node i and node j. ij B ij Let be the conductance and susceptance of branch ij, respectively.
[0150] Voltage amplitude constraint: The node voltage must meet the voltage amplitude constraint.
[0151]
[0152] in V represents the node voltage magnitude predicted by the graph neural network. max V min These represent the maximum and minimum node voltages, respectively.
[0153] 53) Define the joint loss function.
[0154] L total =L data +λ1L power +λ2L voltage (18)
[0155] λ1 and λ2 are weight hyperparameters used to balance fitting accuracy and physical consistency.
[0156] Step Six: Train a dedicated graph neural network model for each credible N-1 fault, including the following steps:
[0157] 61) Data Preparation. Collect power flow calculation data under normal operating conditions. For each credible N-1 fault scenario, collect corresponding power flow calculation data under the fault condition. Perform necessary data preprocessing.
[0158] 62) Split the dataset. Divide the dataset into a training set, a validation set, and a test set;
[0159] 63) Construct a power system graph, combine it with a mask encoder to process known and unknown features, and build a graph neural network architecture based on topology adaptive graph convolution;
[0160] 64) Embed the nodal power balance constraints and nodal voltage magnitude constraints of the power system into the loss function of the graph neural network in the form of soft constraints;
[0161] 65) Train the model. Train the model using the training set data. At the end of each epoch, evaluate the model's performance using the validation set and adjust hyperparameters as needed. Stop training when the model's performance on the validation set no longer improves.
[0162] 66) Application Model. For each credible N-1 fault, a trained graph neural network model is used to predict the power flow distribution of the power system after the fault, for subsequent analysis.
[0163] Table 1 shows the prediction performance of various power flow types under N-1 fault conditions for systems of different sizes using a fast N-1 fault analysis method and system based on graph neural networks. RMSE represents the root mean square error.
[0164] Table 1 Power flow prediction performance under N-1 fault conditions in systems of different scales
[0165]
[0166] Table 2 shows the overall power flow prediction performance of a fast N-1 fault analysis method and system based on graph neural networks under N-1 fault conditions for systems of different sizes. GraphSAGE, GAT, and GCN are all graph neural network algorithms, but their specific implementations differ from the method proposed in this invention. MAPE represents the mean absolute percentage error.
[0167] Table 2 Overall power flow prediction performance under N-1 fault conditions in systems of different scales.
[0168]
[0169] As can be seen from Table 2, the method proposed in this invention has a smaller prediction error and better prediction performance compared to other graph neural network algorithms.
[0170] Table 3 shows the computation time of a fast N-1 fault analysis method and system based on graph neural networks for 30,000 test samples of a 118-node system. NR represents the iterative method used in numerical analysis to solve nonlinear equation systems.
[0171] Table 3. Computation time for 30,000 test samples in the 118-node system
[0172]
[0173] As can be seen from Table 3, the method proposed in this invention has a superior computational speed advantage compared to the numerical analysis iterative solution method.
[0174] The efficient computing and accurate prediction capabilities of this invention enable real-time N-1 security analysis, providing grid operators with more timely information and helping them quickly identify potential risks and take effective measures, thereby improving the operational safety and reliability of the power grid.
[0175] Based on the same technical concept as the method embodiment, another embodiment of the present invention provides a fast N-1 fault analysis system based on graph neural networks, comprising:
[0176] The line parameter identification module is used to identify transmission line parameters based on real-time measurement data using the particle swarm optimization algorithm.
[0177] The power system graph construction module is used to treat each bus in the power system as a node in the graph, and each transmission line as an edge connecting two nodes in the graph. Based on the identification results of transmission line parameters, node features and edge features are extracted to construct the power system graph.
[0178] The mask encoder module is used to enhance the features of unknown parts based on whether the node features in the power system diagram are known, and obtain the encoded feature vector.
[0179] The network construction module is used to build a graph neural network architecture based on topology-adaptive graph convolution. This architecture includes a message-passing part and a topology-adaptive graph convolution part. In the message-passing part, each node in layer l receives information from its neighboring nodes, performs local computation, and then passes the updated information to its neighboring nodes, along with the updated feature vector. With the original feature vector X l The features are added together to obtain a new feature vector. In the topological adaptive graph convolution part, the new feature vector is processed by the K-hop topological adaptive graph convolution layer to obtain the l+1 layer feature vector.
[0180] The network training module is used to embed the node power balance constraints and node voltage magnitude constraints of the power system into the loss function of the graph neural network in the form of soft constraints. For each credible N-1 fault, a dedicated graph neural network model is trained using power flow solution data that includes normal operation state and fault state.
[0181] The power flow prediction module is used to predict the power flow distribution of the power system after each credible N-1 fault using the corresponding trained graph neural network model, for subsequent analysis.
[0182] It should be understood that the fast N-1 fault analysis system based on graph neural networks in this embodiment can implement all the technical solutions in the above method embodiments. The functions of each functional module can be specifically implemented according to the methods in the above method embodiments. The specific implementation process can be referred to the relevant descriptions in the above embodiments, which will not be repeated here.
[0183] Another embodiment of the present invention provides a computer device, including: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the programs, when executed by the processors, implement the fast N-1 fault analysis method based on graph neural networks as described above.
[0184] Another embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the fast N-1 fault analysis method based on graph neural networks as described above.
[0185] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus (systems), computer devices, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0186] This invention is described with reference to a flowchart of a method according to embodiments of the invention. It should be understood that each step in the flowchart and combinations thereof can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the process. Figure 1 A device for a function specified in one or more processes.
[0187] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 The function specified in one or more processes.
[0188] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 Steps of a specified function in one or more processes.
Claims
1. A fast N-1 fault analysis method based on graph neural networks, characterized in that, Includes the following steps: Particle swarm optimization algorithm is used to identify transmission line parameters based on real-time measurement data; Each bus in the power system is regarded as a node in the graph, and each transmission line is regarded as an edge connecting two nodes in the graph. Based on the identification results of transmission line parameters, node features and edge features are extracted to construct the power system graph. Based on whether the node features in the power system diagram are known, a mask encoder is used to enhance the features of the unknown parts to obtain the encoded feature vector. A graph neural network architecture based on topology-adaptive graph convolution is constructed. This architecture includes a message-passing part and a topology-adaptive graph convolution part. In the message-passing part, each node in layer l receives information from its neighboring nodes, performs local computation, and then passes the updated information to its neighboring nodes, along with the updated feature vector. With the original feature vector X l The features are added together to obtain a new feature vector. In the topological adaptive graph convolution part, the new feature vector is processed by the K-hop topological adaptive graph convolution layer to obtain the l+1 layer feature vector. The node power balance constraints and node voltage magnitude constraints of the power system are embedded into the loss function of the graph neural network in the form of soft constraints. For each credible N-1 fault, a dedicated graph neural network model is trained using power flow solution data that includes normal operation state and fault state. For each credible N-1 fault, a corresponding trained graph neural network model is used to predict the power flow distribution of the power system after the fault, for subsequent analysis.
2. The fast N-1 fault analysis method based on graph neural networks according to claim 1, characterized in that, The following steps are taken to identify transmission line parameters using the particle swarm optimization algorithm based on real-time measurement data: (1) Initialize the particle swarm: Each particle represents a set of candidate parameters μ h =[G h B h H particles are randomly generated, where 1 ≤ h ≤ H, and the initial velocity v of each particle is randomly set. h ; where G h B represents the line conductance. h Represents line susceptance; (2) Define the fitness function: The fitness function is the root mean square error (RMSE) of the measurement error. Where h(·) is the line model equation, z p Let u be the measurement data of the p-th sample, where P is the total number of measurement data samples. p This is the input used to calculate the predicted value for the p-th sample; Using the current particle parameter μ h The predicted value h(μ) is calculated using the line model. h ,u p Compare the predicted value with the actual measured value z. p Calculate RMSE; (3) At each iteration, calculate the fitness value of each particle. If the current fitness is better than the historical best value, then update the individual's best value p. best =μ h The particle with the best fitness in the population is selected as the global optimum g. best Update the velocity and position of each particle according to the following formula: Where ω is the inertia weight, c1 and c2 are learning factors, and r1 and r2 are random numbers taking values within [0,1]. If the parameters exceed the search space, force the parameters to be pulled back to the boundary. (4) Terminate when the maximum number of iterations is reached or the change in the global optimal fitness is less than the threshold.
3. The fast N-1 fault analysis method based on graph neural networks according to claim 1, characterized in that, The power system diagram G is represented as follows: G = (N, ε, x, e) Where N represents the set of nodes, ε represents the set of edges, x represents the set of node features, and e represents the set of edge features; For node n i Node feature vector x i Represented as: x i =[P i ,Q i ,|V i |,θ i ] Where P i Q represents the active power of the load. i For the reactive power of the load, |V i | represents the voltage amplitude, θ i This refers to the voltage phase angle; For each edge ε ij The edge feature vector is represented as: e ij =[G ij ,B ij ] Among them G ij B is the line conductance obtained after parameter identification. ij The line susceptance is obtained after parameter identification.
4. The fast N-1 fault analysis method based on graph neural networks according to claim 1, characterized in that, Feature enhancement of unknown parts is performed using a mask encoder, including: For each node n i Define a mask vector m i ∈{0,1} d Where d is the number of node features; and the mask vector m i The elements indicate whether the corresponding feature is known, with 0 indicating known and 1 indicating unknown; Use a mask encoder to mask vector m i Transform into a continuous feature vector m i This can be achieved using a fully connected layer. m i ′=W1(σ(W0m i +b0))+b1 Where W0 and W1 are weight matrices, b0 and b1 are bias terms, and σ is the activation function; The output m of the mask encoder i ′ and original feature x i Perform concatenation or addition operations to obtain the encoded feature vector x. i ": x i ″=x i +m i ′ Encoding feature vector x i "It contains both known and unknown parts of the node features, where the unknown parts are masked and encoded by the vector m." i Enhance.
5. The fast N-1 fault analysis method based on graph neural networks according to claim 1, characterized in that, In the message passing section, for each node i, the message it receives is calculated using the following formula: in, Let N(i) represent the feature vector of node i in the l-th layer, and let N(i) represent the set of neighboring nodes of node i. The eigenvector of edge (i,j) contains the conductance and susceptance of the line; σ represents the nonlinear activation function. These are trainable parameters; [·] indicates feature concatenation.
6. The fast N-1 fault analysis method based on graph neural networks according to claim 1, characterized in that, In the topology-adaptive graph convolution part, the feature vector calculation formula is as follows: Where S = D -1 / 2 AD -1 / 2 It is the normalized adjacency matrix, and K is the order of the adjacency matrix A. σ represents the learnable weights at each order, and σ denotes the nonlinear activation function.
7. The fast N-1 fault analysis method based on graph neural networks according to claim 1, characterized in that, The nodal power balance constraints and nodal voltage magnitude constraints of the power system are embedded in the loss function of the graph neural network in the form of soft constraints, as follows: (1) Define the basic loss function to fit the power flow data: Where M is the total number of samples in the training set of the graph neural network. For the power flow of the m-th sample predicted by the graph neural network, y m The actual value; (2) Define the physical constraint loss function: Node power balance constraints: predicted power flow Node power balance must be satisfied: 50 power =||P calc -P inj ‖ 2 +‖Q calc -Q inj ‖ 2 Where P calc Q calc It is the active and reactive power injection vector calculated through the AC power flow equations; P inj Q inj These are known active and reactive power injection vectors; the formulas for calculating the active and reactive power injection of the i-th node in the power network are as follows: Where j is the node connected to node i, θ ij =θ i -θ j G represents the phase angle difference between node i and node j. ij B ij These are the conductance and susceptance of branch ij, respectively; Voltage amplitude constraint: Node voltages must meet the voltage amplitude constraint: in V represents the node voltage magnitude predicted by the graph neural network. max V min These represent the maximum and minimum node voltages, respectively. (3) Define the joint loss function: L total =L data +λ1L power +λ2L voltage λ1 and λ2 are weight hyperparameters used to balance fitting accuracy and physical consistency.
8. A fast N-1 fault analysis system based on graph neural networks, characterized in that, include: The line parameter identification module is used to identify transmission line parameters based on real-time measurement data using the particle swarm optimization algorithm. The power system graph construction module is used to treat each bus in the power system as a node in the graph, and each transmission line as an edge connecting two nodes in the graph. Based on the identification results of transmission line parameters, node features and edge features are extracted to construct the power system graph. The mask encoder module is used to enhance the features of unknown parts based on whether the node features in the power system diagram are known, and obtain the encoded feature vector. The network construction module is used to build a graph neural network architecture based on topology-adaptive graph convolution. This architecture includes a message-passing part and a topology-adaptive graph convolution part. In the message-passing part, each node in layer l receives information from its neighboring nodes, performs local computation, and then passes the updated information to its neighboring nodes, along with the updated feature vector. With the original feature vector X l The features are added together to obtain a new feature vector. In the topological adaptive graph convolution part, the new feature vector is processed by the K-hop topological adaptive graph convolution layer to obtain the l+1 layer feature vector. The network training module is used to embed the node power balance constraints and node voltage magnitude constraints of the power system into the loss function of the graph neural network in the form of soft constraints. For each credible N-1 fault, a dedicated graph neural network model is trained using power flow solution data that includes normal operation state and fault state. The power flow prediction module is used to predict the power flow distribution of the power system after each credible N-1 fault using the corresponding trained graph neural network model, for subsequent analysis.
9. A computer device, comprising: One or more processors; Memory; And one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, wherein when the programs are executed by the processors, they implement the fast N-1 fault analysis method based on graph neural networks as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the fast N-1 fault analysis method based on a graph neural network as described in any one of claims 1-7.