A graph neural network power flow calculation method, system, and device
By embedding power equations into graph neural networks, power flow and data-driven messages are constructed and fused, solving the efficiency and accuracy problems of power flow calculation in large-scale power grid systems. This achieves high-precision power flow calculation and real-time status awareness, adapting to changes in power grid topology and load fluctuations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG UNIV
- Filing Date
- 2026-06-03
- Publication Date
- 2026-07-03
AI Technical Summary
Existing power flow calculation methods suffer from low computational efficiency, difficulty in convergence, and insufficient accuracy in large-scale power grid systems. In particular, traditional mathematical algorithms and neural network algorithms perform poorly when dealing with complex power grid topologies and load fluctuations.
By embedding power equations using graph neural networks, constructing power flows and data-driven messages, weighted fusion using a gated recurrent algorithm, and mapping power flow calculation results using a multilayer perceptron, the accuracy and efficiency of computation are improved by combining physical laws and data characteristics.
It achieves high-precision power flow calculation under complex power grid conditions, has real-time status awareness and online security assessment capabilities, meets the rapid decision-making needs of smart grids, and has high model transparency, adapting to topology changes and load fluctuations.
Smart Images

Figure CN122334342A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power system operation technology, and in particular to a graph neural network power flow calculation method, system and device. Background Technology
[0002] In recent years, existing power flow calculation methods based on traditional mathematical algorithms have proven insufficient to meet the demands of future power grid development due to their high computational overhead from repeated iterations and difficulties in convergence under large-scale systems. Specifically, while the Newton-Raphson method offers fast convergence and high accuracy, it is sensitive to initial conditions and prone to convergence difficulties when dealing with large-scale or ill-conditioned systems. The Gauss-Seidel method, despite its simple structure, suffers from slow convergence, making it unsuitable for real-time computation. Secondly, existing neural network-based power flow algorithms, while computationally fast, suffer from insufficient accuracy. Specifically, RNNs (Recurrent Neural Networks) and CNNs (Convolutional Neural Networks) have inherent limitations in their network structure, failing to fully represent the power grid topology. GNNs (Graph Neural Networks) can take power grid topology information as input, depicting more node connections and branch information, but their poor physical interpretability makes it difficult to understand the physical principles of power flow, thus affecting the accuracy of power flow calculations.
[0003] Therefore, ensuring the accuracy and efficiency of power flow calculation is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0004] The purpose of this application is to provide a graph neural network power flow calculation method, system, and electronic device that can guarantee the accuracy and computational efficiency of power flow calculation.
[0005] To address the aforementioned technical problems, this application provides a graph neural network power flow calculation method, the specific technical solution of which is as follows: The initial power flow values are input into a graph neural network that embeds the power equation; The graph neural network is invoked to construct and aggregate power flow messages, parameterizing the voltage magnitude and voltage phase angle in the power formula; wherein, the graph neural network is used to parameterize the voltage magnitude and phase angle included in the power formula, and the power flow messages are used to characterize the node injected power; The graph neural network is invoked to construct and aggregate data-driven messages, which are used to characterize the flow characteristics of the data. The data-driven message and the power flow message are weighted and fused using a gated loop algorithm to obtain a fused high-dimensional feature matrix; The fused high-dimensional feature matrix output by the graph neural network is mapped to the power flow calculation result using a multilayer perceptron.
[0006] Optionally, inputting the initial power flow values into the graph neural network embedded with the power equation includes: The initial values of node power flow, adjacency matrix, and edge features are input into a graph neural network embedded with power equations. The initial values of node power flow include the active power, reactive power, voltage amplitude, voltage phase angle, node ground conductance, and node ground susceptance of each node. Before power flow calculation, the unknown active power and reactive power are initialized to 0, the voltage amplitude is initialized to 1, and the voltage phase angle is initialized to the phase angle under DC power flow. The edge features include the series conductance, series susceptance, parallel conductance, and parallel susceptance of the equivalent circuit.
[0007] Optionally, invoking the graph neural network to construct and aggregate power flow messages includes: In the graph neural network, a message constructor is generated based on the branch power equation of AC power flow and the node adjacency matrix. The message constructor is used to construct a power flow message from the source node to the target node for all adjacent source nodes of each target node. The power flow message includes the transmitted power on the series branch in the equivalent circuit, as well as the active power injection and reactive power injection on the parallel branch. Calculate the power injected by the target node grounding parallel device; During the aggregation of the power flow messages, an injection power aggregation function is generated based on the transmission power on the branch and the power of the parallel devices on the node. The power flow messages are then aggregated using the power aggregation function. The aggregated power flow messages are used to characterize the electrical information of the injected power at the corresponding node.
[0008] Optionally, invoking the graph neural network to construct and aggregate data-driven messages includes: In the graph neural network, a weighted generator based on a multilayer perceptron structure is used to generate a weight matrix from the edge feature data of the input branch series conductance and parallel conductance, which serves as the data-driven message. The data-driven information of adjacent nodes is aggregated using a summation function to obtain the aggregated data-driven information.
[0009] Optionally, the data-driven message and the power flow message are weighted and fused using a gated loop algorithm to obtain a fused high-dimensional feature matrix, including: An update gate and a reset gate are generated based on the aggregated data-driven information; Candidate doors are generated based on the reset doors; The update gate, the reset gate, the data-driven message, and the aggregated power flow message are weighted and fused to obtain a fused high-dimensional feature matrix.
[0010] Optional, also includes: Residual connections are added between the layers of the graph neural network; these residual connections are used to preserve the original information related to power flow calculation.
[0011] This application also provides a graph neural network power flow calculation system, including: The data input module is used to input the initial power flow values into the graph neural network embedded with the power equation; The first construction aggregation module is used to call the graph neural network to construct and aggregate power flow messages, and parameterize the voltage amplitude and voltage phase angle in the power formula; wherein, the graph neural network is used to parameterize the voltage amplitude and phase angle included in the power formula, and the power flow messages are used to characterize the node injected power; The second construction and aggregation module is used to call the graph neural network to construct and aggregate data-driven messages, which are used to characterize the flow characteristics of data. The fusion module is used to use a gated loop algorithm to weighted fuse the data-driven message and the power flow message to obtain a fused high-dimensional feature matrix; The mapping module is used to map the fused high-dimensional feature matrix output by the graph neural network into power flow calculation results using a multilayer perceptron.
[0012] Optionally, the data input module includes: The input unit is used to input the initial values of node power flow, adjacency matrix, and edge features into the graph neural network embedded with the power equation. The initial values of node power flow include the active power, reactive power, voltage amplitude, voltage phase angle, node ground conductance, and node ground susceptance of each node. Before the power flow calculation, the unknown active power and reactive power are initialized to 0, the voltage amplitude is initialized to 1, and the voltage phase angle is initialized to the phase angle under DC power flow. The edge features include the series conductance, series susceptance, parallel conductance, and parallel susceptance of the equivalent circuit.
[0013] Optionally, the first construction aggregation module includes: The construction unit is used in the graph neural network to generate a message constructor based on the branch power equation of AC power flow and the node adjacency matrix. The message constructor is used to construct a power flow message from the source node to the target node for all adjacent source nodes of each target node. The power flow message includes the transmitted power on the series branch in the equivalent circuit, as well as the active power injection and reactive power injection on the parallel branch. A calculation unit is used to calculate the power injected by the grounding parallel device of the target node; The first aggregation unit is used to generate an injection power aggregation function based on the transmission power on the branch and the power of the parallel devices on the node when the power flow message is aggregated, and to aggregate the power flow message using the power aggregation function; the aggregated power flow message is used to characterize the electrical information of the injected power of the corresponding node.
[0014] This application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described above when it invokes the computer program in the memory.
[0015] This application provides a graph neural network power flow calculation method, comprising: inputting initial power flow values into a graph neural network embedded with power equations; calling the graph neural network to construct and aggregate power flow messages, and parameterizing the voltage magnitude and voltage phase angle in the power formula; wherein, the graph neural network is used to parameterize the voltage magnitude and phase angle included in the power formula, and the power flow messages are used to characterize the node injected power; calling the graph neural network to construct and aggregate data-driven messages, the data-driven messages being used to characterize the power flow characteristics of the data; using a gated loop algorithm to weightedly fuse the data-driven messages and the power flow messages to obtain a fused high-dimensional feature matrix; and using a multilayer perceptron to map the fused high-dimensional feature matrix output by the graph neural network into power flow calculation results.
[0016] This application deeply integrates the physical mechanism of traditional power flow calculation with the representation learning capability of graph neural networks. Regarding computational accuracy and convergence, by inputting initial power flow values into a graph neural network embedded with power equations and parameterizing voltage amplitude and phase angle in the power formula at each layer, it effectively avoids non-physical interpretations that may arise from purely data-driven methods, significantly improving the computational accuracy and numerical stability of the algorithm when facing complex operating conditions such as topology changes and load fluctuations. Simultaneously, by using a gated loop algorithm to weightedly fuse data-driven messages, it can adaptively capture dependencies in time series or spatial dimensions. Secondly, this application transforms the construction and aggregation process of power flow messages into parallel information interaction between nodes through the inter-layer message passing mechanism of the graph neural network. It uses aggregation functions to efficiently aggregate the transmitted active and reactive power messages to the target node, and obtains the power flow calculation results through a multilayer perceptron encoder. The graph-based forward propagation method avoids time-consuming matrix inversion operations, achieving an approximately linear relationship between computational complexity and grid scale, thus meeting the stringent latency requirements of smart grids for real-time state perception and rapid decision-making. Meanwhile, this application constructs a dual-channel information system of power flow messages and data-driven messages. Power flow messages characterize the physical nature of node-injected power, while data-driven messages are used to mine implicit power flow distribution characteristics from historical operating data. The deep fusion of these two types of messages under a gating mechanism allows the model to retain the extrapolation capability of the physical model. The hybrid-driven architecture exhibits superior generalization performance compared to a single physical model or a pure black-box neural network. Since voltage amplitude and phase angle information are explicitly decoded from the fused high-dimensional feature matrix, rather than being implicitly generated by the neural network, dispatching operators can understand and track the physical transformation process from input electrical quantities to output state quantities, meeting the requirements of algorithm transparency and security authentication for critical power system control decisions. Therefore, this application achieves a synergistic improvement in power flow calculation accuracy, speed, robustness, and interpretability while ensuring the physical consistency of the calculation results, providing strong technical support for real-time power grid situational awareness, online security assessment, and optimized control in the context of high-proportion renewable energy access.
[0017] This application also provides a graph neural network power flow calculation system and electronic device, which have the above-mentioned beneficial effects, and will not be elaborated here. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0019] Figure 1 A flowchart of a graph neural network power flow calculation method provided in this application embodiment; Figure 2 This is a schematic diagram of the graph neural network structure for embedding power equations provided in an embodiment of this application; Figure 3 This is a flowchart of the graph neural network calculation for the embedded power equation provided in an embodiment of this application; Figure 4 This is a schematic diagram of a graph neural network power flow calculation system provided in an embodiment of this application; Figure 5 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0021] A typical power system usually consists of generators, transformers, loads, and transmission lines. In power flow calculations, the complex power system is often represented as a circuit with conductivity and susceptance. Power flow calculations involve solving for the voltage and power distributions of a given operating condition and system topology. This involves solving a set of nonlinear equations describing the coupling relationships between active power, reactive power, voltage magnitude, and phase angle, as shown in the following equation.
[0022] ; ; Classical power flow algorithms, such as the Newton-Raphson method, construct the Jacobian matrix and iteratively correct the state variables by performing first-order Taylor linearization of the nonlinear power flow equations at the current operating point. This is achieved by calculating the active power imbalance from the original input data. Reactive power imbalance and the square root of the power imbalance between the two To measure the accuracy of power flow calculations. If Less than the threshold If the power imbalance is greater than the threshold, the power flow result is calculated by calculating the power of all nodes and lines. If the power imbalance is greater than the threshold, the power flow result is iteratively corrected, the power imbalance is recalculated, and the data output will finally meet the standard.
[0023] This application calculates the voltage amplitude of each node using an algorithm. and phase angle The power imbalance is calculated from the node voltage magnitude and phase angle output by the algorithm of this application. The calculation results obtained by the Newton-Raphson method are used as standard power flow results and as reference data for the algorithm in this application.
[0024] This application embeds the power equation into the message generation function in the graph neural network module, and uses the encoder and decoder to aggregate the branch power flow of neighboring nodes to extract important power flow features of power systems with different topologies. The neural network with embedded physical formulas is more in line with the physical characteristics of power flow, enhances the ability to express power flow mapping relationships, and improves the accuracy of power flow calculation.
[0025] Existing power flow calculation methods based on traditional mathematical algorithms suffer from high computational overhead due to repetitive iterations and convergence difficulties in large-scale systems, making them unsuitable for the future needs of power grid development. Specifically, while the Newton-Raphson method offers fast convergence and high computational accuracy, it is sensitive to initial conditions and prone to convergence difficulties when dealing with large-scale or ill-conditioned systems; the Gauss-Seidel method, although simple in structure, has a slow convergence speed, making it difficult to meet real-time computing requirements.
[0026] While existing neural network-based power flow algorithms are computationally fast, they suffer from insufficient accuracy. Specifically, RNNs and CNNs have an inherent limitation: their network structures cannot fully represent the power grid topology. GNNs can take power grid topology information as input and depict more node connections and branch information, but their physical interpretability is poor, making it difficult to understand the physical principles of power flow itself, which to some extent affects the accuracy of power flow calculations.
[0027] See Figure 1 , Figure 1 A flowchart of a graph neural network power flow calculation method provided in this application embodiment, the method including: S101: Input the initial power flow values into a graph neural network that embeds the power equation; S102: The graph neural network is invoked to construct and aggregate power flow messages, and the voltage amplitude and voltage phase angle in the power formula are parameterized; wherein, the graph neural network is used to parameterize the voltage amplitude and phase angle contained in the power formula, and the power flow messages are used to characterize the node injected power; S103: Invoke the graph neural network to construct and aggregate data-driven messages, which are used to characterize the flow characteristics of data; S104: The data-driven message and the power flow message are weighted and fused using a gated loop algorithm to obtain a fused high-dimensional feature matrix; S105: The fused high-dimensional feature matrix output by the graph neural network is mapped to the power flow calculation result using a multilayer perceptron.
[0028] This application embeds the power equation into a message generation function within a graph neural network module, aggregating branch power flows from neighboring nodes to extract important local power flow features of power systems with different topologies. It then utilizes a multilayer perceptron to map the output power flow results, enhancing the model's ability to express nonlinear power flow mapping relationships in power systems and improving the accuracy of power flow calculations. Numerical examples demonstrate that, compared to existing methods, the proposed model further improves the accuracy of power flow calculations.
[0029] Step S101 includes a power flow algorithm architecture with stronger power flow feature extraction capabilities and higher computational accuracy, employing a Power Equations Embedded Graph Neural Network Power Flow Calculation (PEG) method. Initial power flow values are input into the graph neural network module embedding the power equations. Finally, in step S105, a Multilayer Perceptron (MLP) is used to map and output the power flow calculation results. The detailed algorithm architecture is as follows... Figure 2 As shown, Figure 2 This is a schematic diagram of the graph neural network structure with embedded power equations provided in an embodiment of this application. By embedding power equations into the graph neural network, the ability to extract features from power flow information of neighboring nodes, branch parameter information, and system topology can be improved. The embedding of power equations makes the model more physically reliable. Figure 2 In the power equation embedding diagram shown, the four outer circles represent branch power messages. A circle in the center represents , which represents the power feature matrix encoded into a high-dimensional matrix by the encoder after splicing.
[0030] Considering that power flow in a power system is affected by many factors, the following data will be input into the model: Initial power flow values. This includes the active power of each node. reactive power Voltage amplitude Voltage phase angle Node grounding conductance Node grounding susceptance In this process, all active and reactive power values not yet known before power flow calculation are initialized to 0, voltage amplitude is initialized to 1, and phase angle is initialized to the phase angle under DC power flow. An adjacency matrix is input to construct the power system's interconnections. Edge features are input. ,include Series conductance of the equivalent circuit Series susceptance Parallel conductance Parallel susceptance Physical parameters of the branch.
[0031] ; ; The output of the graph neural network embedding the power equation is the voltage magnitude of each node. and voltage phase angle In this embodiment, two sets of model parameters are used to output the voltage amplitude and voltage phase angle respectively. The output of the graph neural network... include: ; Power flow calculation in power systems is a problem of solving a system of multivariate nonlinear equations. Traditional iterative algorithms calculate the power imbalance at each node based on the power equation at each approximate solution, and reduce the power imbalance through multiple iterations. The power equation is the key link in establishing the relationship between the calculated power flow values and the actual power flow of the system. The graph neural network embedded with the power equation proposed in this application guides the graph neural network to understand the correspondence between node voltage values and power flow by embedding the power equation during message calculation, thereby improving the model's ability to extract local features of the power flow and its physical interpretability.
[0032] It should be noted that the computational process of each layer of the graph neural network embedding the power equation can be divided into three parts: power flow message construction and aggregation, data-driven message construction and aggregation, and node power flow characteristic information update. The node power flow characteristic information update involves outputting the voltage amplitude and voltage phase angle. For example... Figure 3 As shown, Figure 3 This is a flowchart of the graph neural network calculation for the embedded power equation provided in an embodiment of this application. Figure 3 middle, In This indicates the current layer, where M is the node name, which can be... Figure 3 Any one of nodes A, B, C, D, E, and F in the matrix represents the high-dimensional feature matrix output by the residual connection of nodes M in this layer. , and These are the high-dimensional feature matrices output from nodes B, D, and E after residual connection. express Figure 3 The physical parameters of the connecting line between nodes X and Y in the middle, for example... This represents the physical parameters corresponding to the connection line between node A and node C. , and Similarly, this will not be elaborated upon here. For example, the branch power message passed from adjacent node j to target node i. This represents the branch power message transmitted from source node B (which is an adjacent node of target node A) to target node A. Similarly, , and The meaning of will not be elaborated further. The active power message matrix and reactive power message matrix of node A are concatenated and then encoded into a high-dimensional power feature matrix by the encoder.
[0033] During power flow message construction, a message constructor is designed based on the branch power equations of AC power flow and the node adjacency matrix. For each target node, a power flow message is constructed from the source nodes to the target node, including all adjacent source nodes. Power transmitted in series branches and active power injected in parallel branches in the equivalent circuit Reactive power injection : ; ; in, and It represents the voltage magnitude of two nodes that are physically connected in the topology. This represents the voltage phase angle difference between the two nodes. To fully construct the power flow relationship of the system, the power injected by the grounded parallel device is calculated at the target node: ; ; in, This represents the active power injected by the grounding parallel device at node i. This represents the reactive power injected by the grounding parallel device at node i.
[0034] When aggregating power flow messages, an injection power aggregation function is designed based on the transmitted power on the branch and the power of parallel devices on the node. The aggregated message corresponds to the electrical meaning of the injected power at the node. The power flow transmission process between nodes is designed in the neural network to guide the model to learn the relationship between power and voltage, and the power flow relationship between nodes.
[0035] In each layer of the graph neural network embedding the power equation, the voltage magnitude and phase angle in the power formula are parameterized. The voltage magnitude and phase angle information are decoded from the high-dimensional feature matrix transmitted between layers of the graph neural network. The aggregation function aggregates the transmitted power flow messages to the target node, and the multilayer perceptron (MLP) encoder encodes the aggregated active and reactive power messages into a high-dimensional vector. ; ; ; ; ; ; ; ; ; ; In the above formula, , , , On the branch roads The series conductance and susceptance of the equivalent circuit are as follows: , The equivalent conductance and susceptance of the parallel devices at each node are calculated by directly calling the stored input data during model inference. , The input layer contains the initial voltage amplitude and phase angle data, while the hidden layer contains the high-dimensional feature matrix of the nodes output from the previous layer. The voltage amplitude and phase angle are decoded by a decoder, and the decoder structure is a multilayer perceptron. and branch road Active and reactive power injection in equivalent circuits. and The active and reactive power injected into the node grounding device. The branch power message transmitted from adjacent nodes to the target node includes a message representing the active power of the branch. Branch reactive power messages , , It consists of active power information and reactive power messages obtained by aggregating from adjacent nodes and its own node. It involves concatenating the active and reactive power message matrices of a node and then encoding them into a high-dimensional power feature matrix by an encoder. This is the GELU activation function. and These represent the weight matrices of the first and second layer neurons in the voltage amplitude decoder, respectively. and These represent the weight matrices of the first and second layer neurons in the voltage phase angle decoder, respectively. and These represent the weights of neurons in the first and second layers of a message encoder based on a multilayer perceptron, respectively.
[0036] To fully exploit the power flow characteristics within the data, in addition to explicit physical-guided power flow aggregation, a data-driven message passing system is constructed as a supplement. Message construction relies on an edge weight generator with an MLP structure, which generates edge feature data from the input branches' series and parallel electrical conductance susceptance. e Generate weight matrix The summation function aggregates adjacent node messages into data-driven messages. : ; ; In the above formula, and These represent the weight matrices of the first and second layer neurons of the edge weight generator, respectively. To update the gate weight matrix, To reset the weight matrix of the gate, Let be the weight matrix of the candidate gates.
[0037] The node flow characteristic information update process introduces a gated loop unit to achieve dynamic weighted fusion of aggregated messages of physical-driven and data-driven information.
[0038] ; ; ; ; In the formula, To update the door, To reset the door, As candidate gates, The high-dimensional feature matrix is the output after fusion. It is the Sigmoid activation function. It represents the Hadamaji.
[0039] Meanwhile, in order to preserve the original information highly relevant to power flow calculations during multi-layer message passing and to alleviate the gradient vanishing problem when networks are deeply stacked, residual connections are added between layers. .in, This is the high-dimensional feature matrix of the final output from the previous layer. It is the high-dimensional feature matrix that is finally output after residual connection of this layer. The high-dimensional feature matrix output after GRU fusion.
[0040] In step S105, a multilayer perceptron is introduced when mapping and outputting the power flow result to more accurately map and regress the implicit neighborhood dependency matrix captured by the graph neural network module to the correct power flow result.
[0041] ; In the above formula, The feature matrix output by the graph neural network. y is the GELU activation function of the decoder, and y is the power flow calculation result of the final model mapping output.
[0042] This application enhances the ability to extract features of power flow information, branch parameters, and system topology from neighboring nodes by embedding a graph neural network module with power equations. It utilizes a multilayer perceptron to map power flow outputs, enabling the model to simultaneously possess topology recognition, neighborhood dependency extraction, and high-dimensional nonlinear mapping capabilities. The message passing mechanism embedded in the power equations embeds the power balance equations in AC power flow into a message generation function, generating messages representing branch power flows and aggregating them at each node, guiding the model to learn power flow relationships and power flow calculation mechanisms. By embedding the power equations into the message generation function within the graph neural network module, and aggregating the branch power flows of neighboring nodes, important local power flow features of power systems with different topologies are extracted, enhancing the model's ability to express nonlinear power flow mapping relationships and improving power flow calculation accuracy. Numerical examples show that, compared to existing methods, this application can further improve the accuracy of power flow calculation. Since graph neural networks naturally receive topology data and have a certain adaptability to topology changes, they can well fit and adapt to power system network structures. By embedding the power equations into the message passing process of the graph neural network, the neural network is guided to calculate branch power flows, thus understanding the principles of power flow calculation. By using a multilayer perceptron to map the power flow output, the model simultaneously possesses the capabilities of topology recognition, neighborhood dependency extraction, and high-dimensional nonlinear mapping.
[0043] To verify the advantages of this application, the IEEE 118-node system is used as a case study. The IEEE 118-node system includes 118 nodes, 54 generators, 99 load nodes, and 186 branches. The active power P and reactive power Q of each node are increased by 20% fluctuation, and the training set and test set are constructed at an 8:2 ratio.
[0044] The mean squared error (MSE) is used as the loss function during model training. Its mathematical properties are simple and easy to differentiate. It is also computationally efficient and converges stably during training.
[0045] ; in, The model outputs the predicted results for voltage magnitude and phase angle. The results of the standard power flow calculation are shown below, using the Newton method with a convergence criterion of 1e-8. n This represents the total number of training samples.
[0046] To comprehensively evaluate the model's performance, this application uses the following three error metrics to evaluate the power flow calculation results for node voltage magnitude and phase angle, as well as the node power imbalance: (1) Mean Absolute Error (MAE): The mean absolute error of all nodes in all samples is used to measure the overall inference accuracy of the model; ; (2) Root Mean Square Error (RMSE): The square root of the square mean of the absolute error between the calculated value and the standard value of each node in all samples. It reflects the degree of deviation between the predicted value and the true value and is more sensitive to larger errors. It is used to characterize the level of model error distribution.
[0047] ; (3) Mean Maximum Error (MME): The mean of the maximum error of all nodes in each sample is used to characterize the distribution level of the maximum error of the model and the worst performance.
[0048] ; Verification and analysis of the IEEE 118-node system: Model accuracy comparison and verification: To verify the effectiveness of the proposed method, this application trained and tested the following model with approximately 1.5M parameters, and compared the accuracy under unified experimental conditions: BFG (method of this application): The graph neural network module with embedded power equations consists of 6 message passing layers with embedded power equations.
[0049] M1: Power flow calculation is performed using a standard GCN network.
[0050] M2: PowerFlowNet is used for power flow calculation, which combines a mask encoder and a 6-hop-GNN.
[0051] All the models were trained for 80 epochs on a training set of 20,000 samples and their performance was evaluated on the same test set of 5,000 samples. The experimental results are summarized in Table 1.
[0052] Table 1. Power flow calculation errors of different models
[0053] Comparative experiments with various baseline models demonstrate that the PEG method proposed in this application exhibits significant advantages in terms of mean absolute error, root mean square error, and maximum error for various electrical quantities.
[0054] Traditional graph neural network models (M1) only possess local feature extraction capabilities. While they perform well in calculating voltage amplitudes highly correlated with local parallel devices and initial power flow values, their insufficient feature extraction capability is amplified when calculating voltage phase angles, making it difficult to accurately fit node voltage phase angles. Furthermore, since M1 is merely an approximate simulation of data distribution, it almost completely fails to learn the physical meaning of power flow distribution, resulting in significant power imbalance and power flow results that do not conform to electrical physical characteristics. The improved graph neural network power flow algorithm (M2) expands the range of local feature extraction, showing a significant improvement in voltage phase angle calculation, but its voltage amplitude calculation remains poor. The PEG model in this application incorporates a physically embedded message passing mechanism. Compared to M1, it shows a slight improvement in voltage amplitude calculation, but a significant improvement in voltage phase angle and power imbalance. This verifies that the physically embedded message passing mechanism can effectively model topology and electrical coupling relationships, better aligning with the physical laws of power flow transmission in power systems, thereby improving the accuracy of voltage amplitude and voltage phase angle calculations and better conforming to the physical constraints of power balance, resulting in a significant improvement in power balance performance.
[0055] Generalization Analysis: The power system is a high-dimensional, nonlinear, and time-varying system, and its power flow distribution is affected by various factors such as load fluctuations, output changes, and topology modifications. This paper conducts a generalization analysis on the model to evaluate its reliability and adaptability in the face of unknown disturbances and structural changes in the power system.
[0056] Generalization analysis under increased load fluctuation range: To verify the generalization ability of the proposed method under scenarios with increased active and reactive power fluctuations in the load, random disturbances of 25%, 30%, 35%, 40%, 45%, and 50% were added to the active and reactive power of each load in the test set, with a load fluctuation of 20% in the training set. The accuracy of PEG in power flow calculation on the above test set is shown in Table 2.
[0057] Table 2 Power flow calculation errors under different random disturbances
[0058] As shown in Table 2, under power flow initial value distributions not seen in the training set, the error indices of PEG and all baseline models showed a certain degree of error increase, but the increase in PEG was smaller than that of other models. In the calculation performance of voltage amplitude and power imbalance, PEG and M1 were significantly better than M2, but M1 performed the worst in voltage phase calculation. Overall, the error increase of M1 and M2 was significantly higher than that of PEG. Specifically, within a 35% load disturbance, PEG could limit the average error of voltage amplitude to within 0.002 pu (per unit), the average error of voltage phase angle to within 0.1 degrees, and the average error of power imbalance to within 0.15 pu, while M2's power flow calculation error increased rapidly under a 35% disturbance, especially the average error of power imbalance exceeding 0.3 pu. The comparison shows that the graph neural network with dynamic topology adaptation capability can provide effective power flow characteristics when the power flow initial value distribution changes, and performs better on data distributions outside the training set.
[0059] Generalization analysis under varying branch numbers: To verify the generalization ability of the proposed method under topology changes, this application randomly adds 1, 2, or 3 open branches to the test set data. These topologies did not appear during the model training phase. The power flow calculation accuracy of PEG on the above test set is shown in Table 3.
[0060] Table 3 Power flow calculation error under different branch disconnection numbers
[0061] As shown in Table 3, compared to the changes in power flow distribution caused by load fluctuations, the number of branches introduces entirely new topological structures not seen during the model training phase, significantly increasing the difficulty of model generalization. PEG maintains high computational accuracy when one branch is randomly disconnected, with average errors of 0.000378 pu for voltage amplitude, 0.2198 degrees for phase angle, and 0.1245 pu for power imbalance magnitude. When two branches are disconnected, the error of PEG increases somewhat, but it still manages to limit the average errors of voltage amplitude, phase angle, and power imbalance magnitude to within 0.001 pu, 0.4°, and 0.2 pu, respectively. The errors of M1 and M2 increase significantly. M1 performs better in terms of the increase in voltage amplitude error, but the increase in voltage phase angle error is more pronounced. M2 experiences a precipitous drop in power flow calculation accuracy when branches are disconnected; when three branches are disconnected, the errors of each electrical quantity increase by almost an order of magnitude. Because the graph convolution process of M1 cannot effectively extract the topological features of the system, it is difficult to adapt to changes in the topology. M2's graph neural network failed to understand the principles of power flow and power flow calculation. After topology changes, multi-level message passing easily leads to the accumulation of error messages, resulting in a significant increase in error. The results of this application verify that although PEG cannot avoid the impact of branch changes, compared with traditional artificial intelligence models, its embedded power flow calculation and admittance encoding improve the model's structural extraction capability. It has a stronger structural generalization ability within a certain range, demonstrating the potential of the proposed method to cope with dynamic changes in system topology in practical engineering applications.
[0062] In summary, to improve the accuracy and generalization of data-driven power flow calculation methods, this application proposes a graph neural network power flow calculation method embedding power equations, which integrates a graph neural network module embedding power equations and a power flow mapping output module based on a multilayer perceptron. Experiments on the IEEE 118-node system demonstrate that the model has the following advantages: thanks to the architecture combining the graph neural network and multilayer perceptron of PEG, PEG significantly outperforms traditional neural network models in terms of neighborhood feature capture and high-dimensional nonlinear mapping capabilities. It also has stronger computational power under varying topology and power flow distribution, resulting in significant improvements in accuracy and generalization.
[0063] See Figure 4 , Figure 4 This application provides a schematic diagram of a graph neural network power flow calculation system, which includes: The data input module is used to input the initial power flow values into the graph neural network embedded with the power equation; The first construction aggregation module is used to call the graph neural network to construct and aggregate power flow messages, and parameterize the voltage amplitude and voltage phase angle in the power formula; wherein, the graph neural network is used to parameterize the voltage amplitude and phase angle included in the power formula, and the power flow messages are used to characterize the node injected power; The second construction and aggregation module is used to call the graph neural network to construct and aggregate data-driven messages, which are used to characterize the flow characteristics of data. The fusion module is used to use a gated loop algorithm to weighted fuse the data-driven message and the power flow message to obtain a fused high-dimensional feature matrix; The mapping module is used to map the fused high-dimensional feature matrix output by the graph neural network into power flow calculation results using a multilayer perceptron.
[0064] Based on the above embodiments, in one optional embodiment, the data input module includes: The input unit is used to input the initial values of node power flow, adjacency matrix, and edge features into the graph neural network embedded with the power equation. The initial values of node power flow include the active power, reactive power, voltage amplitude, voltage phase angle, node ground conductance, and node ground susceptance of each node. Before the power flow calculation, the unknown active power and reactive power are initialized to 0, the voltage amplitude is initialized to 1, and the voltage phase angle is initialized to the phase angle under DC power flow. The edge features include the series conductance, series susceptance, parallel conductance, and parallel susceptance of the equivalent circuit.
[0065] Based on the above embodiments, in an optional embodiment, the first construction aggregation module includes: The construction unit is used in the graph neural network to generate a message constructor based on the branch power equation of AC power flow and the node adjacency matrix. The message constructor is used to construct a power flow message from the source node to the target node for all adjacent source nodes of each target node. The power flow message includes the transmitted power on the series branch in the equivalent circuit, as well as the active power injection and reactive power injection on the parallel branch. A calculation unit is used to calculate the power injected by the grounding parallel device of the target node; The first aggregation unit is used to generate an injection power aggregation function based on the transmission power on the branch and the power of the parallel devices on the node when the power flow message is aggregated, and to aggregate the power flow message using the power aggregation function; the aggregated power flow message is used to characterize the electrical information of the injected power of the corresponding node.
[0066] Based on the above embodiments, in one optional embodiment, the second construction aggregation module includes: The first generation unit is used in the graph neural network to generate a weight matrix from the input side feature data of the series and parallel conductance of the branches using an edge weight generator based on a multilayer perceptron structure, as a data-driven message. The second aggregation unit is used to aggregate the data-driven information of adjacent nodes using a summation function to obtain aggregated data-driven information.
[0067] Based on the above embodiments, in one optional embodiment, the fusion module includes: The second generation unit is used to generate update gates and reset gates based on the aggregated data-driven information. The second generation unit is used to generate candidate doors based on the reset door; The fusion unit is used to perform weighted fusion based on the update gate, the reset gate, the data-driven message, and the aggregated power flow message to obtain a fused high-dimensional feature matrix.
[0068] Based on the above embodiments, in an optional embodiment, it further includes: An addition unit is used to add residual connections between layers of the graph neural network; the residual connections are used to preserve the original information related to power flow calculation.
[0069] This application also provides an electronic device, see [link to document]. Figure 5 The present application provides a structural diagram of an electronic device, such as... Figure 5 As shown, it may include a processor 1410 and a memory 1420.
[0070] The processor 1410 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 1410 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1410 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 1410 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 1410 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0071] The memory 1420 may include one or more computer-readable storage media, which may be non-transitory. The memory 1420 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 1420 is used to store at least the following computer program 1421, which, after being loaded and executed by the processor 1410, is capable of implementing the relevant steps in the methods executed by the electronic device side as disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 1420 may also include an operating system 1422 and data 1423, etc., and the storage method may be temporary storage or permanent storage. The operating system 1422 may include Windows, Linux, Android, etc.
[0072] In some embodiments, the electronic device may further include a display screen 1430, an input / output interface 1440, a communication interface 1450, a sensor 1460, a power supply 1470, and a communication bus 1480.
[0073] certainly, Figure 5 The structure of the electronic device shown does not constitute a limitation on the electronic device in the embodiments of this application. In practical applications, the electronic device may include more than [other components]. Figure 5 More or fewer components as shown, or combinations of certain components.
[0074] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. As the system provided in the embodiments corresponds to the method provided in the embodiments, the description is relatively simple; relevant parts can be found in the method section.
[0075] This application uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of this application.
[0076] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A graph neural network power flow calculation method, characterized in that, include: The initial power flow values are input into a graph neural network that embeds the power equation; The graph neural network is invoked to construct and aggregate power flow messages, parameterizing the voltage magnitude and voltage phase angle in the power formula; wherein, the graph neural network is used to parameterize the voltage magnitude and phase angle included in the power formula, and the power flow messages are used to characterize the node injected power; The graph neural network is invoked to construct and aggregate data-driven messages, which are used to characterize the flow characteristics of the data. The data-driven message and the power flow message are weighted and fused using a gated loop algorithm to obtain a fused high-dimensional feature matrix; The fused high-dimensional feature matrix output by the graph neural network is mapped to the power flow calculation result using a multilayer perceptron.
2. The graph neural network power flow calculation method of claim 1, wherein, Inputting initial power flow values into a graph neural network that embeds the power equation includes: The initial values of node power flow, adjacency matrix, and edge features are input into a graph neural network embedded with power equations. The initial values of node power flow include the active power, reactive power, voltage amplitude, voltage phase angle, node ground conductance, and node ground susceptance of each node. Before power flow calculation, the unknown active power and reactive power are initialized to 0, the voltage amplitude is initialized to 1, and the voltage phase angle is initialized to the phase angle under DC power flow. The edge features include the series conductance, series susceptance, parallel conductance, and parallel susceptance of the equivalent circuit.
3. The graph neural network power flow calculation method of claim 1, wherein, Invoking the graph neural network to construct and aggregate power flow messages includes: In the graph neural network, a message constructor is generated based on the branch power equation of AC power flow and the node adjacency matrix. The message constructor is used to construct a power flow message from the source node to the target node for all adjacent source nodes of each target node. The power flow message includes the transmitted power on the series branch in the equivalent circuit, as well as the active power injection and reactive power injection on the parallel branch. Calculate the power injected by the target node grounding parallel device; During the aggregation of the power flow messages, an injection power aggregation function is generated based on the transmission power on the branch and the power of the parallel devices on the node. The power flow messages are then aggregated using the power aggregation function. The aggregated power flow messages are used to characterize the electrical information of the injected power at the corresponding node.
4. The graph neural network power flow calculation method of claim 3, wherein, Invoking the graph neural network to construct and aggregate data-driven messages includes: In the graph neural network, a weighted generator based on a multilayer perceptron structure is used to generate a weight matrix from the edge feature data of the input branch series conductance and parallel conductance, which serves as the data-driven message. The data-driven information of adjacent nodes is aggregated using a summation function to obtain the aggregated data-driven information.
5. The graph neural network power flow calculation method of claim 4, wherein, The data-driven message and the power flow message are weighted and fused using a gated loop algorithm to obtain a fused high-dimensional feature matrix, which includes: An update gate and a reset gate are generated based on the aggregated data-driven information; Candidate doors are generated based on the reset doors; The update gate, the reset gate, the data-driven message, and the aggregated power flow message are weighted and fused to obtain a fused high-dimensional feature matrix.
6. The graph neural network power flow calculation method according to any one of claims 1-5, characterized in that, Also includes: Add residual connections between the layers of the graph neural network; The residual connection is used to preserve the original information related to power flow calculation.
7. A graph neural network power flow computation system, characterized in that, include: The data input module is used to input the initial power flow values into the graph neural network embedded with the power equation; The first construction aggregation module is used to call the graph neural network to construct and aggregate power flow messages, and parameterize the voltage amplitude and voltage phase angle in the power formula; wherein, the graph neural network is used to parameterize the voltage amplitude and phase angle included in the power formula, and the power flow messages are used to characterize the node injected power; The second construction and aggregation module is used to call the graph neural network to construct and aggregate data-driven messages, which are used to characterize the flow characteristics of data. The fusion module is used to use a gated loop algorithm to weighted fuse the data-driven message and the power flow message to obtain a fused high-dimensional feature matrix; The mapping module is used to map the fused high-dimensional feature matrix output by the graph neural network into power flow calculation results using a multilayer perceptron.
8. The system of claim 7, wherein, The data input module includes: The input unit is used to input the initial values of node power flow, adjacency matrix, and edge features into the graph neural network embedded with the power equation. The initial values of node power flow include the active power, reactive power, voltage amplitude, voltage phase angle, node ground conductance, and node ground susceptance of each node. Before the power flow calculation, the unknown active power and reactive power are initialized to 0, the voltage amplitude is initialized to 1, and the voltage phase angle is initialized to the phase angle under DC power flow. The edge features include the series conductance, series susceptance, parallel conductance, and parallel susceptance of the equivalent circuit.
9. The system of claim 7, wherein, The first construction aggregation module includes: The construction unit is used in the graph neural network to generate a message constructor based on the branch power equation of AC power flow and the node adjacency matrix. The message constructor is used to construct a power flow message from the source node to the target node for all adjacent source nodes of each target node. The power flow message includes the transmitted power on the series branch in the equivalent circuit, as well as the active power injection and reactive power injection on the parallel branch. A calculation unit is used to calculate the power injected by the grounding parallel device of the target node; The first aggregation unit is used to generate an injection power aggregation function based on the transmission power on the branch and the power of the parallel devices on the node when the power flow message is aggregated, and to aggregate the power flow message using the power aggregation function; the aggregated power flow message is used to characterize the electrical information of the injected power of the corresponding node.
10. An electronic device, comprising: include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the method as claimed in any one of claims 1 to 6.