Alternating current optimal power flow solving method and system
By combining multi-layer graph convolutional networks and physical constraint output layers, the problems of insufficient power grid topology modeling and lax physical constraints in existing methods are solved, achieving highly accurate and reliable AC optimal power flow solutions, which are suitable for real-time scheduling and safety correction of power systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHONGSHAN POWER SUPPLY BUREAU OF GUANGDONG POWER GRID
- Filing Date
- 2026-02-11
- Publication Date
- 2026-04-28
AI Technical Summary
Existing AC optimal power flow solution methods are insufficient in their ability to model power grid topology, lack strict physical constraint guarantees, and fail to conform to the physical laws of power systems in their variable mapping. This results in low accuracy of calculation results, making it difficult to meet the rapid response requirements in real-time scheduling and control scenarios.
A multi-layer graph convolutional network is used to perform feature iteration, aggregation, and transformation on topology connection data and node load data to generate a deep feature matrix of nodes. Combined with physical constraints, the output layer strictly meets the power grid security constraints. The optimal power flow scheduling scheme is obtained through system state reconstruction and power balance calculation.
It significantly improves the model's ability to represent topology and generalize to topology changes, ensuring that the output results conform to the physical laws of the power grid, improving the reliability and accuracy of the scheduling scheme, and adapting to the needs of real-time power grid scheduling and safety correction scenarios.
Smart Images

Figure CN121939366A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power system technology, and in particular to a method and system for solving AC optimal power flow. Background Technology
[0002] Currently, with the continuous expansion of power system scale and the integration of a high proportion of renewable energy, the demand for real-time optimized scheduling in power grid operation is becoming increasingly urgent. There is a pressing need to quickly and accurately solve for the optimal AC power flow to ensure the safe, stable, and economical operation of the power grid. However, traditional optimization algorithms are computationally time-consuming, sensitive to initial conditions, and difficult to guarantee convergence, making it difficult to meet the rapid response requirements of real-time scheduling and control scenarios.
[0003] To address this, existing technologies have incorporated machine learning-based methods, particularly mapping learning using fully connected neural networks, to improve solution speed through offline training and online inference. However, these methods typically treat the power grid as an unstructured input vector, failing to effectively utilize the actual topological connections of the grid. This results in limited model generalization ability and poor adaptability to changes in grid structure. Furthermore, they often rely on penalty functions when handling complex physical constraints, failing to rigorously guarantee the safety of the output solution, and making hyperparameter tuning difficult, thus affecting the reliability of the optimization results and their practical application value. Therefore, existing methods still suffer from weak modeling capabilities, insufficient constraint guarantees, and variable mapping that does not conform to physical laws, limiting their widespread application in high-reliability power system scenarios. Summary of the Invention
[0004] This invention provides a method and system for solving AC optimal power flow, which solves the technical problems of existing AC optimal power flow solving methods, such as insufficient ability to model power grid topology, lax physical constraint protection, and variable mapping that does not conform to the physical laws of power systems, resulting in low accuracy of calculation results.
[0005] The first aspect of this invention provides a method for solving AC optimal power flow, comprising:
[0006] Acquire the topology connectivity data, line admittance parameters, and node load data of the target power grid;
[0007] The topology connection data and the node load data are used to construct matrices, generating an adjacency matrix and an initial node feature matrix, respectively.
[0008] The adjacency matrix and the initial feature matrix of the nodes are iteratively aggregated and transformed by a multi-layer graph convolutional network to generate a deep feature matrix of the nodes.
[0009] The output layer with physical constraints calculates the node voltage amplitude and the active and reactive power of each branch of the target power grid based on the node deep feature matrix and the line admittance parameters.
[0010] Based on the node voltage amplitude, active power, reactive power, line admittance parameters, and node load data, system state reconstruction and power balance calculations are performed to obtain the optimal power flow scheduling scheme.
[0011] Optionally, the step of generating a deep feature matrix of nodes by performing feature iteration aggregation and transformation on the adjacency matrix and the initial feature matrix of nodes through a multi-layer graph convolutional network includes:
[0012] Construct a graph convolutional network consisting of multiple sequentially connected graph convolutional layers;
[0013] The initial feature matrix of the nodes is input into the first graph convolutional layer of the graph convolutional network to generate the node feature matrix;
[0014] The node feature matrix output by each graph convolutional layer is used as the input feature of its next adjacent graph convolutional layer, until the last graph convolutional layer.
[0015] The node feature matrix output by the last graph convolutional layer is used as the node deep feature matrix.
[0016] Optionally, the step of calculating the node voltage magnitude and the active and reactive power of each branch of the target power grid based on the node deep feature matrix and the line admittance parameters through the physical constraint output layer includes:
[0017] The deep feature matrix of the node is mapped to an intermediate voltage variable;
[0018] The voltage intermediate variable is mapped to a preset interval by a preset scaling function corresponding to the physical constraint output layer, and then linearly transformed to a continuous interval defined by the preset voltage safety lower limit and upper limit to generate the node voltage amplitude.
[0019] The active and reactive power of each branch of the target power grid are calculated by the physical constraint output layer based on the node deep feature matrix and the line admittance parameters.
[0020] Optionally, the step of calculating the active and reactive power of each branch of the target power grid based on the node deep feature matrix and the line admittance parameters through the physical constraint output layer includes:
[0021] The branch power prediction sublayer of the physical constraint output layer extracts the intermediate active power, intermediate reactive power, and intermediate power angle of each node from the deep feature matrix of the node.
[0022] Calculate the difference in the intermediate active power, the difference in the intermediate reactive power, and the difference in the intermediate power angle at the two ends of each branch.
[0023] Based on the difference in the intermediate power angle, the direction factor is calculated using trigonometric functions;
[0024] The active power and reactive power of the branch are synthesized by using the directional factor, the difference between the intermediate active power and reactive power, and the thermal stability limit of the corresponding branch.
[0025] Optionally, the step of performing system state reconstruction and power balance calculation based on the node voltage amplitude, active power, reactive power, line admittance parameters, and node load data to obtain the optimal power flow scheduling scheme includes:
[0026] Substituting the node voltage amplitude, active power, reactive power, and line admittance parameters into the preset AC power flow equation, the voltage phase angle of all nodes is calculated.
[0027] Based on the active power and the reactive power, calculate the net injected power of each node;
[0028] The net injected power and the node load data are used to perform algebraic operations to calculate the active power and reactive power of each generator.
[0029] Based on the active power output, the reactive power output, and the voltage phase angle, an optimal power flow scheduling scheme is constructed.
[0030] Optionally, the step of substituting the node voltage amplitude, the active power, the reactive power, and the line admittance parameters into a preset AC power flow equation to calculate the voltage phase angle of all nodes includes:
[0031] Based on the active power of each branch, the voltage amplitude of the two-end nodes, and the line admittance parameters, a first relationship is established;
[0032] Based on the reactive power of the branch, the voltage amplitude of the two-end nodes, and the line admittance parameters, a second relationship is established;
[0033] Using the first and second relations of all the branches, a system of equations is constructed with the voltage phase angle of each node as the unknown.
[0034] Solve the system of equations to obtain the voltage phase angles of all the nodes.
[0035] A second aspect of the present invention provides an AC optimal power flow solution system, comprising:
[0036] The data acquisition module is used to acquire the topology connection data, line admittance parameters, and node load data of the target power grid;
[0037] The matrix construction module is used to construct matrices using the topology connection data and the node load data, respectively, to generate an adjacency matrix and a node initial feature matrix;
[0038] The graph convolutional feature extraction module is used to perform iterative aggregation and transformation of the adjacency matrix and the initial feature matrix of the nodes through a multi-layer graph convolutional network to generate a deep feature matrix of the nodes.
[0039] The physical constraint output module is used to calculate the node voltage amplitude and the active and reactive power of each branch of the target power grid based on the node deep feature matrix and the line admittance parameters through the physical constraint output layer.
[0040] The scheme construction module is used to perform system state reconstruction and power balance calculation based on the node voltage amplitude, active power, reactive power, line admittance parameters and node load data to obtain the optimal power flow scheduling scheme.
[0041] A third aspect of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the AC optimal power flow solution method as described above.
[0042] The fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed, implements the AC optimal power flow solution method as described above.
[0043] The fifth aspect of the present invention provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein, when the program instructions are executed by a computer, the computer performs the AC optimal power flow solution method as described above.
[0044] As can be seen from the above technical solutions, the present invention has the following advantages:
[0045] By acquiring the topology connectivity data, line admittance parameters, and node load data of the target power grid, the topology connectivity data is transformed into an adjacency matrix, and the node load data is transformed into an initial node feature matrix. Then, a multi-layer graph convolutional network is used to iteratively aggregate and transform the adjacency matrix and the initial node feature matrix, generating a deep node feature matrix that integrates topology correlation and load characteristics. Subsequently, a physical constraint output layer outputs node voltage amplitudes and active and reactive power of each branch that strictly meet safety thresholds. Finally, combining the line admittance parameters and node load data, the optimal power flow scheduling scheme is obtained through system state reconstruction and power balance calculation.
[0046] To address the problem that existing methods are insufficient in modeling power grid topology, this invention adopts a graph convolutional network as the core feature extraction architecture. By explicitly utilizing the spatial hierarchy of the sparse topology of the power grid through the adjacency matrix, and by accurately capturing the power transfer patterns between nodes through the neighbor node feature aggregation mechanism, this invention significantly improves the model's ability to represent the topology and generalize to topology changes, ensuring that topology information is deeply integrated into the solution process.
[0047] To address the issue of insufficient physical constraint protection, this invention abandons the traditional unstable penalty function method. Instead, it uses a custom scaling function in the physical constraint output layer to forcibly limit node voltage amplitudes within a preset safe range. Simultaneously, it embeds thermal stability limit constraints in branch power synthesis, ensuring that the output results automatically meet hard constraints such as voltage upper and lower limits and line power limits from the network forward propagation stage, eliminating the risk of constraint violations and improving the reliability of the dispatching scheme. To address the problem of variable mapping not conforming to the physical laws of power systems, the scheme redesigns the mapping relationship. The neural network first learns the nonlinear mapping from load to intermediate physical quantities such as node voltage amplitude and branch power. Then, it reconstructs the voltage phase angle through AC power flow equations and derives generator output through algebraic operations on net injected power and load. This state prediction and physical reconstruction strategy aligns with the fundamental nature of power grid operation, where load is the disturbance source and the phase angle is determined by physical equations. This reduces the difficulty of model learning and ensures the physical consistency of the solution results.
[0048] The synergistic effect of these innovations addresses the shortcomings of existing methods from three core dimensions: topology modeling, constraint protection, and physical mapping. Ultimately, this significantly improves the accuracy of solving AC optimal power flow problems, providing a high-speed and reliable solution for scenarios such as real-time power grid scheduling and safety correction. Attached Figure Description
[0049] To more clearly illustrate the technical solutions in the embodiments of the present invention 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 some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0050] Figure 1 A flowchart illustrating the steps of an AC optimal power flow solution method provided in this embodiment of the invention;
[0051] Figure 2 A flowchart of variable mapping and physical reconstruction provided in an embodiment of the present invention;
[0052] Figure 3 A structural block diagram of an AC optimal power flow solution system provided in an embodiment of the present invention;
[0053] Figure 4 This is a structural block diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0054] The power system is the lifeblood of modern society, and its safe, stable, and economical operation is of paramount importance. The Alternating Current Optimal Power Flow (AC-OPF) problem is a core computational problem in power system operation and planning. Its goal is to achieve the lowest system operating cost, minimum network losses, or other specific economic or safety objectives by optimizing generator output, while satisfying physical constraints of the power grid (such as power flow equations, node voltage limits, and generator output limits).
[0055] The classic AC-OPF problem is a large-scale, non-convex, nonlinear programming problem. Its mathematical form can typically be expressed as follows: Objective function:
[0056] ;
[0057] Where G is the set of generators, It is the cost function of generator i, typically relating to its active power. The quadratic or piecewise linear function. The constraints include the following:
[0058] AC power flow equations (power balance equations): For each node i, we have
[0059] ;
[0060] ;
[0061] in, , These are the active and reactive power injected into the generator, respectively. , These are the active and reactive power of the load, respectively. This refers to the node voltage amplitude. The phase angle difference between nodes; These are the elements of the node admittance matrix. These equations are inherently nonlinear and describe the fundamental physical laws of the power grid.
[0062] Operational safety constraints:
[0063] Node voltage amplitude constraints: .
[0064] Generator output constraints: , .
[0065] Power flow constraints: The apparent power of the line does not exceed the thermal stability limit.
[0066] Traditionally, solving the AC-OPF problem relies on numerical optimization algorithms, such as interior-point methods, augmented Lagrange methods, and sequential quadratic programming. While these methods are theoretically mature, they exhibit inherent bottlenecks when faced with the uncertainties brought about by large-scale power grids and the integration of high proportions of renewable energy. These bottlenecks include slow computation speed, sensitivity to initial conditions, and difficulty in guaranteeing convergence to the global optimum. As power systems evolve towards intelligence and real-time operation, higher demands are placed on the computation speed of OPF. For example, in scenarios such as real-time scheduling and safety correction control, high-quality solutions need to be obtained within seconds or even milliseconds. Traditional iterative optimization algorithms struggle to meet this requirement.
[0067] Therefore, embodiments of the present invention provide an AC optimal power flow solution method and system to address the technical problems of existing AC optimal power flow solution methods, such as insufficient ability to model power grid topology, lax physical constraint guarantees, and variable mapping that does not conform to the physical laws of power systems, resulting in low accuracy of calculation results. The aim is to:
[0068] 1. Enhanced Modeling Capabilities for Power Grid Topology: By introducing graph convolutional networks, the topological characteristics of the power grid are explicitly utilized, enabling the model to effectively learn and infer spatial relationships and power flow between nodes. This improves the model's accuracy, robustness, and generalization ability to topology changes. It adapts to dynamic topology changes such as branch switching and node capacity expansion, eliminating the need for extensive model retraining and reducing engineering application costs.
[0069] 2. Strictly ensure the satisfaction of operational constraints: Abandoning the traditional and unstable penalty function method, this paper proposes to embed key operational constraints (such as voltage upper and lower limits, generator output limits) directly into the forward propagation process of the neural network by designing special network layers and activation functions. This ensures that all network outputs automatically satisfy most of these inequality constraints, minimizing constraint violations. This safeguards grid operation safety from the output source, avoiding safety accidents such as equipment failures and grid disconnection caused by constraint violations, aligning with the power system's "safety first" operational principle.
[0070] 3. Design variable mapping relationships that better align with physical laws: Redefine the input-output mapping of the neural network. The neural network learns a nonlinear mapping from load to intermediate physical quantities—node voltage amplitude and branch active / reactive power. Then, using simple algebraic relationships, generator output is derived from net injected power, and the phase angle is reconstructed using AC power flow equations. This "step-by-step solution, physical reconstruction" strategy better reflects the physical nature of power grid operation, reduces the complexity of the learning task, and improves the physical consistency of the solution. Deeply integrating data-driven machine learning models with the physical laws of power systems retains the high-speed solution advantage of machine learning while ensuring the physical rationality of the solution results, thus solving the engineering unreliability problem caused by the "black box" nature of the model.
[0071] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0072] It should be noted that, in the optional embodiments of the present invention, the data related to object information, etc., requires the permission or consent of the object when the embodiments of the present invention are applied to specific products or technologies. Furthermore, the collection, use, and processing of the relevant data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. In other words, if the embodiments of the present invention involve data related to an object, it needs to be obtained with the object's authorization and consent, the authorization and consent of relevant departments, and in accordance with the relevant laws, regulations, and standards of the country and region. If the embodiments involve personal information, the acquisition of all personal information requires the individual's consent. If sensitive information is involved, the separate consent of the information subject is required. The embodiments also need to be implemented with the object's authorization and consent.
[0073] Please see Figure 1 , Figure 1A flowchart illustrating the steps of an AC optimal power flow solution method provided in an embodiment of the present invention.
[0074] This invention provides a method for solving AC optimal power flow, comprising:
[0075] Step 101: Obtain the topology connection data, line admittance parameters, and node load data of the target power grid.
[0076] In this embodiment of the invention, topology connection data describes the physical connection relationships between nodes (including generator nodes, load nodes, tie nodes, etc.) and branches (transmission lines) in the target power grid. Power grids are typical graph-structured data, with sparse connections between nodes and spatial hierarchy. Topology connection data directly reflects the local topological relationships between nodes connected by lines.
[0077] Line admittance parameters are key line parameters describing the electrical characteristics of each transmission line in a target power grid, and are presented in the form of an admittance matrix Y. The elements of the admittance matrix Y are complex numbers. ,in, The conductance of the line between node i and node j (reflecting the active power loss characteristics of the line). The susceptance of the line between node i and node j (reflecting the reactive power transmission characteristics of the line).
[0078] Node load data refers to the real-time or predicted operating load data of all nodes in a target power grid, and it is the core source of disturbance to power grid operation. This core data includes two types of power parameters: active power of node loads. (Active power consumed by each node) and reactive power of node loads (Reactive power consumed by each node).
[0079] Step 102: Construct matrices using topology connection data and node load data respectively to generate an adjacency matrix and an initial node feature matrix.
[0080] In this embodiment of the invention, the core purpose of generating the adjacency matrix and the initial feature matrix of the nodes is to transform the unstructured topological connections and operating load states of the target power grid into a structured data format that can be directly processed by a graph convolutional network (GCN). The power grid is a typical graph-structured data, with sparse connections between nodes and spatial hierarchy. Topological connection data is used to explicitly represent the physical connections between nodes, while node load data is the core source of disturbance in power grid operation. Matrix construction can standardize these two types of key input data, providing basic data support for subsequent feature iteration, aggregation, and transformation in the graph convolutional network, ensuring that the model can accurately capture the topological characteristics of the power grid and the load-state mapping pattern.
[0081] Furthermore, the specific matrix construction process in step 102 is as follows:
[0082] 1. Construct an adjacency matrix based on topological connection data
[0083] Based on the topology data of the target power grid, an adjacency matrix is constructed to characterize the connection relationships between nodes. , where N is the total number of nodes in the target power grid.
[0084] Matrix element definition: If the topology connection data clearly shows a transmission line connection between node i and node j, then the corresponding element in the adjacency matrix is defined as follows: If there is no direct power transmission line connection between node i and node j, then .
[0085] Self-loop addition processing: To ensure that each node can fully utilize its own feature information and to maintain the stability of graph convolutional network training, self-loops are usually added to each node, that is, the diagonal elements of the adjacency matrix are left unchecked. , i=1,2,...,N.
[0086] Normalization: To avoid feature aggregation bias caused by differences in node degree, the original adjacency matrix needs to be normalized using the degree matrix. The degree matrix D is a diagonal matrix, and its diagonal elements... That is, the connectivity degree of node i, and the normalized adjacency matrix is: This processing makes the subsequent training process of graph convolutional networks more stable and converges faster.
[0087] 2. Construct the initial feature matrix of nodes based on node load data.
[0088] Based on the node load data of the target power grid, a node initial feature matrix is constructed to characterize the initial operating state of each node. .
[0089] Matrix Dimensions and Element Composition: Initial Feature Matrix of Nodes ,in, Let i be the initial feature dimension, and let i be the initial feature vector corresponding to each node i. The core is the active power of the load at this node. and load reactive power Composition, that is N represents the total number of nodes in the target power grid.
[0090] Auxiliary feature supplementation (optional): Depending on the actual solution requirements, node type identifiers (such as balanced nodes, PV nodes, PQ nodes, etc.) can be added to the initial feature vector as auxiliary features to further enhance the model's ability to represent the characteristics of power grid nodes. Specifically:
[0091] PQ node represents the known active power of the load. and load reactive power Load nodes;
[0092] PV nodes are generator nodes with known active power output and voltage amplitude;
[0093] Balance node: A reference node responsible for balancing system power, with known voltage magnitude and phase angle.
[0094] Matrix integration form: Stack the initial feature vectors of all nodes vertically in node number order to form a complete initial feature matrix of the nodes. This matrix fully contains the load disturbance information of all nodes in the target power grid and is the core input basis for graph convolutional networks to learn the nonlinear mapping of "load-power grid state".
[0095] Step 103: Use a multi-layer graph convolutional network to iteratively aggregate and transform the adjacency matrix and the initial feature matrix of the nodes to generate the deep feature matrix of the nodes.
[0096] In this embodiment of the invention, this step is the core feature extraction stage that connects power grid data preprocessing and physical constraint calculation. Its core purpose is to leverage the graph structure data processing capabilities of Graph Convolutional Networks (GCNs) to deeply integrate the topological association information represented by the adjacency matrix with the load state information represented by the initial node feature matrix. This extracts deep features from the basic structured data that accurately reflect the nonlinear mapping law between "load-power grid state." Power transfer and voltage coupling between nodes in a power grid exhibit significant "local correlation-global influence" characteristics, and the "neighborhood feature aggregation" mechanism of graph convolutional networks perfectly matches this physical process. By aggregating neighbor node features layer by layer, the law of power transfer from local nodes to multi-hop neighbors in the power grid can be simulated, avoiding the feature bias problem caused by the neglect of topology in traditional fully connected networks. The resulting deep node feature matrix provides high-quality feature support for the subsequent physical constraint output layer calculation of voltage and power, ensuring that the subsequent solution results conform to the physical essence of the power grid.
[0097] Furthermore, step 103 may include the following sub-steps:
[0098] S11. Construct a graph convolutional network consisting of multiple sequentially connected graph convolutional layers.
[0099] In this embodiment of the invention, the graph convolutional network is a neural network specifically designed for processing graph-structured data. Its core mechanism closely matches the physical processes of power flow and voltage interaction in a power grid. As a typical sparse graph, the power grid's power transfer between nodes is achieved only through directly connected branches. The "neighborhood aggregation" characteristic of the graph convolutional network perfectly matches this local correlation pattern. Compared to fully connected networks that flatten node features, the graph convolutional network explicitly preserves the connection relationships between nodes through the adjacency matrix, ensuring that the feature aggregation process always revolves around the actual topology of the power grid, avoiding the loss of topological information. Simultaneously, considering the differences in connection degree between different nodes in the power grid (e.g., hub nodes have more connected branches, while terminal nodes have fewer), the input adjacency matrix is first preprocessed. The original adjacency matrix A is normalized using the degree matrix D to obtain... To ensure training stability, the configuration of each convolutional layer strictly follows the logic of "aggregation-transformation-activation": first through... This involves implementing neighbor feature aggregation, where each node's feature is a weighted average of the features from all its neighbors (including itself) from the previous layer. The aggregated features are then combined with the trainable weight matrix of that layer. (in, Let l be the feature dimension of the l-th layer; Perform a linear transformation on the (l+1)th layer feature dimension and superimpose the trainable bias vector. Finally, a nonlinear activation function is used. The feature transformation is completed, and the node feature matrix of this layer is output. The non-linear activation function can be ReLU (Rectified Linear Unit), Sigmoid (a sigmoid activation function with a range between (0, 1), etc.), etc. A single-layer graph convolution operation can be represented as:
[0100] ;
[0101] in, It is the feature matrix of all nodes in the l-th layer; It is the feature dimension; This is the trainable weight matrix for this layer; It is a trainable bias vector; These are non-linear activation functions, such as the ReLU function, the Sigmoid function, etc. This step enables neighbor feature aggregation, where each node's new feature is a weighted average of the features of all its neighboring nodes (including itself) at the previous level.
[0102] By stacking multiple layers of GCNs, the receptive field of each node can be expanded to include multi-hop neighbors, thereby capturing a wider range of mutual influences in the power grid. The expansion rule of the receptive field is as follows: the first layer of GCN can only capture the features of a node's one-hop neighbors (directly connected nodes), the second layer can capture the features of two-hop neighbors (neighbors of neighbors), and so on, with the maximum receptive field corresponding to the number of layers L being L hop neighbors. In engineering, the number of layers needs to be adapted according to the scale of the power grid: 3 layers are selected for distribution networks with fewer than 100 nodes (3-hop receptive field, covering the vast majority of node associations), 5 layers are selected for transmission and distribution networks with 100-500 nodes, and 7 layers are selected for large transmission networks with more than 500 nodes. This ensures that global topology associations can be captured while avoiding the surge in computational load and overfitting caused by too many layers. This invention uses multi-layer GCNs to deeply extract node features closely related to the power grid topology.
[0103] S12. Input the initial feature matrix of the nodes into the first graph convolutional layer of the graph convolutional network to generate the node feature matrix.
[0104] In this embodiment of the invention, the initial feature matrix of the node is... After inputting the first graph convolutional layer of the graph convolutional network, following the aggregation-transformation-activation process of S11, based on the normalized adjacency matrix... The features of the aggregated node itself and its direct neighbors are transformed by linear transformation and nonlinear activation to generate the first-layer node feature matrix. This achieves the first integration of topological connectivity and initial load characteristics.
[0105] S13. Use the node feature matrix output by each graph convolutional layer as the input feature of its next adjacent graph convolutional layer, until the last graph convolutional layer.
[0106] In this embodiment of the invention, multiple sequentially connected graph convolutional layers are stacked. The core purpose is to expand the "receptive field" of the nodes, enabling each node's features to gradually capture the influence of multi-hop neighbors, thereby deeply extracting the interaction patterns between nodes over a large area in the power grid. The node feature matrix output by the previous layer... The features are directly used as input features for the next layer, and each layer is based on the same normalized adjacency matrix. Feature updates are performed. By continuously aggregating features from more distant neighbors, the association between the topology and load status is strengthened, redundant information is gradually removed, and core features are extracted until the features are passed to the last graph convolutional layer.
[0107] S14. Use the node feature matrix output by the last graph convolutional layer as the node deep feature matrix.
[0108] In this embodiment of the invention, let the total number of layers in the graph convolutional network be L, then the node feature matrix output by the last graph convolutional layer... This is the deep feature matrix of the nodes. After multi-layer iterative aggregation and transformation, this matrix fully integrates the topological connectivity information of the target power grid, node load information, and power transfer correlation characteristics between nodes, accurately representing the nonlinear mapping basis of load-grid state. Its feature dimensions... It can be adjusted according to the actual solution accuracy requirements. This matrix will serve as the core input, providing high-quality feature support for the subsequent physical constraint output layer to predict the node voltage magnitude, branch active power, and reactive power, ensuring that the subsequent prediction results conform to the physical laws of the power grid.
[0109] Step 104: Calculate the node voltage amplitude and the active and reactive power of each branch of the target power grid based on the node deep feature matrix and line admittance parameters through the physical constraint output layer.
[0110] It should be noted that the physical constraint output layer refers to a dedicated neural network component integrated at the end of a multi-layer graph convolutional network, including a branch power prediction sub-layer. Furthermore, the physical constraint output layer internally uses differentiable mathematical transformations (including preset scaling functions, linear mappings, and power synthesis formulas) to force the mapping of abstract features extracted from the upstream network into node voltage amplitudes and branch powers that strictly meet the constraints of power grid safe operation (including upper and lower limits of voltage amplitude and line thermal stability limits).
[0111] Furthermore, step 104 may include the following sub-steps:
[0112] S21. Map the deep feature matrix of the node to the intermediate voltage variable.
[0113] In this embodiment of the invention, the deep feature matrix of a node has fully aggregated multi-dimensional information of the power grid. Its high-dimensional features need to be linearly mapped through a dedicated voltage prediction sublayer in the physical constraint output layer. This sublayer maps the deep feature vector corresponding to each node to a scalar value through trainable weight parameters. This refers to the intermediate voltage variable, which is an indirect representation of the node voltage amplitude. It provides a basis for subsequent constraint mapping and ensures that the mapping process is consistent with the physical meaning of the node characteristics.
[0114] S22. The intermediate voltage variable is mapped to a preset interval by the preset scaling function corresponding to the physical constraint output layer, and then linearly transformed to a continuous interval defined by the preset lower and upper voltage safety limits to generate the node voltage amplitude.
[0115] In this embodiment of the invention, the core function of the preset scaling function is to force the intermediate voltage variable to meet the node voltage safety constraints, replacing the traditional unstable penalty function method. The specific process is as follows:
[0116] 1. The preset scaling function is a nonlinear function with a limited range to ensure the accuracy of intermediate voltage variables. First, map to a fixed interval:
[0117] (1) Standard scaling Sigmoid function: x is the input variable with a range of (0, 1), which is used to normalize intermediate variables;
[0118] (2) The boundary contains an optimized HardSigmoid function: x is an input variable with a value range of [0, 1], which can accurately include the voltage safety boundary.
[0119] 2. Linear transformation process: The scaled result is stretched to the preset voltage safety lower limit of the node. (Minimum allowed voltage amplitude at node i) and upper limit The final node voltage amplitude is generated between (the highest allowed voltage amplitude at node i) and (the maximum allowed voltage amplitude at node i). (The actual voltage amplitude of node i reflects the electrical operating status of the node), the formula is:
[0120] ;
[0121] Regardless of intermediate voltage variables Whatever the value, the final result Strictly fall into Within the range, the voltage constraint is directly guaranteed to be met from the output stage.
[0122] S23. Based on the node deep feature matrix and line admittance parameters, the active power and reactive power of each branch of the target power grid are calculated by the output layer of the physical constraint.
[0123] Furthermore, step S23 may include the following sub-steps:
[0124] S231. The branch power prediction sub-layer of the output layer with physical constraints extracts the intermediate active power, intermediate reactive power and intermediate power angle of each node from the deep feature matrix of the node.
[0125] In this embodiment of the invention, the branch power prediction sublayer of the output layer is physically constrained to predict the deep feature matrix of the nodes. Perform multi-dimensional mapping extraction. For each node i, extract three single-dimensional intermediate quantities: active power intermediate quantity. (Characterizing the potential contribution of node i to the active power of the branch), intermediate reactive power quantity (Characterizing the potential contribution of node i to the reactive power of the branch) and intermediate power angle quantity (Characterizing the phase correlation potential of power transmission between node i and other nodes). These intermediate quantities are the core characterization factors of branch power, providing a data foundation for subsequent calculation of power difference between the two ends of the branch.
[0126] S232. Calculate the difference in the intermediate active power, the difference in the intermediate reactive power, and the difference in the intermediate power angle corresponding to the two ends of each branch.
[0127] In this embodiment of the invention, the essence of branch power is the power transmission between the two end nodes, which needs to be reflected through the difference in intermediate quantities between the nodes. For any branch ij (the transmission line connecting node i and node j), the power of its two end nodes is calculated respectively:
[0128] Intermediate difference in active power: (Reflecting the difference in the potential for active power transmission between the nodes at both ends of branch ij).
[0129] Intermediate difference in reactive power: (Reflecting the difference in reactive power transmission potential between the nodes at both ends of branch ij);
[0130] Power angle intermediate value difference: (Reflects the phase difference in power transmission between the two nodes of branch ij).
[0131] This difference directly reflects the power potential energy difference between the two ends of the branch and is the core driving factor for the actual power of the subsequent synthesized branch.
[0132] S233. Based on the difference in the intermediate power angle, the direction factor is calculated using trigonometric functions.
[0133] In this embodiment of the invention, the direction factor is used to characterize the transmission direction and phase characteristics of branch power. Its calculation is based on the difference between intermediate power angles and a combination of trigonometric functions, ensuring consistency with the phase relationship of power transmission in the power grid. Specifically:
[0134] Active power direction factor: (Determine the direction of active power transmission based on the intermediate difference in power angle of branch ij).
[0135] Reactive power direction factor: (Determine the direction of reactive power transmission based on the intermediate difference in the power angle of branch ij).
[0136] By utilizing the periodicity and range properties of trigonometric functions (the ranges of cos and sin are both [...]), This ensures the rationality of the direction factor, thereby ensuring that the direction of branch power transmission conforms to physical laws.
[0137] S234. Using the direction factor, the difference between the intermediate active power and the intermediate reactive power, and the thermal stability limit of the corresponding branch, the active power and reactive power of the combined branch are obtained.
[0138] In this embodiment of the invention, the branch power synthesis process must simultaneously satisfy the power transmission law and the line thermal stability constraint, as shown in the following formula:
[0139] ;
[0140] ;
[0141] in, For the Sigmoid function, x represents the intermediate difference in the input, which is used to normalize the difference. The difference in active power between the two nodes of branch ij is the intermediate value. The difference in reactive power between the nodes at both ends of branch ij; The difference between the power angles of the two nodes at the two ends of branch ij is the intermediate value. The thermal stability limit of branch ij (the maximum apparent power allowed by the line to ensure safe operation of the line). The active power of branch ij (reflecting the actual active power transmitted by the branch). The reactive power of branch ij (reflecting the actual amount of reactive power transmitted by the branch).
[0142] After synthesis, it satisfies (The apparent power of the branch does not exceed the thermal stability limit), ensuring the safe operation of the branch. The line admittance parameter Y (admittance matrix, elements are...) , Let the line conductance between nodes i and j be . The susceptance of the line between nodes i and j provides a physical basis for the power transmission law in this process. Its value directly affects the power transmission loss and phase characteristics, ensuring that the synthesized branch power conforms to the electrical law of the power grid.
[0143] Step 105: Based on the node voltage amplitude, active power, reactive power, line admittance parameters and node load data, perform system state reconstruction and power balance calculations to obtain the optimal power flow scheduling scheme.
[0144] Furthermore, step 105 may include the following sub-steps:
[0145] S31. Substitute the node voltage magnitude, active power, reactive power and line admittance parameters into the preset AC power flow equation to calculate the voltage phase angle of all nodes.
[0146] In this embodiment of the invention, the voltage phase angle The voltage phase angle at node i, reflecting the phase state of the node voltage, is a key implicit variable in power grid operation. Known inputs include: node voltage amplitude. (Actual voltage amplitude at node i), active power of branch Branch reactive power The line admittance parameter Y is obtained by substituting it into the preset AC power flow equations, establishing a system of equations with the voltage phase angle as the unknown, and solving for all nodes. .
[0147] Further, step S31 may include the following sub-steps:
[0148] S311. Based on the active power of each branch, the voltage amplitude of the two-end nodes, and the line admittance parameters, establish the first relationship.
[0149] In this embodiment of the invention, the first relation is a phase angle constraint equation based on the active power of the branch, using the voltage phase angle difference between the two nodes of branch ij. ( Let i be the phase angle of node i. Let the phase angle at node j be the core variable. Combining the physical relationships between active power and voltage, phase, and admittance in the AC power flow equations, the first relationship is established as follows:
[0150] ;
[0151] in, Let be the active power of branch ij; , These are the voltage amplitudes at nodes i and j, respectively; , These are the line admittance parameters; Let be the voltage phase angle difference between the two nodes of branch ij. This formula clarifies the quantitative relationship between active power transmission and the phase angle difference, and is one of the core bases for solving the phase angle.
[0152] S312. Based on the reactive power of the branch, the voltage amplitude of the two-end nodes, and the line admittance parameters, establish the second relationship.
[0153] In this embodiment of the invention, both the first and second relational expressions use the voltage phase angle difference between the two nodes of the branch as the variable. The second relational expression is a phase angle constraint equation based on the reactive power of the branch, and shares variables with the first relational expression. To ensure consistency in phase angle calculations, and based on the physical laws governing reactive power in AC power flow equations, the second relationship is established as follows:
[0154] ;
[0155] in, Let be the reactive power of branch ij; , These are the voltage amplitudes at nodes i and j, respectively; , These are the line admittance parameters; Let be the voltage phase angle difference between the two nodes of branch ij. This formula complements the first relation and together they form a constraint system for the phase angle difference, ensuring that the solution conforms to the dual physical laws of active and reactive power.
[0156] S313. Using the first and second relations of all branches, construct a system of equations with the voltage phase angle of each node as the unknown.
[0157] In this embodiment of the invention, the first and second relations of all branches in the power grid together constitute a system of equations, with the unknowns being the voltage phase angles of all nodes. , ,..., (N is the total number of nodes in the target power grid). Due to the fact that each branch... The relational formulas for all branches can be uniformly transformed into formulas based on a single node. Linear or nonlinear equations with unknowns. For example, for a power grid with M branches, 2M constraint equations can be generated (each branch corresponds to one first relation and one second relation), forming an overdetermined or well-posed system of equations to ensure the unknowns (N) are handled correctly. There is a unique or optimal solution, and the solution satisfies the power constraints of all branches.
[0158] S314. Solve the system of equations to obtain the voltage phase angles of all nodes.
[0159] In this embodiment of the invention, solving the system of equations requires combining the argument function and consistency constraints to ensure the physical rationality of the solution. First, the derivation is performed using the first relational expression. The expression:
[0160] ;
[0161] Derivation through the second relation The expression:
[0162] ;
[0163] in, It is a phase reference characterizing active power transmission based on the phase angle function of conductance and susceptance; Let be the phase reference characterizing reactive power transmission, based on the phase angle function of conductance and susceptance. Due to the physical laws of the power grid, the active power-related phase angle difference of branch ij must be equal to the reactive power-related phase angle difference. It is necessary to add a minimization step during the neural network optimization process. The constraints force the two to converge, optimizing the source to ensure physical rationality, and finally obtaining the voltage phase angle of all nodes. This ensures that the phase angle distribution conforms to the phase law of power flow in the power grid.
[0164] S32. Based on active power and reactive power, calculate the net injected power of each node.
[0165] In this embodiment of the invention, net injected power is the total power flowing into the node, a key intermediate quantity connecting branch power and generator output, including net active power injection. (Net active power injected into node i, with positive values for inflows and negative values for outflows) and net reactive power injected. (The net reactive power injection at node i is positive when flowing into the node and negative when flowing out). The calculation logic is: sum the power of all branches connected to node i, i.e.:
[0166] ;
[0167] ;
[0168] in, Let be the active power of branch ij (if branch ij flows from node i to j, Positive; negative. Let be the reactive power of branch ij (the direction is defined in the same way as the active power). This calculation directly reflects the power balance of the node and provides a core basis for the subsequent derivation of generator output.
[0169] S33. Perform algebraic operations on the net injected power and node load data to calculate the active and reactive power outputs of each generator.
[0170] In this embodiment of the invention, node load data includes node load active power. (Active power consumed by node i) and reactive power of node load (Reactive power consumed by node i), the generator output must satisfy the physical balance relationship of net injected power = generator output - load power. Therefore, it can be derived through algebraic operations:
[0171] ;
[0172] ;
[0173] in, Let i be the active power output of the generator at node i (the active power injected into the grid by the generator). The reactive power output of the generator at node i (the reactive power injected by the generator into the grid). , The net active and reactive power injected into node i; , Let represent the active and reactive load power of node i. This calculation strictly follows the power balance law to ensure that the generator output can compensate for load consumption and maintain node power balance.
[0174] S34. Based on active power output, reactive power output and voltage phase angle, construct the optimal power flow scheduling scheme.
[0175] In this embodiment of the invention, the optimal power flow scheduling scheme is a complete instruction set that integrates all key operating state variables of the power grid. Its core components include: the active power output of each generator. Unproductive efforts (Clearly define the generator's operational adjustment targets), and the voltage amplitude of all nodes. Voltage phase angle (Clearly define the voltage and phase distribution objectives of the power grid). This scheme must simultaneously meet two core requirements: first, economic optimization, meaning the generator output combination minimizes system operating costs (fitting the AC-OPF objective function); second, safety and feasibility, meaning all state variables satisfy operational constraints (node voltage). Generator output , Branch power The final scheduling scheme can be directly used for real-time power grid scheduling, safety correction, and other scenarios to achieve safe, stable, and economical power grid operation.
[0176] In this embodiment of the invention, firstly, load data and grid topology / parameters are input into a multi-layer graph convolutional neural network (GCN) for feature extraction and fusion. The output of the GCN module is a high-dimensional feature vector for each node. These feature vectors are then fed into a physical reconstruction and output layer. This layer contains several parallel sub-output layers, each predicting the voltage amplitude. and branch power Crucially, the output layer predicting voltage amplitude uses a custom activation function to ensure that its value strictly falls within a preset safety range. Finally, generator output is derived from net injected power and known load using simple algebraic calculations, and the phase angle is reconstructed by solving the AC power flow equations, thus obtaining a complete and feasible optimal scheduling scheme.
[0177] Furthermore, steps 101-105 above detail the online inference process for solving the optimal power flow, while the offline training process of the model (to ensure the accuracy of online inference) must follow the complete process of variable mapping and physical reconstruction, such as... Figure 2As shown in the diagram, the specific process is as follows: Using load data, grid topology, and grid parameters as input, node features are extracted through forward propagation of a Graph Convolutional Network (GCN). Then, the voltage amplitude of all nodes is predicted through output layer 1 (a custom activation function), and branch power is predicted through output layer 2 (a custom activation function). Subsequently, the physical calculation stage is entered, where generator output calculation and phase angle reconstruction are performed. The loss function is calculated based on the prediction results and the true labels. The model parameters are updated according to the loss function, and convergence is determined. If convergence fails, the process returns to the GCN forward propagation stage for further iteration. If convergence occurs, the final optimal power flow scheduling scheme is output.
[0178] It is worth mentioning that the mapping relationship of the present invention is designed as follows:
[0179] The goal of neural network learning: The core task of the neural network is to learn a mapping from known data to decision variables. Where V is the voltage magnitude of all nodes; The active power of branch ij (reflecting the actual active power transmitted by the branch). The reactive power of branch ij (reflecting the actual amount of reactive power transmitted by the branch). , y represents the active and reactive load power; A is the original adjacency matrix; Y is the admittance matrix.
[0180] Calculation of generator output: After obtaining the branch power, the net injected power at the node can be directly obtained, which can be formally expressed as... , Next, the generator output can be obtained through simple algebraic calculations. , .in, Let i be the active power output of the generator at node i (the active power injected into the grid by the generator). The reactive power output of the generator at node i (the reactive power injected by the generator into the grid). , The net active and reactive power injected into node i; , Let represent the active and reactive load power of node i.
[0181] Phase angle reconstruction: The phase angle θ is not used as the direct output of the neural network. This is done after obtaining the voltage amplitude V of all nodes and the branch power. Then, the phase angle is reconstructed by solving the AC power flow equations. Specifically, V and Treating θ as a known quantity, solve the equation about θ. The formalization is as follows:
[0182] ;
[0183] ;
[0184] in, , , It is an argument function. Because Therefore, we have:
[0185] ;
[0186] In the above formula, It is the difference in voltage phase angle between node i and node j; It is the real part of the element in the i-th row and j-th column of the complex admittance matrix Y; It is the imaginary part of the element in the i-th row and j-th column of the complex admittance matrix Y.
[0187] This strategy, which uses neural networks to predict physical states and reconstructs latent variables based on physical equations, tightly integrates data-driven methods with physical models. It leverages the powerful nonlinear fitting capabilities of neural networks while ensuring that the results satisfy physical laws as much as possible.
[0188] Furthermore, the training of the model in this invention still employs supervised learning. The generation of training samples is similar to the traditional ML-OPF method, that is, a large number of data pairs of loads and optimal solutions are generated through a traditional solver. However, the key difference lies in the construction of the labels.
[0189] For each sample k:
[0190] Input: Load And a fixed topology A and parameter Y.
[0191] Tag: Not directly using the optimal generator output Instead of using labels, the complete power grid state obtained from a traditional solver is used as the label, including:
[0192] Optimal voltage amplitude at all nodes .
[0193] Optimal power of all branches and .
[0194] The loss function is defined as the neural network's predicted value. The weighted mean square error between the actual optimal label and the violation errors of generator power and phase difference:
[0195] ;
[0196] in, These are weighting coefficients used to balance losses across different physical quantities. It is based on a penalty function. The definition is as follows:
[0197] ;
[0198] The interpretation of the symbolic parameters in this section is the same as the previous definitions. , is the square of the L2 norm of the difference between two vectors.
[0199] It is worth mentioning that, Figure 2 The parameter update part calculates the gradient of the parameters based on the loss function L and updates the parameters using gradient descent, as shown in the formula: ,in, Indicates model parameters; Indicates the step size for parameter updates; This represents the gradient of L with respect to the parameters. Convergence is determined when the change in the value of the loss function is less than a certain threshold. In terms of the formula, if... If the condition is met, the circuit is considered convergent; otherwise, it is not convergent. It can be set to 1e-5.
[0200] In this embodiment of the invention, a Graph Convolutional Network (GCN) is used as the core architecture to replace the traditional Fully Connected Neural Network (FCNN) for explicit modeling of the power grid topology. As a typical sparse graph structure, the power grid exhibits strong local correlations in power transfer between nodes. FCNN flattens the load and topology parameters of power grid nodes into one-dimensional vectors, completely severing the physical connections between nodes and failing to capture the power transmission coupling characteristics of branches. When faced with minor adjustments to the power grid topology (such as branch switching or node capacity expansion), the model is prone to prediction failures. In contrast, GCN relies on the topological representation of the adjacency matrix, gradually expanding the receptive field of nodes through multi-layer stacking, from direct neighbors to multi-hop neighbors, accurately reproducing the physical law of "gradual diffusion of local power influence" in the power grid. Simultaneously, the sparse computation characteristics of GCN are adapted to the sparsity of the power grid topology, significantly reducing computational complexity. GCN guides the aggregation of neighbor node features through the adjacency matrix; this mechanism highly matches the physical processes of power flow and voltage interaction in the power grid, accurately capturing the spatial correlations between nodes. In contrast, FCNN treats the power grid as an unstructured "black box," failing to utilize topological correlation information and resulting in one-sided feature extraction. The GCN architecture of this invention enables the model to extract features from the power grid topology more effectively, learns a more accurate nonlinear "load-grid state" mapping, and significantly improves its generalization ability for load fluctuations and minor topological changes.
[0201] This invention, by designing a custom output layer activation function, directly embeds the inequality constraints of power grid operation (such as voltage upper and lower limits) into the forward propagation process of a neural network, achieving strict satisfaction of hard constraints. Traditional penalty function methods achieve approximate constraint satisfaction by adding a penalty term for constraint violation to the objective function. The selection of the penalty function coefficients directly determines the solution effect; if the coefficients are too small, problems such as voltage exceeding limits and branch power exceeding limits frequently occur; if the coefficients are too large, the model is prone to getting trapped in local optima, leading to severe degradation of optimization objectives such as system operating costs. Furthermore, for scenarios with multiple constraints such as voltage and line power, the parameter tuning process for multiple coefficients is cumbersome and lacks universal standards, making it difficult to adapt to the real-time scheduling needs of actual power grids. This design completely replaces the traditional penalty function method, eliminating the dependence on penalty function coefficient tuning and fundamentally avoiding common problems in existing technologies such as "minor constraint violations" and "deterioration of optimization objectives." The power grid state data output by this invention naturally conforms to safe operation standards, significantly improving the robustness and reliability of the method and making it more suitable for the high-standard safety requirements of actual power grids.
[0202] This invention redefines the input-output logic of neural networks, constructing a variable mapping chain of "load → node voltage amplitude / branch power → generator output / phase angle," forming a two-step method of "state prediction - physical reconstruction." Traditional machine learning methods often directly use generator output and node voltage phase angle as prediction targets. However, the voltage phase angle is strongly coupled with the overall power balance of the power grid, and direct prediction can easily lead to its distribution not conforming to the AC power flow equations, resulting in power imbalance across the entire grid. This invention fully follows the physical essence of AC-OPF, taking the load as the core disturbance source of power grid operation, and using node voltage amplitude and branch power, which are more easily learned by neural networks, as prediction targets. Then, it uses analytical methods to process parameters with strong physical constraints. By using the phase angle as the dependent variable of the AC power flow equations, rather than the direct prediction target of the neural network, it reduces the difficulty of model learning while ensuring the strict satisfaction of the power flow equations. This deep integration strategy of data-driven model and physical equations allows the solution process to combine the high speed of data-driven solutions with the consistency of physical models, solving the pain point of traditional methods that "difficult to balance speed and accuracy."
[0203] This invention organically combines the topology modeling capabilities of graph convolutional networks (GCNs), the hard constraint embedding function of custom activation functions, and the equation satisfaction characteristics of physical reconstruction to form a complete end-to-end AC optimal power flow solution system. These three components do not work independently but rather construct an end-to-end closed-loop system of "feature extraction - constraint output - physical verification": GCNs provide the physical constraint output layer with high-quality deep features that fuse topology and load, avoiding invalid constraint outputs due to feature distortion; the rigid constraints of the physical constraint output layer ensure that the prediction results of GCNs are always within the safe and feasible region, laying a compliant state foundation for subsequent physical reconstruction; the physical reconstruction step further verifies and improves the constraint output results, solving for phase angles through power flow equations and deriving generator output through power balance, allowing the solution to form a complete power physics-based scheduling scheme. The three components work synergistically, ensuring the accuracy of feature extraction through GCNs, guaranteeing the safety of the output solution through custom activation functions, and perfecting power balance and state integrity through the physical reconstruction step, ultimately achieving the technical effect of "fast solution - strict compliance - physical consistency".
[0204] Furthermore, to achieve the same inventive objective, the following alternatives also exist:
[0205] 1. Alternatives to Graph Neural Network Variants: The core GCN module of this invention can be replaced by other advanced graph neural network architectures, such as Graph Attention Network (GAT). GAT assigns different attention weights to different neighbors when aggregating neighbor information, thus enabling more precise modeling of the influence strength between nodes (analogous to the magnitude of conductance / susceptance), potentially achieving better performance in certain scenarios. Message Passing Neural Network (MPNN) is another general graph learning framework that can also be used to implement the topology modeling idea of this invention.
[0206] 2. Alternative Constraint Handling Methods: Besides using the scaled Sigmoid function, other functions with limited ranges can be used as custom activation functions to ensure constraints. For example, the hyperbolic tangent function (tanh) can be used and its range linearly scaled to... Another more complex alternative is to introduce a "projection layer," where the neural network first outputs an unconstrained intermediate value, and then a dedicated network layer is added to project this intermediate value into the feasible region. This projection operation itself can be implemented through a differentiable optimization layer.
[0207] 3. Alternative to the physical reconstruction step: When reconstructing the phase angle, a DC power flow model can be used for approximate calculation, which is faster but sacrifices accuracy. Another alternative is to train a lightweight auxiliary neural network specifically to learn from... arrive A fast mapping method is used to replace the iterative solution process, achieving even greater speed.
[0208] 4. System-level alternative: The method described in this invention can be deployed as a standalone online computing service. An alternative is to use it as a "high-quality initial value generator" for traditional optimization algorithms, forming a hybrid system. That is, first, the neural network of this invention is used to quickly obtain a feasible and near-optimal solution, and then this solution is used as an initial value to feed into the traditional interior-point method for fine optimization, thereby further improving the accuracy of the optimal solution while maintaining speed.
[0209] Please see Figure 3 , Figure 3 This is a structural block diagram of an AC optimal power flow solution system provided in an embodiment of the present invention.
[0210] This invention provides an AC optimal power flow solution system, comprising:
[0211] The data acquisition module 301 is used to acquire the topology connection data, line admittance parameters and node load data of the target power grid;
[0212] The matrix construction module 302 is used to construct matrices using topology connection data and node load data respectively, generating an adjacency matrix and an initial node feature matrix;
[0213] The graph convolutional feature extraction module 303 is used to perform iterative aggregation and transformation of the adjacency matrix and the initial feature matrix of the nodes through a multi-layer graph convolutional network to generate a deep feature matrix of the nodes.
[0214] The physical constraint output module 304 is used to calculate the node voltage amplitude and the active and reactive power of each branch of the target power grid based on the node deep feature matrix and line admittance parameters through the physical constraint output layer.
[0215] The scheme construction module 305 is used to perform system state reconstruction and power balance calculation based on node voltage amplitude, active power, reactive power, line admittance parameters and node load data to obtain the optimal power flow scheduling scheme.
[0216] Furthermore, the graph convolution feature extraction module 303 can perform the following steps:
[0217] Construct a graph convolutional network consisting of multiple sequentially connected graph convolutional layers;
[0218] The initial feature matrix of the nodes is input into the first graph convolutional layer of the graph convolutional network to generate the node feature matrix.
[0219] The node feature matrix output by each graph convolutional layer is used as the input feature of its next adjacent graph convolutional layer, until the last graph convolutional layer.
[0220] The node feature matrix output by the last graph convolutional layer is used as the node deep feature matrix.
[0221] Furthermore, the physical constraint output module 304 can perform the following steps:
[0222] Map the deep feature matrix of the node to an intermediate voltage variable;
[0223] The intermediate voltage variable is mapped to a preset interval by the preset scaling function corresponding to the physical constraint output layer, and then linearly transformed to a continuous interval defined by the preset lower and upper voltage safety limits to generate the node voltage amplitude.
[0224] The active and reactive power of each branch of the target power grid are calculated by using the physical constraint output layer based on the deep feature matrix of the nodes and the line admittance parameters.
[0225] Furthermore, the physical constraint output module 304 can also perform the following steps:
[0226] The branch power prediction sublayer of the physical constraint output layer extracts the intermediate active power, intermediate reactive power, and intermediate power angle of each node from the deep feature matrix of the node.
[0227] Calculate the difference in the intermediate active power, the difference in the intermediate reactive power, and the difference in the intermediate power angle at the two ends of each branch.
[0228] The direction factor is calculated using trigonometric functions based on the difference in the intermediate power angle.
[0229] The active and reactive power of a branch are synthesized by using the direction factor, the difference between the intermediate active power and reactive power, and the thermal stability limit of the corresponding branch.
[0230] Furthermore, the solution construction module 305 can perform the following steps:
[0231] Substitute the node voltage magnitude, active power, reactive power and line admittance parameters into the preset AC power flow equation to calculate the voltage phase angle of all nodes.
[0232] Calculate the net injected power at each node based on active power and reactive power;
[0233] The active and reactive power outputs of each generator are calculated by performing algebraic operations on the net injected power and nodal load data.
[0234] Based on active power output, reactive power output, and voltage phase angle, an optimal power flow scheduling scheme is constructed.
[0235] Furthermore, the solution construction module 305 can also perform the following steps:
[0236] Based on the active power of each branch, the voltage amplitude of the two-end nodes, and the line admittance parameters, the first relationship is established.
[0237] Based on the reactive power of the branch, the voltage amplitude of the two-end nodes, and the line admittance parameters, a second relationship is established;
[0238] Using the first and second relations of all branches, a system of equations is constructed with the voltage phase angle of each node as the unknown.
[0239] Solve the system of equations to obtain the voltage phase angles of all nodes.
[0240] Please see Figure 4 , Figure 4 This is a structural block diagram of an electronic device provided in an embodiment of the present invention.
[0241] An electronic device according to an embodiment of the present invention includes: a memory 401 and a processor 402. The memory 401 stores a computer program. When the computer program is executed by the processor 402, the processor 402 executes the AC optimal power flow solution method as described in any of the above embodiments.
[0242] Memory 401 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Memory 401 has storage space 403 for program code 413 for performing any of the method steps described above. For example, storage space 403 for program code may include individual program codes 413 for implementing the various steps in the methods described above. This program code may be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, CDs, memory cards, or floppy disks. The program code may be compressed, for example, in a suitable form. When run by a computing processing device, this code causes the computing processing device to perform the various steps in the methods described above. This program code may be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, CDs, memory cards, or floppy disks. The program code may be compressed, for example, in a suitable form. When this code is run by a computing device, it causes the computing device to perform the steps in the AC optimal power flow solution method described above.
[0243] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the AC optimal power flow solution method as described in any of the above embodiments.
[0244] This invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, wherein when the program instructions are executed by a computer, the computer performs the AC optimal power flow solution method as described in any of the above embodiments.
[0245] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0246] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0247] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0248] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0249] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0250] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for solving optimal power flow in AC circuits, characterized in that, include: Acquire the topology connectivity data, line admittance parameters, and node load data of the target power grid; The topology connection data and the node load data are used to construct matrices, generating an adjacency matrix and an initial node feature matrix, respectively. The adjacency matrix and the initial feature matrix of the nodes are iteratively aggregated and transformed by a multi-layer graph convolutional network to generate a deep feature matrix of the nodes. The output layer with physical constraints calculates the node voltage amplitude and the active and reactive power of each branch of the target power grid based on the node deep feature matrix and the line admittance parameters. Based on the node voltage amplitude, active power, reactive power, line admittance parameters, and node load data, system state reconstruction and power balance calculations are performed to obtain the optimal power flow scheduling scheme.
2. The AC optimal power flow solution method according to claim 1, characterized in that, The step of generating a deep feature matrix of nodes by iteratively aggregating and transforming the adjacency matrix and the initial feature matrix of nodes through a multi-layer graph convolutional network includes: Construct a graph convolutional network consisting of multiple sequentially connected graph convolutional layers; The initial feature matrix of the nodes is input into the first graph convolutional layer of the graph convolutional network to generate the node feature matrix; The node feature matrix output by each graph convolutional layer is used as the input feature of its next adjacent graph convolutional layer, until the last graph convolutional layer. The node feature matrix output by the last graph convolutional layer is used as the node deep feature matrix.
3. The AC optimal power flow solution method according to claim 1, characterized in that, The step of calculating the node voltage amplitude and the active and reactive power of each branch of the target power grid based on the node deep feature matrix and the line admittance parameters through the physical constraint output layer includes: The deep feature matrix of the node is mapped to an intermediate voltage variable; The voltage intermediate variable is mapped to a preset interval by a preset scaling function corresponding to the physical constraint output layer, and then linearly transformed to a continuous interval defined by the preset voltage safety lower limit and upper limit to generate the node voltage amplitude. The active and reactive power of each branch of the target power grid are calculated by the physical constraint output layer based on the node deep feature matrix and the line admittance parameters.
4. The AC optimal power flow solution method according to claim 3, characterized in that, The step of calculating the active and reactive power of each branch of the target power grid based on the node deep feature matrix and the line admittance parameters through the physical constraint output layer includes: The branch power prediction sublayer of the physical constraint output layer extracts the intermediate active power, intermediate reactive power, and intermediate power angle of each node from the deep feature matrix of the node. Calculate the difference in the intermediate active power, the difference in the intermediate reactive power, and the difference in the intermediate power angle at the two ends of each branch. Based on the difference in the intermediate power angle, the direction factor is calculated using trigonometric functions; The active power and reactive power of the branch are synthesized by using the directional factor, the difference between the intermediate active power and reactive power, and the thermal stability limit of the corresponding branch.
5. The AC optimal power flow solution method according to any one of claims 1-4, characterized in that, The step of performing system state reconstruction and power balance calculation based on the node voltage amplitude, active power, reactive power, line admittance parameters, and node load data to obtain the optimal power flow scheduling scheme includes: Substituting the node voltage amplitude, active power, reactive power, and line admittance parameters into the preset AC power flow equation, the voltage phase angle of all nodes is calculated. Based on the active power and the reactive power, calculate the net injected power of each node; The net injected power and the node load data are used to perform algebraic operations to calculate the active power and reactive power of each generator. Based on the active power output, the reactive power output, and the voltage phase angle, an optimal power flow scheduling scheme is constructed.
6. The AC optimal power flow solution method according to claim 5, characterized in that, The step of substituting the node voltage amplitude, active power, reactive power, and line admittance parameters into a preset AC power flow equation to calculate the voltage phase angle of all nodes includes: Based on the active power of each branch, the voltage amplitude of the two-end nodes, and the line admittance parameters, a first relationship is established; Based on the reactive power of the branch, the voltage amplitude of the two-end nodes, and the line admittance parameters, a second relationship is established; Using the first and second relations of all the branches, a system of equations is constructed with the voltage phase angle of each node as the unknown. Solve the system of equations to obtain the voltage phase angles of all the nodes.
7. A system for solving AC optimal power flow, characterized in that, include: The data acquisition module is used to acquire the topology connection data, line admittance parameters, and node load data of the target power grid; The matrix construction module is used to construct matrices using the topology connection data and the node load data, respectively, to generate an adjacency matrix and a node initial feature matrix; The graph convolutional feature extraction module is used to perform iterative aggregation and transformation of the adjacency matrix and the initial feature matrix of the nodes through a multi-layer graph convolutional network to generate a deep feature matrix of the nodes. The physical constraint output module is used to calculate the node voltage amplitude and the active and reactive power of each branch of the target power grid based on the node deep feature matrix and the line admittance parameters through the physical constraint output layer. The scheme construction module is used to perform system state reconstruction and power balance calculation based on the node voltage amplitude, active power, reactive power, line admittance parameters and node load data, so as to obtain the optimal power flow scheduling scheme.
8. An electronic device, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the AC optimal power flow solution method as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the AC optimal power flow solution method as described in any one of claims 1-6.
10. A computer program product, characterized in that, The computer program product includes a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, wherein when the program instructions are executed by a computer, the computer performs the AC optimal power flow solution method as described in any one of claims 1-6.