Attorney Docket No.45288-0359WO1 POWER GRID CONTROL WITH GRAPH NEURAL NETWORKS CROSS-REFERENCE TO RELATED APPLICATIONS This application claims priority to U.S. Provisional Application No. 63/568,406, filed on March 21, 2024. The disclosure of the prior application is considered part of and is incorporated by reference in the disclosure of this application. BACKGROUND This specification relates to using neural networks to control power grids. Neural networks are machine learning models that employ one or more layers of nonlinear units to predict an output for a received input. Some neural networks include one or more hidden layers in addition to an output layer. The output of each hidden layer is used as input to the next layer in the network, i.e., the next hidden layer or the output layer. Each layer of the network generates an output from a received input in accordance with current values of a respective set of parameters. SUMMARY This specification describes a system implemented as computer programs on one or more computers in one or more locations that generates optimal power flow predictions for controlling a power grid (also referred to as an “electric grid”). Each power flow prediction defines an updated operating state for the power grid given the current input state of the power grid. For example, the updated operating state can be an operating state that, given the current input state of the power grid, is predicted to optimize an objective for controlling the power grid, e.g., that depends on the amount of power generated by the generators within the power grid, subject to a set of constraints. The constraints can include constraints for satisfying the demand for power within the power grid, physical constraints on the components of the power grid and, optionally, additional constraints, e.g., constraints that assist in maintaining stability within the power grid. In one aspect, a method includes: obtaining current grid data characterizing current values of a set of properties of a power grid at a current time point, the power grid comprising a plurality of buses connected by branches, each bus comprising one or more components, and the one or more components for one or more of the buses comprising a respective generator within the bus; processing the current grid data to generate input graph data characterizing a
Attorney Docket No.45288-0359WO1 graph representing the power grid, the graph comprising: a plurality of nodes, the plurality of nodes comprising a respective node representing each of the plurality of buses and respective nodes representing each of the components within each of the plurality of buses; a plurality of edges, the plurality of edges comprising a respective edge for each of the branches; and the current grid data comprising a respective node embedding for each of the plurality of nodes and a respective edge embedding for each of the plurality of edges; processing the input graph data using a graph neural network to generate output graph data, the output graph data comprising a respective output embedding for each node in a subgraph of the graph that comprises the one or more nodes representing the generators; and processing the output graph data to generate a power flow prediction for the power grid that defines an updated operating state of the power grid that defines how much power is produced at each of the generators at each of the plurality of buses. In some implementations, the method further includes controlling the power grid using the power flow prediction. In some implementations, the one or more components for one or more of the buses comprise a respective load within the bus. In some implementations, the one or more components for one or more of the buses comprise a respective shunt within the bus. In some implementations, the plurality of edges comprise, for each bus, a respective artificial edge connecting the node representing the bus and the respective nodes representing each of the components within the bus. In some implementations, processing the current grid data to generate input graph data characterizing a graph representing the power grid comprises processing the current grid data using an encoder neural network system to generate the respective node and edge embeddings. In some implementations, the updated operating state is an operating state that is predicted to optimize an objective for operation of the power grid subject to a set of constraints. In some implementations, the objective is based on an amount of power produced by each of the generators. In some implementations, the objective is to minimize a cost of operating the power grid.
Attorney Docket No.45288-0359WO1 In some implementations, processing the output graph data comprises: processing the output graph data using a decoder neural network system to generate an initial power flow prediction that comprises a respective real power value and a respective reactive power value for each of the generators. In some implementations, processing the output graph data further comprises: deriving, using the initial power flow prediction, a respective power flow for each of one or more of the branches. In some implementations, the initial power flow prediction comprises a respective voltage prediction for each of the buses. In some implementations, the graph neural network has been trained on a set of training examples to minimize a loss function, wherein each training example comprises respective training grid data for a respective training power grid and a respective target power flow prediction, and wherein the loss function measures, for each training example, an error between a power flow prediction for the training example generated by the graph neural network system and the respective target power flow prediction. In some implementations, the error is a mean squared error. In some implementations the decoder neural network system is trained jointly with the graph neural network. In some implementations, the encoder neural network system is trained jointly with the graph neural network. In some implementations, the loss function penalizes the power flow prediction for the training example for defining states that violate one or more of the set of constraints. In some implementations, the loss function comprises a respective auxiliary loss for each of one or more of the constraints. In another aspect, a system includes one or more computers; and one or more storage devices communicatively coupled to the one or more computers, wherein the one or more storage devices store instructions that, when executed by the one or more computers, cause the one or more computers to perform the respective operations of any of the above methods. In another aspect, one or more non-transitory computer storage media store instructions that when executed by one or more computers cause the one or more computers to perform the respective operations of any of the above methods.
Attorney Docket No.45288-0359WO1 Particular embodiments of the subject matter described in this specification can be implemented so as to realize one or more of the following advantages. Electricity (“power”) is delivered from producers to consumers through interconnected networks known as power grids that generally include large numbers of components interacting through electrical transmission lines. Power is produced at various types of generators and needs to be transmitted to consumers ranging from heavy industry to residential users. Operating the grid effectively is a challenging task that requires ensuring that enough power is reliably and economically dispatched across the network to satisfy demand. However, it is imperative that this is done while maintaining a balance between power injections and withdrawals and satisfying physical constraints, in order to prevent risks such as overloading of equipment, network outages or failure to supply power to consumers. In implementations this involves solving a constrained nonlinear non-convex optimization problem, e.g. an alternating current optimal power flow (AC-OPF) problem. For example, solving an AC-OPF problem can equate to finding a steady state operating point in a power grid that minimizes the cost of power generation while satisfying operating constraints and meeting power demand. In practice, because the demand, supply and grid specification can vary rapidly over time, it would be beneficial for the AC-OPF problem to be solved close to real-time and many times throughout any given day (e.g., every five to fifteen minutes). However, relying on traditional optimization tools to solve such a problem on a real-size grid is often computationally infeasible or non-achievable in real-time. This has led to a range of techniques designed to meet grid operators’ need for solutions to the AC-OPF problem at rapid timescales. One approach is to linearize the problem, resulting in the so-called DC-OPF formulation. However, because this approach does not include all of the physical constraints of the system, it cannot correctly represent true system costs. Additionally, solutions to the DC- OPF problem are known to be infeasible for AC-OPF and can require post-processing in order to make the solutions of practical use. Even then, these solutions are suboptimal due to the approximation of the original problem, potentially leading to higher carbon emissions and large amounts of excess costs.
Attorney Docket No.45288-0359WO1 More advanced approximation techniques such as convexification or implicit linearization, though closer to the original formulation, are impacted by similar limitations in which speed of computation is favored over accuracy. Even in cases where such approximate solutions are within the feasible region of the original AC-OPF formulation, their suboptimality results in higher costs and increased carbon emissions. Thus, finding solutions that are close to the AC-OPF solution in near real-time cannot be achieved by existing techniques. This specification describes techniques for addressing these issues and for generating high-quality power predictions with minimal latency by leveraging a graph neural network. In particular, by processing data characterizing a graph representing the power grid using the graph neural network to generate output graph data, and then generating an optimal power flow prediction for the power grid that defines an updated operating state of the power grid from the output graph data, the system can predict an accurate future operating state, i.e., one that is close to the AC-OPF solution, in near real-time. In particular, generating this prediction requires only a single forward pass through the graph neural network, meaning that it can be generated in near real-time. The details of one or more embodiments of the subject matter of this specification are set forth in the accompanying drawings and the description below. Other features, aspects, and advantages of the subject matter will become apparent from the description, the drawings, and the claims. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 shows an example power grid control system. FIG. 2 is a flow diagram of an example process for controlling a power grid. FIG. 3 shows an example of input and output graphs. FIG. 4 shows an example of the operation of the graph neural network system. FIG. 5 is a flow diagram of an example process for training the graph neural network system. FIG. 6 shows an example of the performance of the described techniques across different grid sizes relative to a conventional approach.
Attorney Docket No.45288-0359WO1 FIG. 7 shows an example of the optimal power flow convergence achieved by examples of the described techniques across different grid sizes relative to a conventional approach. FIG. 8 shows an example of the pre- and post-power flow running times of the described techniques relative to a conventional approach. Like reference numbers and designations in the various drawings indicate like elements. DETAILED DESCRIPTION FIG. 1 shows an example power grid control system 100. The power grid control system 100 is an example of a system implemented as computer programs on one or more computers in one or more locations, in which the systems, components, and techniques described below can be implemented. The system 100 generates power flow predictions for a power grid 160 using a graph neural network system 110. In this specification, a power flow prediction can refer to an “optimal” power flow prediction 150 for the power grid 160, i.e., a prediction of the optimal power flow for operating the power grid 160. The power grid 160 can be any of a variety of different types of power grids that include multiple components that interact with one another through electric transmission lines and that are used to transmit electricity from one or more producers to one or more consumers. Generally, the power grid 160 includes multiple buses that are connected by branches (transmission elements). For example, each branch can be an AC-line or a transformer. Each bus, in turn, includes one or more components. In particular, at least some of the buses include one or more generators. A bus can also or instead include other components, e.g., one or more loads, one or more shunts, or both. To generate an optimal power flow prediction 150 at a given time, the system 100 obtains current grid data 102 for a current time step, e.g., the mostly-recently measured or observed grid data as of the time point (time step) at which the prediction is being made. The current grid data 102 generally defines current values of properties of the components of the power grid 160. For example, the current grid data 102 can be a respective feature vector for each component of the power grid and for each branch of the power grid. The system 100 processes the current grid data 102 to generate input graph data 122.
Attorney Docket No.45288-0359WO1 For example, the system 100 can process the current grid data 102 using an encoder neural network system 120 to generate the input graph data 122. Generally, the encoder system 120 processes the current grid data 102 to generate respective embeddings for each node and edge of a graph that represents the power grid 160. Embeddings of nodes of the graph will be referred to as “node embeddings” and embeddings of edges of the graph will be referred to as “edge embeddings.” For example, the encoder neural network system can include a node embedding neural network, e.g., a multi-layer perceptron (MLP), that processes the feature vector for each component to generate the node embedding for the node representing the component. As another example, the encoder neural network system can include an edge embedding neural network, e.g., a multi-layer perceptron (MLP), that processes the feature vector for each branch to generate the edge embedding for the edge representing the branch. The system processes the input graph data 122 using a graph neural network 130 to generate output graph data 132. The output graph data 132 includes output embeddings for at least the nodes in a subgraph of the graph representing the power grid. In particular, the subgraph representing the power grid includes the generators and, optionally, additional components of the power grid. The graph neural network 130 generally includes graph neural network layers (also referred to as message passing layers). Each graph neural network layer receives as input the node and edge embeddings and updates the node and edge embeddings by performing message passing (e.g. iterative updating of the embeddings using node or edge embedding processing subnetworks). The graph neural network 130 can process the graph data using graph neural network layers in any of a variety of ways and the graph neural network layers can have any appropriate graph neural network layer architecture. For example, the layers can include any of message passing neural network (MPNN) layers, graph convolutional neural network (GCNN) layers, or graph simulator network (GSN) layers. The system 100 processes the output graph data 132 to generate the optimal power flow prediction 150. For example, the system can process the output graph data 132 using a decoder system 140 to generate the optimal power flow predictions 150.
Attorney Docket No.45288-0359WO1 In particular, the system 100 can process the output graph data 132 using the decoder system 140 to generate an initial optimal power flow prediction that includes predicted values for the real and reactive power of, e.g., the real and reactive power injected by, each of the generators. Optionally, the initial optimal power flow prediction can also include a respective voltage prediction for each of the buses. In some implementations, the system 100 uses the initial optimal power flow prediction as the optimal power flow prediction 150. In some other implementations, the system 100 derives a respective power flow for some or all of the branches in the grid 160 using the initial optimal power flow prediction and then includes the power flows in the optimal power flow prediction 150. Generally, the system 100 generates the optimal power flow prediction 150 by processing the input graph data using the (trained) graph neural network 130, and the power flow prediction 150 defines an operating state of the grid 160 that is predicted to, i.e., that the system 100 predicts will, optimize an objective for the operation of the grid 160 subject to a set of constraints. That is, as described above, the power flow prediction generated by the system 100 is an optimal power flow prediction 150 that is predicted to define an optimal operating state that optimizes the objective subject to the set of constraints. The operating objective is based on the power produced (the real power values) for each of the generators in the grid 160. For example, the objective can be to minimize the total power produced by the generators in the grid 160. As another example, the objective can be to minimize the total cost of the power produced by the generators in the grid 160. That is, each generator can be associated with a respective cost value that represents the cost, e.g., per unit, of power produced by the generator. The objective can then measure a weighted sum of the power produced by each of the generators in the grid 160, with the weight for each generator being the cost value for the generator. The constraints can include constraints for satisfying the demand for power within the power grid, physical constraints on the components of the power grid and, optionally, additional constraints, e.g., constraints that assist in maintaining stability within the power grid. Examples of constraints will be described next.
Attorney Docket No.45288-0359WO1 As one example, the system can represent the voltage of each bus in the system as a combination of magnitude and angle. In this example, one of the constraints can require that the bus voltage angle of each of the reference buses in the power grid be 0. As one example, the reference buses can be selected to be a fixed size subset of the buses in the grid that have the largest power capacities. As another example, one of the constraints can limit the generator power values to be within the equipment physical range, i.e., limit the generator power value for each generator to be within the physical range of power values that the generator is capable of producing. As another example, one of the constraints can limit the voltage magnitude of the buses to be within the equipment physical range, i.e., limit the voltage magnitude for each bus to be within the physical range of voltages that the bus is capable of supporting. As another example, one of the constraints can require that the power be balanced throughout the power grid by requiring that the net injected power at each bus equals the power flowing through the branches connected to the bus. As another example, one of the constraints can be a constraint on the power flowing in each branch in a “from” direction (from a bus connected by the branch) and another of the constraints can be a constraint on the power flowing in each branch in a “to” direction (to a bus connected by the branch). As another example, the set of constraints can require that the maximum power flowing through any given branch is less than the branch thermal limit for the branch, where the branch thermal limit represents the maximum power that can flow through a branch without the branch being damaged, e.g., by overheating. As another example, the set of constraints can include bounds on the voltage angle difference of connected buses, which assists in maintaining the stability of the network. As a particular example of the above, the power grid 160 can be represented as (i) a set of N buses (denoted by a set ^), (ii) a set of branches, e.g., where each branch is either an AC- line or a transformer, ^ and the corresponding reverse orientation ^^, (iii) a set of generators ^, (iv) a set of loads ^, and (v) a set of shunts ^. As previously described, some of the buses are considered to include components such as generator(s), load(s) or shunt(s).
Attorney Docket No.45288-0359WO1 In the particular example, the relevant values within the power grid can be expressed as values of one or more of the following properties: ^^ ^ ∀^ ∈ ^ Generator complex power dispatch ^^^ ^ , ^^ ^ ∀^ ∈ ^ Generator complex power bounds #$^, #%^, #&^∀^ ∈ ^ Generator cost components '( ∀( ∈ ) Bus complex voltage -^ - ∀( ∈ ) Bus voltage magnitude bounds Branch complex power flow Load complex power consumption Bus shunt admittance 8 Branch pi-section parameters Branch complex transformation ratio Branch apparent power limit Branch current limit Branch voltage angle difference bounds where respectively indicate lower and upper bounds and subscripts label
buses. Then, the variables that are specified in the flow prediction can be expressed as: ^^ ^ ∀^ ∈ ^ '( ∀( ∈ ) ^(/ ∀(( , /) ∈ 8 ∪ 8> the objective can be expressed as:
B∈G + ℜ E B @IB D^B F where of a complex value. In other implementations other
The set of constraints can include one or more of: ∠'M = & ∀M ∈ O ^^^ ^ ^ ^ ≤ ^^ ≤ ^^ ∀^ ∈ ^ -^ ( ≤ |'(| ≤ -( ∀( ∈ )
Attorney Docket No.45288-0359WO1 ^
(/ \]̂ ;<^ (/ ≤ ∠D' ∗ < ('/F ≤ ;(/ ∀((, /) ∈ 8 where * denotes the complex conjugate, ∠ refers to the complex angle, and r denotes a reference bus. The system 100 or another system can then use the optimal power flow prediction 150 to control the power grid 160. For example, the system 100 or the other system can cause the power grid 160 to enter the operating state by controlling the components of the power grid 160. That is, the system 100 can cause the power grid 160 to enter the operating state by controlling the generation of electrical power by the facility or the coupling of generated electrical power into the grid, e.g., by performing one of a set of actions for controlling the grid 160. For example, the actions may include actions to control an electrical or mechanical configuration of an electrical power generator such as the electrical or mechanical configuration of one or more renewable power generating elements, e.g., to control a configuration of a wind turbine or of a solar panel or panels or mirror, or the electrical or mechanical configuration of a rotating electrical power generation machine. Mechanical control actions may, for example, include actions that control the conversion of an energy input to an electrical energy output, e.g., an efficiency of the conversion or a degree of coupling of the energy input to the electrical energy output. Electrical control actions may, for example, include actions that control one or more of a voltage, current, frequency or phase of electrical power generated. As another example, the system 100 can provide the optimal power flow prediction 150 as input to a larger system that performs one or more power systems operations tasks, e.g., one or more of so-called unit commitment, security constrained economic dispatch, congestion
Attorney Docket No.45288-0359WO1 management or optimal transmission switching. The larger system 100 can then use the optimal power flow prediction 150 to control the power grid to perform one or more of the power systems operations tasks. As another example, the system 100 can provide data specifying the optimal power flow prediction 150 for presentation to a user. The user can then determine how to modify the controls of the power grid. For example, the user may be able to submit an input that causes the system 100 to perform actions to cause the grid 160 to enter the operating state or to modify one or more of the values in the prediction 150 prior to causing the system 100 to perform actions to cause the grid 160 to enter a modified operating state. Generally, prior to using the graph neural network system 110 to control the power grid 160, the system 100 or another training system trains the graph neural network system 110 (and the encoder and decoder neural network systems) on training data. Training the graph neural network system 110 will be described in more detail below with reference to FIG. 5. FIG. 2 is a flow diagram of an example process 200 for controlling a power grid. For convenience, the process 200 will be described as being performed by a system of one or more computers located in one or more locations. For example, a power grid control system, e.g., the power grid control system 100 of FIG.1, appropriately programmed, can perform the process 200. The system obtains current grid data (step 202). As described above, the current grid data generally specifies current values of a set of properties of the power grid, e.g. values of features as described below. For example, the current grid data can be represented as a respective feature vector for each component and branch of the grid, e.g., that includes current values for one or more of the properties described above. Examples of features that can be included in the features in the respective feature vectors will now be described. For example, for nodes that represent buses, the features can include one or more of: base voltage of the bus, the type of the bus (e.g., PQ, PV, reference, or inactive), the minimum voltage magnitude for the bus, or the maximum voltage magnitude for the bus. Also or instead the features can include the voltage magnitude (vm) of a voltage of the bus or bus component
Attorney Docket No.45288-0359WO1 (|_̀ |) or a voltage angle (va) of a voltage of the bus or bus a F) e.g. defined
with response to another bus to which the bus is linked by a branch. As another example, for nodes that represent generators, the features can include one or more of: the total MVA base for the bus, the initial real power generation for the bus, the minimum real power generation, the maximum real power generation, the initial reactive power generation, the minimum reactive power generation, the maximum reactive power generation, the initial voltage magnitude, the coefficient of pg2 for the bus in the cost term, the coefficient of pg for the bus in the cost term, the constant coefficient for the bus in the cost term, and so on. As another example, for nodes that represent loads, the features can include one or more of the real power demand, the reactive power demand, and so on. As another example, for nodes that represent shunts, the features can include one or more of the shunt susceptance, the shunt conductance, and so on. As another example, for edges that represent AC-lines, the features can include one or more of: the minimum angle difference between the from and to bus, the maximum angle difference between the from and to bus, the line charging susceptance at the from bus, the line charging susceptance at the to bus, the branch series resistance, the branch series reactance, the long term thermal line rating, the short term thermal line rating, the emergency thermal line rating, and so on. Also or instead the features can include one or more of: active power withdrawn at the to bus (pt bℜD^a`Fc); reactive power withdrawn at the to bus (pt bℑD^a`Fc); active power
(pf bℜD^`aFc); and reactive power withdrawn at the from bus (pf bℑD^`aFc).
for edges that represent transformers, the features can include
features, optionally augmented with one or more of the branch off nominal turns ratio shift or the branch phase shift angle. The system processes the current grid data to generate input graph data (step 204). For example, the system can process the respective feature vectors using an encoder neural network system to generate respective node and edge embeddings for each node and edge in the graph representing the power grid.
Attorney Docket No.45288-0359WO1 The system processes the current graph data using the graph neural network to generate output graph data (step 206). As described above, the output graph data generally includes respective output embeddings for each of one or more nodes in an output subgraph of the input graph, where the subgraph includes at least nodes representing the generators in each of the buses of the power grid. An example of the input and output graphs is described below with reference to FIG. 3. The system processes the output graph data to generate an optimal power flow prediction (step 208). For example, the system can process the output graph data using a decoder neural network system to generate an initial power flow prediction, i.e., an initial optimal power flow prediction, that includes a respective real power value and a respective reactive power value for each of the generators. Optionally, the initial optimal power flow prediction can also include a respective voltage prediction for each of the buses. For example, the respective voltage prediction can include a respective voltage angle for the bus and a voltage magnitude for the bus. The decoder neural network system can generally have any appropriate neural network architecture that allows the decoder neural network system to map the output embeddings to the initial optimal power flow prediction. For example, the decoder neural network system can include a node decoder neural network, e.g., a multi-layer perceptron (MLP), that processes the output embedding for the node representing each generator to generate the respective real power value and respective reactive power value for the generator. As another example, the decoder neural network system can include an edge decoder neural network, e.g., a multi-layer perceptron (MLP), that processes the output embedding for the edge representing each branch to generate the voltage prediction for the branch. As yet another example, the decoder neural network system can include one or more graph neural network layers that perform message passing to update the output embeddings for the nodes and edges in the subgraph prior to using the node and edge decoder neural networks to generate the initial prediction as described above.
Attorney Docket No.45288-0359WO1 Optionally, the system can refine the initial prediction by deriving, using the initial optimal power flow prediction, a respective optimal power flow for each of one or more of the branches. This will be described in more detail below with reference to FIG. 4. The system controls the power grid using the optimal power flow predictions, e.g., as described above with reference to FIG. 1 (step 210). FIG. 3 shows an example 300 of an input graph 320 and an output graph 330. As shown in FIG. 3, the input graph 320 is the input graph that is characterized by the input graph data that is processed by the graph neural network. In particular, the input graph 320 includes respective nodes corresponding to generators, loads, shunts, and buses within the power grid. The input graph 320 includes different types of edges: edges representing AC-lines that connect buses, edges representing transformers that connect buses; it may, but need not include artificial subnode-bus edges that connect buses and corresponding generators, load, and shunt components. The output graph 330 is a subgraph of the input graph 320 and includes respective nodes representing generators and buses, edges representing AC-lines that connect buses, and edges representing transformers that connect buses. That is, the output graph 330 is a subgraph of the input graph 320 with the load nodes, the shunt nodes, and the subnode-bus edges removed. FIG. 4 shows an example 400 of the operation of the system. As shown in the example, the system obtains the current grid data as a respective feature vector for each node and edge in the input graph. The system processes the current grid data using the encoder neural network system to generate input graph data that includes respective node and edge embeddings for each node and edge in the graph representing the power grid. The system processes the current graph data using the graph neural network (the “processor”) to generate output graph data that includes respective output embeddings for each of one or more nodes in the output subgraph of the input graph. In the example 400, the graph neural network can be an Interaction Network that performs multiple message passing steps, with some or all of the message passing steps being augmented with residual connections. That is, each message passing step corresponds to
Attorney Docket No.45288-0359WO1 processing the node and edge embeddings using an Interaction Network to update the node and edge embeddings. For some or all of the message passing steps, the system generates the updated node and edge embedding by applying a residual connection between the input node and edge embeddings to the message passing step and the output node and edge embeddings generated by the Interaction Network corresponding to the step. Interaction Networks are described in more detail in Battaglia, et al, Interaction Networks for Learning about Objects, Relations and Physics, arXiv:1612.00222. The system then processes the output graph data using the decoder neural network system to generate, in the example of FIG. 4, an initial optimal power flow prediction that includes a respective real power value and a respective reactive power value for each of the generators and a respective voltage prediction for each of the buses. In the example of FIG. 4, the system refines the initial prediction by deriving, using the initial optimal power flow prediction, a respective optimal power flow for each of one or more of the branches. In particular, to perform the power flow derivation, the system (implicitly) solves a set of power flow equations using the values in the initial optimal power flow prediction to generate, e.g., the power flows for the branches within the power grid. In particular, in the example of FIG. 4, the decoder outputs the voltage angle va and the voltage magnitude vm as bus node features, as well as quantities relating to generator dispatched power (real power) pg and reactive power qg as generator node features. A branch flow derivation module uses these predicted values to compute the branch complex power in the two directions (real and reactive powers pf, qf, pt, qt). For example, the branch flow derivation module can perform this according to Equations (9) and (10) described above (equations for branch power flow in a “to” direction from bus j to bus i and in a “from” direction from bus i to bus j, ^a` and ^`a, often referred to as branch flow equations or Ohm’s constraints). The branch flow
module can use the predicted values to compute the branch complex power in the two directions (real and reactive powers pf, qf, pt, qt) according to Equations (9) and (10) in any of a variety of ways. For example, the module can perform a power flow (or load flow) process to compute the required quantities. Power flow (or load flow) is the process of finding bus voltage angles
Attorney Docket No.45288-0359WO1 and magnitudes which are solutions of the bus power balance equation (8), for all buses (which states that net injected power at each bus equals the power flowing through the branches connected to the bus). For the purpose of power flow, it is easier to rewrite it so that all quantities depending on the voltages are on the right hand side of the equation, and separate the real and reactive components: T ℜD^EF − T ℜD^gF = T i + T lm|_̀ |A B B `a B |A where pij and lm B = ℜ(tm B ) and
B complex coefficient of the shunt admittance. At each bus, there are four variables: the total active power P, the total reactive power Q, the voltage angle θ, and the voltage magnitude |V |. If two of them are known, the two remaining can be determined using equations (A-1)–(A-2). Buses are classified according to the known/unknown variables, as shown by the below table:
Attorney Docket No.45288-0359WO1 Bus type Known Variables Unknown variables
PQ o, s |_|, u Slack V, u o, s PV buses are voltage controlled buses, where at least a generator is connected. PQ buses are all load buses and buses with nothing attached. The Slack bus is a generator bus selected to compensate for the network losses. The generator bus with the larger power capacity is typically chosen for this role, and its voltage angle is set to 0, thus acting also as the reference bus. Let NPQ be the number of PQ buses and NPV the number of PV buses. Each PQ bus has two unknowns: |V | and θ. These can be derived using the two equations (A-1)–(A-2) since at these buses both P and Q are known. Each PV bus has a single unknown, θ. Since P is known, it can be derived using the real power balance equation (A-1). Therefore, with a system of 2NPQ + NPV equations, all bus voltages can be determined by means of a traditional root- finding method, such as Newthon- Raphson or Gauss-Siedel. Once the bus voltages are known, the total reactive power at each PV bus, Q, can be found using (A-2). The bus total reactive power is then distributed among connected generators using different heuristics, typically proportionally to their capacity. Likewise, the slack real and reactive power P, Q can be calculated via (A-1)–(A-2). During the procedure, generators’ reactive bounds can be violated. The system can enforce them, e.g., by limiting generators outside range to their maximum capacity and converting the corresponding bus to a PQ bus. Therefore, after power flow, the following holds: • All PQ buses have new voltage values, va’, vm’. • All PV buses have new voltage angles va’. Note that if reactive limits have been enforced and the bus has been limited, vm’ can show changes as well. • Generators have new reactive power qg’. • Slack generator(s) have new real and reactive power pg’, qg’. • New values for the voltage lead to new values for the
Attorney Docket No.45288-0359WO1 branch flows, pf’, qf’, pt’, qt’. FIG. 5 is a flow diagram of an example process 500 for training the graph neural network system. For convenience, the process 500 will be described as being performed by a system of one or more computers located in one or more locations. For example, a power grid control system, e.g., the power grid control system 100 of FIG.1, appropriately programmed, can perform the process 500. The system obtains a training example that includes (i) training power grid data characterizing a training power grid at a particular time point and (ii) a target power grid prediction (step 502). For example, the target power grid prediction can have been generated by applying a solver for the AC-OPF problem to the training power grid data. As described above, an AC-OPF solver can generate high-quality solutions but can have running times that make it impractical for use in controlling real-world power grids. There are many examples of AC-OPF solvers; one example is AC-IPOPT (Wachter and Biegler, “On the implementation of an interior point filter line-search algorithm for large-scale nonlinear programming,” Mathematical programming, vol. 106, pp. 25–57, 2006; and Coffrin et al., “Powermodels.jl: An open-source framework for exploring power flow formulations,” 2018 Power Systems Computation Conference (PSCC), pp. 1–8, June 2018). The system processes the training power grid data characterizing the training power grid using the graph neural network system to generate an (initial) optimal power flow prediction (step 504). In some implementations, during training, the system can also generate a respective prediction for each of one or more of the constraints described above (step 506). For example, the system can include within the decoder neural network system one or more auxiliary heads that each generate a prediction for one or more constraints. The prediction can be, e.g., a prediction of whether the constraint is violated or a prediction of the corresponding value(s) to which the constraint is applied. The system determines an error between the initial optimal power flow prediction and the target power flow prediction (step 506). For example, the error can be the mean squared error between the corresponding values in the two predictions. The system can optionally also determine the respective errors in the predictions for the one or more constraints (step 508).
Attorney Docket No.45288-0359WO1 The system then trains the graph neural network system on a loss function that measures the error between the initial optimal power flow prediction and the target power flow prediction (step 510). In some implementations, to encourage the graph neural network system to generate outputs that satisfy the set of constraints, the loss function can also include one or more constraint loss terms. As one example, the loss function can include a respective auxiliary loss for each of one or more of the constraints that measures the respective errors for the predictions generated for those constraints. As another example, the loss function can include one or more terms, collectively referred to as a constraint loss, that penalize the optimal power flow prediction for the training example for defining states that violate one or more of the set of constraints. For example, the constraint loss can aggregate the constraint violation degrees for each constraint. For equality constraints, a constraint degree measures the absolute distance between the left-hand and right-hand sides of the equations. For inequality constraints, the constraint degree measures the distance to the closest boundary (or equals zero when the constraint is satisfied). As a particular example, the system can use a loss function that has two terms as follows: ℓ(^; x) ≔ ℓmz{|}~`m|g(^; x) + ^ℓ^^^m^}^`^^m(^; x), where and C is a constraint
e.g., or The supervised loss ℓsupervised aggregates the L2 losses for the bus voltage, the generator power, and the branch power between the predicted values and the targets. For example, the supervised loss can be a sum or a weighted sum of the losses for the bus voltage, the generator power, and the branch power. The constraint loss ℓconstraints aggregates the constraint violation degrees for each constraint. For example, the supervised loss can be a sum or a weighted sum of the constraint violation degrees for the constraints. By repeatedly performing the process 500 on different batches of training examples, the system can train the neural network system to generate accurate power flow outputs.
Attorney Docket No.45288-0359WO1 FIG. 6 shows an example 600 of the performance of the described techniques across different grid sizes relative to a conventional approach. In particular, the example 600 shows the performance of various examples of the described neural network system, i.e., with varying numbers of parameters, relative to an approximate DC-OPF solver (DC-IPOPT). One example configuration of the various examples of the described techniques that are described in FIG. 7 is shown in the below Table: message passing steps hidden size
In the table, the message passing steps column refers to the number of graph neural network layers included in the system and the hidden size refers to the dimensionality of the embeddings that are processed by the graph neural network. As can be seen from the example 600, the described techniques outperform the conventional approach across multiple model sizes in addition to being able to provide a full solution instead of the partial solution provided by the conventional approach. FIG. 7 shows an example 700 of the optimal power flow convergence achieved by examples of the described techniques across different grid sizes relative to a conventional approach. In particular, the example 700 shows the convergence of various examples of the described neural network system, i.e., with varying numbers of parameters, relative to the approximate DC-OPF solver (DC-IPOPT). As can be seen from the example 700, the described techniques are able to achieve a high convergence rate across all grid sizes despite the increased performance (shown above) and decreased running time (shown below) relative to the conventional approach. FIG. 8 shows an example 800 of the pre- and post-power flow running times of the described techniques relative to conventional approaches. In particular, the example 800 shows the running time of various examples of the described neural network system, i.e., with varying numbers of parameters, relative to the approximate DC-OPF solver (DC-IPOPT) and to a full ACOPF solver (AC-IPOPT). As indicated above, while AC-IPOPT may generate “gold
Attorney Docket No.45288-0359WO1 standard” solutions, the running times are significantly higher than those of the described techniques and even to the DC-IPOPT technique. The described techniques, on the other hand, yield significantly faster running times while outperforming DC-IPOPT. While this specification generally describes that the system uses a graph neural network to process the input graph data to generate the output graph data, in some implementations, the system uses a different type of neural network to perform this process. Examples of these types of neural networks include self-attention neural networks that include one or more self-attention layers, recurrent neural networks that include one or more recurrent neural network layers, and neural networks that include both self-attention layers and recurrent neural network layers. In this specification, the term "configured" is used in relation to computing systems and environments, as well as computer program components. A computing system or environment is considered "configured" to perform specific operations or actions when it possesses the necessary software, firmware, hardware, or a combination thereof, enabling it to carry out those operations or actions during operation. For instance, configuring a system might involve installing a software library with specific algorithms, updating firmware with new instructions for handling data, or adding a hardware component for enhanced processing capabilities. Similarly, one or more computer programs are "configured" to perform particular operations or actions when they contain instructions that, upon execution by a computing device or hardware, cause the device to perform those intended operations or actions. The embodiments and functional operations described in this specification can be implemented in various forms, including digital electronic circuitry, software, firmware, computer hardware (encompassing the disclosed structures and their structural equivalents), or any combination thereof. The subject matter can be realized as one or more computer programs, essentially modules of computer program instructions encoded on a tangible non-transitory storage medium for execution by or to control the operation of a computing device or hardware. The storage medium can be a storage device such as a hard drive or solid-state drive (SSD), a storage medium, a random or serial access memory device, or a combination of these. Additionally or alternatively, the program instructions can be encoded on a transmitted signal, such as a machine-generated electrical, optical, or electromagnetic signal, designed to carry information for transmission to a receiving device or system for execution by a computing device or hardware. Furthermore, implementations may leverage emerging technologies like
Attorney Docket No.45288-0359WO1 quantum computing or neuromorphic computing for specific applications, and may be deployed in distributed or cloud-based environments where components reside on different machines or within a cloud infrastructure. The term "computing device or hardware" refers to the physical components involved in data processing and encompasses all types of devices and machines used for this purpose. Examples include processors or processing units, computers, multiple processors or computers working together, graphics processing units (GPUs), tensor processing units (TPUs), and specialized processing hardware such as field-programmable gate arrays (FPGAs) or application-specific integrated circuits (ASICs). In addition to hardware, a computing device or hardware may also include code that creates an execution environment for computer programs. This code can take the form of processor firmware, a protocol stack, a database management system, an operating system, or a combination of these elements. Embodiments may particularly benefit from utilizing the parallel processing capabilities of GPUs, in a General- Purpose computing on Graphics Processing Units (GPGPU) context, where code specifically designed for GPU execution, often called kernels or shaders, is employed. Similarly, TPUs excel at running optimized tensor operations crucial for many machine learning algorithms. By leveraging these accelerators and their specialized programming models, the system can achieve significant speedups and efficiency gains for tasks involving artificial intelligence and machine learning, particularly in areas such as computer vision, natural language processing, and robotics. A computer program, also referred to as software, an application, a module, a script, code, or simply a program, can be written in any programming language, including compiled or interpreted languages, and declarative or procedural languages. It can be deployed in various forms, such as a standalone program, a module, a component, a subroutine, or any other unit suitable for use within a computing environment. A program may or may not correspond to a single file in a file system and can be stored in various ways. This includes being embedded within a file containing other programs or data (e.g., scripts within a markup language document), residing in a dedicated file, or distributed across multiple coordinated files (e.g., files storing modules, subprograms, or code segments). A computer program can be executed on a single computer or across multiple computers, whether located at a single site or distributed across multiple sites and interconnected through a data communication network.
Attorney Docket No.45288-0359WO1 The specific implementation of the computer programs may involve a combination of traditional programming languages and specialized languages or libraries designed for GPGPU programming or TPU utilization, depending on the chosen hardware platform and desired performance characteristics. In this specification, the term "engine" broadly refers to a software-based system, subsystem, or process designed to perform one or more specific functions. An engine is typically implemented as one or more software modules or components installed on one or more computers, which can be located at a single site or distributed across multiple locations. In some instances, one or more dedicated computers may be used for a particular engine, while in other cases, multiple engines may operate concurrently on the same one or more computers. Examples of engine functions within the context of AI and machine learning could include data pre-processing and cleaning, feature engineering and extraction, model training and optimization, inference and prediction generation, and post-processing of results. The specific design and implementation of engines will depend on the overall architecture and the distribution of computational tasks across various hardware components, including CPUs, GPUs, TPUs, and other specialized processors. The processes and logic flows described in this specification can be executed by one or more programmable computers running one or more computer programs to perform functions by operating on input data and generating output. Additionally, graphics processing units (GPUs) and tensor processing units (TPUs) can be utilized to enable concurrent execution of aspects of these processes and logic flows, significantly accelerating performance. This approach offers significant advantages for computationally intensive tasks often found in AI and machine learning applications, such as matrix multiplications, convolutions, and other operations that exhibit a high degree of parallelism. By leveraging the parallel processing capabilities of GPUs and TPUs, significant speedups and efficiency gains compared to relying solely on CPUs can be achieved. Alternatively or in combination with programmable computers and specialized processors, these processes and logic flows can also be implemented using specialized processing hardware, such as field-programmable gate arrays (FPGAs) or application-specific integrated circuits (ASICs), for even greater performance or energy efficiency in specific use cases.
Attorney Docket No.45288-0359WO1 Computers capable of executing a computer program can be based on general-purpose microprocessors, special-purpose microprocessors, or a combination of both. They can also utilize any other type of central processing unit (CPU). Additionally, graphics processing units (GPUs), tensor processing units (TPUs), and other machine learning accelerators can be employed to enhance performance, particularly for tasks involving artificial intelligence and machine learning. These accelerators often work in conjunction with CPUs, handling specialized computations while the CPU manages overall system operations and other tasks. Typically, a CPU receives instructions and data from read-only memory (ROM), random access memory (RAM), or both. The elements of a computer include a CPU for executing instructions and one or more memory devices for storing instructions and data. The specific configuration of processing units and memory will depend on factors like the complexity of the AI model, the volume of data being processed, and the desired performance and latency requirements. Embodiments can be implemented on a wide range of computing platforms, from small embedded devices with limited resources to large-scale data center systems with high- performance computing capabilities. The system may include storage devices like hard drives, SSDs, or flash memory for persistent data storage. Computer-readable media suitable for storing computer program instructions and data encompass all forms of non-volatile memory, media, and memory devices. Examples include semiconductor memory devices such as read-only memory (ROM), solid-state drives (SSDs), and flash memory devices; hard disk drives (HDDs); optical media; and optical discs such as CDs, DVDs, and Blu-ray discs. The specific type of computer-readable media used will depend on factors such as the size of the data, access speed requirements, cost considerations, and the desired level of portability or permanence. To facilitate user interaction, embodiments of the subject matter described in this specification can be implemented on a computing device equipped with a display device, such as a liquid crystal display (LCD) or an organic light-emitting diode (OLED) display, for presenting information to the user. Input can be provided by the user through various means, including a keyboard), touchscreens, voice commands, gesture recognition, or other input modalities depending on the specific device and application. Additional input methods can include acoustic, speech, or tactile input, while feedback to the user can take the form of visual, auditory, or tactile feedback. Furthermore, computers can interact with users by exchanging
Attorney Docket No.45288-0359WO1 documents with a user's device or application. This can involve sending web content or data in response to requests or sending and receiving text messages or other forms of messages through mobile devices or messaging platforms. The selection of input and output modalities will depend on the specific application and the desired form of user interaction. Machine learning models can be implemented and deployed using machine learning frameworks, such as TensorFlow or JAX. These frameworks offer comprehensive tools and libraries that facilitate the development, training, and deployment of machine learning models. Embodiments of the subject matter described in this specification can be implemented within a computing system comprising one or more components, depending on the specific application and requirements. These may include a back-end component, such as a back-end server or cloud-based infrastructure; an optional middleware component, such as a middleware server or application programming interface (API), to facilitate communication and data exchange; and a front-end component, such as a client device with a user interface, a web browser, or an app, through which a user can interact with the implemented subject matter. For instance, the described functionality could be implemented solely on a client device (e.g., for on-device machine learning) or deployed as a combination of front-end and back-end components for more complex applications. These components, when present, can be interconnected using any form or medium of digital data communication, such as a communication network like a local area network (LAN) or a wide area network (WAN) including the Internet. The specific system architecture and choice of components will depend on factors such as the scale of the application, the need for real-time processing, data security requirements, and the desired user experience. The computing system can include clients and servers that may be geographically separated and interact through a communication network. The specific type of network, such as a local area network (LAN), a wide area network (WAN), or the Internet, will depend on the reach and scale of the application. The client-server relationship is established through computer programs running on the respective computers and designed to communicate with each other using appropriate protocols. These protocols may include HTTP, TCP/IP, or other specialized protocols depending on the nature of the data being exchanged and the security requirements of the system. In certain embodiments, a server transmits data or instructions to a user's device, such as a computer, smartphone, or tablet, acting as a client. The client device can
Attorney Docket No.45288-0359WO1 then process the received information, display results to the user, and potentially send data or feedback back to the server for further processing or storage. This allows for dynamic interactions between the user and the system, enabling a wide range of applications and functionalities. While this specification contains many specific implementation details, these should not be construed as limitations on the scope of any invention or on the scope of what may be claimed, but rather as descriptions of features that may be specific to particular embodiments of particular inventions. Certain features that are described in this specification in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination. Moreover, although features may be described above as acting in certain combinations and even initially be claimed as such, one or more features from a claimed combination can in some cases be excised from the combination, and the claimed combination may be directed to a subcombination or variation of a subcombination. Similarly, while operations are depicted in the drawings and recited in the claims in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order, or that all illustrated operations be performed, to achieve desirable results. In certain circumstances, multitasking and parallel processing may be advantageous. Moreover, the separation of various system modules and components in the embodiments described above should not be understood as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products. Particular embodiments of the subject matter have been described. Other embodiments are within the scope of the following claims. For example, the actions recited in the claims can be performed in a different order and still achieve desirable results. As one example, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some cases, multitasking and parallel processing may be advantageous. What is claimed is: