KKT conditional learning graph neural network construction method for real-time optimal power flow
Through the KKT conditional learning graph neural network method, the lack of accuracy and efficiency in the real-time optimal flow problem of power system is solved, efficient and accurate flow analysis and topological adaptability are achieved, labeled data needs are reduced, and decision-making speed is significantly improved. Cost-effective.
Patent Information
- Application Number
- CN202411058461.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2024-11-26
AI Technical Summary
In the prior art, when dealing with the real-time optimal current problem of power systems, traditional methods have problems with accuracy and efficiency, especially in high load situations, DCOPF is not accurate enough, and the second-order cone method may lead to the decision area being not compact and the solution is inaccurate. Moreover, deep neural network-based methods are difficult to adapt to topological changes and physical constraints, and are not robust and generalized.
Using the KKT conditional learning graph neural network (PG-GNN) method, the ACOPF model is transformed into equation constraints through nonlinear planning, and GNN is trained using Lagrangian function and gradient descent algorithm, and physical constraints are introduced as loss functions, and the learning is followed. The pattern of physical laws of power systems and utilizes unsupervised learning to reduce labeled data demand.
It realizes more accurate ACOPF solution under real-time conditions, improves topological adaptability and compliance with physical constraints, avoids time-consuming labeled data, significantly improves decision efficiency and generalization performance, and can quickly adapt to different topological structures.
Smart Images

Figure CN119026635A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power systems, and in particular to a method for constructing a KKT conditional learning graph neural network for real-time optimal power flow. Background Art
[0002] In recent years, due to the influence of many new things such as high penetration of renewable energy, variable topology, deregulated electricity market, etc., the power system is operating in a more unstable and random manner, which makes large-scale failures and even blackouts more likely to occur than before. This forces system operators to increase the frequency of adjusting generator set points to meet power demand while ensuring stable network operation. However, due to the sinusoidal nature of electrical characteristics, ACOPF is usually a high-dimensional, nonlinear and non-convex problem. Therefore, how to solve ACOPF is a challenging and time-consuming problem. Usually, in the pursuit of fast and reliable scheduling, the non-convexity can be relaxed to a convex model by using DCOPF or second-order cone techniques. The problem is that when the power network is heavily loaded, DCOPF may not be accurate enough, and the second-order cone may cause the decision feasible region to be not compact and the solution to be inaccurate, which may provide unreliable scheduling. In short, traditional methods have major problems in balancing accuracy and efficiency.
[0003] To address these issues, some scholars have recently proposed using deep neural networks (DNNs) to predict solutions to ACOPF. This approach is generally to directly learn the mapping relationship between operations and ACOPF solutions by performing supervised learning (SL), also known as imitation learning (IL). In the SL / IL framework, the sampled operating conditions need to be packaged together with their corresponding ACOPF solutions to provide labeled data for training. If the DNN model is well trained on labeled data, the ACOPF solution can be simply calculated through a real-time forward propagation process. However, since the SL / IL method can only capture existing patterns presented in the data, and the decision quality depends only on the data distribution and the SL model itself, which makes it difficult to find real physical patterns, robustness and generalization capabilities may be limited. As described in the literature, pure SL / IL can easily violate constraints. Therefore, two alternative methods have been proposed for this problem. One of them still belongs to the category of SL / IL, but involves several necessary physical constraints. For example, the prior art restricts the learning process by introducing constraint violation penalties in the DNN loss function, and then uses the Lagrangian dual method to adjust the penalty weights during training. Numerical studies have shown that the DNN-based ACOPF solution will be more accurate when the learning region is reinforced. A similar idea has been proposed in the prior art, where researchers introduced power transfer penalties into the DCOPF-oriented DNN learning loss. Another approach is reinforcement learning (RL), which adapts the ACOPF model through a reward mechanism. However, for high-performance reinforcement learning, the reward function must be carefully designed, and even so, RL is still prone to falling into local optimal solutions. To solve this problem, the Lagrangian method is introduced.
[0004] Incorporating Lagrangian methods into RL training enables RL to search for solutions to the Optimal Power Flow problem (OPF) on an optimization path. Overall, existing research has provided some physical and data-driven solutions to ACOPF, but there are still some key issues, such as topological adaptability, which is still under consideration and has not been resolved. In addition, adopting simple penalty-based methods to learn multiple physical constraints requires careful design of penalty weights, and their perfect values are difficult to find. Therefore, when DNNs trained in this way are deployed online, violations of physical laws may occur.
[0005] In order to improve topological adaptability, we must take into account the spatial correlation within the data. Graph Neural Network (GNN) is designed for this purpose. GNN has been widely used in power system topology-related analysis, such as stability assessment, fault identification, etc., and due to its proven outstanding performance, it has also been gradually applied to optimize OPF. Specifically, SL / IL is deployed in the literature, which is simply trained by imitating the OPF response under given operating conditions, and therefore may perform poorly in terms of robustness and scalability. Purely GNN-based SL / IL is still not enough to fully understand the real operating characteristics of the power network. The literature proposes a GNN-based power flow analysis method, in which GNN directly uses the power imbalance on Kirchhoff's law as the learning loss. However, this method lacks optimized OPF modeling and does not discuss topological adaptability, especially for the out-of-distribution (OOD) topology. Summary of the invention
[0006] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a KKT conditional learning graph neural network construction method for real-time optimal flow.
[0007] The purpose of the present invention is achieved through the following technical solution: A method for constructing a KKT conditional learning graph neural network for real-time optimal power flow, comprising the following steps:
[0008] Step S1, establishing an ACOPF model and its constraints;
[0009] Step S2, solving the ACOPF model by a nonlinear programming method, which first converts the inequality constraints of the ACOPF model into equality constraints, and then solves the dual problem by applying the KKT condition on the Lagrangian function;
[0010] Step S3, PG-GNN learning based on duality, first establish a PG-GNN model, in the PG-GNN model, the physical model of ACOPF is used as important prior information, physical constraints are established, the KKT condition is used as the target, and the gradient descent algorithm is introduced to train a GNN. The PG-GNN model learns to approximate the solution of ACOPF and simultaneously satisfies the physical constraints represented by the KKT condition. By using the KKT condition as the loss function, the PG-GNN model learns to follow the pattern of physical laws of the power system; from the physics-based loss function to the parameterized variables, and finally to the gradient flow of the GNN parameters, and then a large number of historical topological examples and N-1 accident situations are used to establish a training data set; the PG-GNN model is trained through the training data set.
[0011] Specifically, the objective function of the ACOPF model is:
[0012]
[0013] Where i represents the generator, f represents the total cost, and f i C represents the cost of electricity generation, f i R represents the standby cost, a i 、b i 、c i represents the cost coefficient of generator i, P i g Represents active power generation, P i g,max is the forecast value of renewable energy generation, which represents the active power expected to be generated from renewable energy sources, and denote the set of synchronous generators and renewable generators respectively.
[0014] Specifically, the constraints of the ACOPF model are:
[0015] stg(v,x)=0
[0016] h min ≤h(v,x)≤h max
[0017]
[0018] Among them, g(v,x) and h(v,x) are equality constraints and inequality constraints respectively; is the vector of decision variables, δ represents the phase angle in the system, represents the busbar set; is the vector of given initial conditions; and denote the set of synchronous generators and renewable generators respectively, represents a collection of loads; and are the maximum active / reactive power generation and minimum active / reactive power generation of the ith generator, and are the active and reactive loads of the ith bus, respectively, where V i 、V i represents the voltage amplitude of the i-th and j-th buses, j∈i means that bus j is connected to bus i through branch ij; G ij and B ij Represent the conductance and susceptance of branch ij respectively; δ ijis the voltage phase difference of branch ij; V i min and V i max are the lower and upper limits of the voltage amplitude, respectively, representing the apparent power of the branch between buses i and j, |S ij | represents the apparent power of the branch between busbars i and j, Represents the maximum transmission capacity of branch ij.
[0019] Specifically, in step S2, the ACOPF model is solved by first converting the inequality constraints into equality constraints by relaxing the variables u and l, and then solving the dual problem by applying the KKT condition on the Lagrangian function;
[0020] KKT conditions and Lagrangian functions:
[0021]
[0022] Where λ, γ and τ are Lagrange multipliers, and the KKT condition is expressed as
[0023] Specifically, in step S3, the PG-GNN model parameterizes the dual variables and the original variables to obtain the following formula:
[0024]
[0025] in for The parameterized KKT condition is and φ θ (x) = [v θ ,λ θ ,γ θ ,τ θ ,u θ ,l θ ].
[0026] Specifically, the loss function of the PG-GNN model is designed so that its minimum value corresponds to the optimal solution of the KKT condition, as shown in the following formula:
[0027]
[0028] In order to simplify the calculation, let
[0029]
[0030]
[0031] Among them, η represents the learning rate.
[0032] The present invention has the following advantages:
[0033] This paper proposes a PG-GNN model (ChebNet) for real-time ACOPF for the first time. In this algorithm, the electrodynamics physics problem is modeled through the duality of the original problem and ACOPF, and then seamlessly combined with GNN as the training loss. This method integrates the physics problem with the training process of GNN. Their differentiable equations are passed to support the training gradient of backpropagation, so that GNN is mainly guided by the laws of physics. In this way, GNN can better follow the laws of physics during training, allowing GNN to meet multiple physical constraints at the same time. It is worth noting that since the learning process is unsupervised, this avoids time-consuming labeling of ACOPF data, allowing GNN to learn and apply to practical problems without labels, while reducing the workload of manually labeling data. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 It is a structural schematic diagram of the present invention. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention, that is, the embodiments described are only part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations.
[0036] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.
[0037] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including a..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0038] The present invention is further described below in conjunction with the accompanying drawings, but the protection scope of the present invention is not limited to the following description. Figure 1 As shown, a KKT conditional learning graph neural network construction method for real-time optimal power flow includes the following steps: Step S1, establishing an ACOPF model and its constraints; the goal of ACOPF is to achieve the most economical power generation dispatch and minimize renewable energy curtailment while considering transmission constraints;
[0039]
[0040] st g(v,x)=0 (2)
[0041] h min ≤h(v,x)≤h max (3)
[0042] The constraints g and h reflect various aspects of power system operation and grid limitations, including Kirchhoff's laws, operating limitations of generators, and grid limitations:
[0043]
[0044] Among them, g(v,x) and h(v,x) are equality constraints and inequality constraints respectively; is the vector of decision variables, δ represents the phase angle in the system, represents the busbar set; is the vector of given initial conditions; and denote the set of synchronous generators and renewable generators respectively, represents a collection of loads; and are the maximum active / reactive power generation and minimum active / reactive power generation of the ith generator, and are the active and reactive loads of the ith bus, respectively, where V i 、V j represents the voltage amplitude of the i-th and j-th buses, j∈i means that bus j is connected to bus i through branch ij; G ij and B ij Represent the conductance and susceptance of branch ij respectively; δ ij is the voltage phase difference of branch ij; V i min and V i max are the lower and upper limits of the voltage amplitude, respectively, representing the apparent power of the branch between buses i and j, |S ij | represents the apparent power of the branch between busbars i and j, represents the maximum transmission capacity of branch ij;
[0045] f is the objective function, which includes the cost of electricity generation and the cost of renewable energy reduction:
[0046]
[0047] Where i represents the generator, f represents the total cost, and f i C represents the cost of electricity generation, f i R represents the standby cost, a i 、b i 、c i represents the cost coefficient of generator i, P i g Represents active power generation, P i g,max is the forecast value of renewable energy generation, which represents the active power expected to be generated from renewable energy sources, and denote the set of synchronous generators and renewable generators respectively;
[0048] Step S2, solving the ACOPF model by a nonlinear programming method, which first converts the inequality constraints of the ACOPF model into equality constraints, and then solves the dual problem by applying the KKT condition on the Lagrangian function;
[0049] A common method to solve the ACOPF model is nonlinear programming, which first converts the inequality constraints into equality constraints by relaxing the variables u and l, and then solves the dual problem by applying the KKT condition on the Lagrangian function. The KKT condition and Lagrangian function are given below:
[0050]
[0051]
[0052]
[0053] The KKT conditions result in a set of algebraic equations that can be solved using Newton's method or other similar methods. However, due to the increasing size of the power system and the multiple uncertainties caused by renewable energy, model-based methods may have problems with unsatisfactory convergence and low efficiency. The non-real-time solver requires random programming or robust programming of the ACOPF to further reduce the solution speed.
[0054] Step S3, PG-GNN learning based on duality, first establish a PG-GNN model, in the PG-GNN model, the physical model of ACOPF is used as important prior information, physical constraints are established, the KKT condition is used as the target, and the gradient descent algorithm is introduced to train a GNN. The PG-GNN model learns to approximate the solution of ACOPF and simultaneously satisfies the physical constraints represented by the KKT condition. By using the KKT condition as the loss function, the PG-GNN model learns to follow the pattern of physical laws of the power system; from the physics-based loss function to the parameterized variables, and finally to the gradient flow of the GNN parameters, and then a large number of historical topological examples and N-1 accident situations are used to establish a training data set; the PG-GNN model is trained through the training data set. The traditional way to train GNNs is to minimize the empirical risk between the GNN estimate and the true value of the ACOPF solution, the so-called SL / IL. However, since SL / IL only try to match patterns in experience without being constrained by any strict operating laws of the power system, they may have poor robustness and generalization, and therefore may perform poorly in the face of diversity and uncertainty. To solve this problem, we require the ACOPF-guided graph neural network to follow the important physical laws of the power system and propose a PG-GNN model. The PG-GNN model aims to approximate the optimal solution of ACOPF in an unsupervised manner. To achieve this goal, in PG-GNN, the physical model of ACOPF should be taken into account as important prior information. This idea faces two problems. The first is how to design the loss function of the PG-GNN model to enforce the conformity of the model, and the second is how to deal with constraints. In dealing with physical constraints, we draw on the duality of ACOPF and parameterize the PG-GNN dual variables and the original variables to obtain the following formula:
[0055]
[0056] in for The parameterized KKT condition is and φ θ (χ)=[v θ ,λ θ ,γ θ ,τ θ ,u θ ,l θ ]; It is worth noting that for the parameterized KKT condition and the traditional mean square error target (SL / IL), their optimal solutions are both zero vectors. In this case, we can use the KKT condition as the target and introduce the mainstream gradient descent algorithm to train a GNN model. In this way, the PG-GNN model will learn the solution of the approximate ACOPF and satisfy the physical constraints represented by the KKT condition at the same time. Therefore, the loss function of the PG-GNN model is designed so that its minimum value corresponds to the optimal solution of the KKT condition, as shown in the following formula:
[0057]
[0058] Formula (15) forces the GNN model to learn patterns that strictly conform to the laws of physics, unlike the traditional SL which only fits local experience from the data. By using the KKT condition as the loss function, PG-GNN is able to learn patterns that follow the physical laws of the power system, rather than just fitting based on local data experience.
[0059] In order to simplify the calculation, let Learning such a PG-GNN requires the gradient flow from the physics-based loss function to the parameterized variables and finally to the GNN parameters, which can be achieved by analyzing (14) and (15). The process is shown as follows
[0060]
[0061]
[0062] Among them, η represents the learning rate.
[0063] In order to train a topology-adaptive PG-GNN, a large number of historical topology instances and N-1 accident situations are used to establish a training dataset. The PG-GNN trained on this dataset can be generalized to most topology scenarios.
[0064] The present invention proposes a PG-GNN model (ChebNet) for real-time ACOPF for the first time. In this algorithm, the electrodynamics physics problem is modeled through the duality of the original problem and ACOPF, and then seamlessly combined with GNN as the training loss. This method integrates the physics problem with the training process of GNN, and their differentiable equations are passed to support the training gradient of backpropagation, so that GNN is mainly guided by the laws of physics. In this way, GNN can better follow the laws of physics during the training process, allowing GNN to meet multiple physical constraints at the same time. It is worth noting that since the learning process is unsupervised, this avoids time-consuming labeling of ACOPF data, allowing GNN to learn and apply to practical problems without labels, while reducing the workload of manually labeling data.
[0065] The topological characteristics of the power system are fully utilized in the physics-guided learning task. The characteristics of GNN allow us to represent the power system topology graphically. In accordance with the laws of physics, GNN usually simulates Kirchhoff's laws by agglomerating information aggregation and learns the operation mode through message passing. The GNN proposed in this paper provides a simulation method for the energy flow of the power system and has good generalization performance under different topological structures.
[0066] This invention proposes for the first time Online Transfer Learning (OTL) based on PG-GNN to handle OOD topological situations. According to the stability characteristics of GNN, limited topological switching will only cause limited decrease in the duality-based loss of PG-GNN. Based on this fact, we only need to fine-tune PG-GNN by inputting some representative OOD topological scenarios to achieve topological mobility. At the same time, since there is no need to spend time preparing ACOPF solution data, this OTL process only requires a small amount of knowledge transfer and can be completed very quickly. This can save a lot of time and resources and can quickly adapt to different topological situations.
[0067] The test results show that our proposed method has significant generalization ability and excellent decision-making efficiency. In unknown operations, our decision error is significantly better than the traditional SL / IL method, which means that our method performs better in dealing with unknown situations. Compared with the mature MATPOWER toolbox, our method is more than 200 times faster in decision-making speed, and the running cost is almost the same. Therefore, among the existing physical and data-driven methods, our method is the best choice to make a trade-off between efficiency and economy. It performs well in terms of both speed and cost.
[0068] The above is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any technician familiar with the art can make many possible changes and modifications to the technical solution of the present invention by using the above-mentioned technical content without departing from the scope of the technical solution of the present invention, or modify it into an equivalent embodiment of equivalent changes. Therefore, any changes, modifications, equivalent changes and modifications made to the above embodiments based on the technology of the present invention without departing from the content of the technical solution of the present invention belong to the protection scope of the present technical solution.
Claims
1. A KKT conditional learning graph neural network construction method for real-time optimal power flow, characterized by: The following steps are involved: Step S1, establishing an ACOPF model and its constraints; Step S2, solving the ACOPF model by a nonlinear programming method, which first converts the inequality constraints of the ACOPF model into equality constraints, and then solves the dual problem by applying the KKT condition on the Lagrangian function; Step S3, PG-GNN learning based on duality, first establish a PG-GNN model, in which the physical model of ACOPF is used as important prior information, physical constraints are established, KKT conditions are used as targets, and a gradient descent algorithm is introduced to train a GNN. The PG-GNN model learns to approximate the solution of ACOPF and simultaneously satisfies the physical constraints represented by the KKT conditions. By using the KKT conditions as the loss function, the PG-GNN model learns to follow the pattern of the physical laws of the power system; from the physics-based loss function to the parameterized variables, and finally to the gradient flow of the GNN parameters, a large number of historical topology instances and N-1 accident situations are then used to establish a training data set; The PG-GNN model is trained using the training data set.
2. According to claim 1, a KKT conditional learning graph neural network construction method for real-time optimal power flow is characterized by: The objective function of the ACOPF model is: Where i represents the generator, f represents the total cost, and f i C represents the cost of electricity generation, f i R represents the standby cost, a i , b i 、c i represents the cost coefficient of generator i, P i g Represents active power generation, P i g,max is the forecast value of renewable energy generation, which represents the active power expected to be generated from renewable energy sources, and denote the set of synchronous generators and renewable generators respectively.
3. According to claim 2, a KKT conditional learning graph neural network construction method for real-time optimal power flow is characterized in that: The constraint condition of the ACOPF model is stg(v,x)=0 h min ≤h(v,x)≤h max Among them, g(v,x) and h(v,x) are equality constraints and inequality constraints respectively; is the vector of decision variables, δ represents the phase angle in the system, represents the busbar set; is the vector of given initial conditions; and denote the set of synchronous generators and renewable generators respectively, represents a collection of loads; and are the maximum active / reactive power generation and minimum active / reactive power generation of the ith generator, and are the active and reactive loads of the ith bus, respectively, where V i 、V j represents the voltage amplitude of the i-th and j-th buses, j∈i means that bus j is connected to bus i through branch ij; G ij and B ij Represent the conductance and susceptance of branch ij respectively; δ ij is the voltage phase difference of branch ij; V i min and V i max are the lower and upper limits of the voltage amplitude, respectively, |s ij | represents the apparent power of the branch between busbars i and j, Represents the maximum transmission capacity of branch ij.
4. According to claim 3, a KKT conditional learning graph neural network construction method for real-time optimal power flow is characterized in that: In step S2, the ACOPF model is solved by first converting the inequality constraints into equality constraints by relaxing the variables u and l, and then solving the dual problem by applying the KKT condition on the Lagrangian function; KKT conditions and Lagrangian functions: Where λ, γ and τ are Lagrange multipliers, and the KKT condition is expressed as 5. According to claim 4, a KKT conditional learning graph neural network construction method for real-time optimal power flow is characterized in that: In step S3, the PG-GNN model parameterizes the dual variables and the original variables to obtain the following formula: in for The parameterized KKT condition is and φ θ (χ)=[v θ ,λ θ ,γ θ ,τ θ ,u θ ,l θ ].
6. The method for constructing a KKT conditional learning graph neural network for real-time optimal power flow according to claim 5, characterized in that: The loss function of the PG-GNN model is designed so that its minimum value corresponds to the optimal solution of the KKT condition, as shown below: In order to simplify the calculation, let Among them, η represents the learning rate.
Citation Information
Patent Citations
Optimal power flow rapid solving method combining neural network and physical model
CN116720436A
Cited By
Optimal power flow solving method and device assisted by global attention graph neural network
CN119740488A
A global attention map neural network assisted optimal power flow solving method and device
CN119740488B
