A global attention map neural network assisted optimal power flow solving method and device

By constructing a generator setpoint and redundancy constraint identification model using a global attention graph neural network, the computational efficiency and accuracy issues of the OPF problem under power grid topology changes are solved, and a fast and accurate optimal power flow solution is achieved.

CN119740488BActive Publication Date: 2026-01-13TSINGHUA UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411937196.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2026-01-13
Estimated Expiration
2044-12-26

AI Technical Summary

Technical Problem

Existing deep neural networks and graph neural networks struggle to adapt to changes in grid topology in optimal power flow problems, resulting in long computation times and high costs. Furthermore, they cannot effectively fit the highly global OPF problem, leading to poor prediction accuracy.

Method used

A global attention graph neural network is constructed. By building a generator setpoint prediction model and a redundancy constraint identification model, and combining the power system topology and node load, the constraints are initialized and simplified using a mathematical solver to achieve a fast solution to the OPF problem.

Benefits of technology

When the power grid topology changes, it can quickly adapt through training with a small number of parameters, which improves computational adaptability and prediction accuracy, reduces computational cost and time, and meets the needs of online applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119740488B_ABST
    Figure CN119740488B_ABST
Patent Text Reader

Abstract

The application provides a global attention graph neural network assisted optimal power flow solving method and device, wherein the method comprises the following steps: constructing an optimal power flow mathematical model, and respectively constructing original variable prediction training data set D1 and redundant constraint identification training data set D2; based on the data sets D1 and D2 and a graph neural network, a generator set point prediction model M1 and a redundant constraint identification model M2 with global attention are respectively constructed; based on the load data of an actual power system, the model M1 and the model M2 are used to respectively predict the generator set point and the constraint dual variable, and the redundant constraint is identified based on the dual variable; after the optimal power flow problem is initialized and the constraint is simplified, the optimal power flow calculation is completed. The application can realize the fast solving of the optimal power flow problem, and when the power grid topology changes, only small-scale training or no training is needed, thereby effectively reducing the calculation cost and improving the safety and economy of the power system operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of power system optimization and scheduling technology, and in particular to a method and apparatus for solving optimal power flow problems assisted by a global attention graph neural network. Background Technology

[0002] Optimal power flow (OPF) is a typical problem in power system optimization and scheduling, and a key aspect of ensuring the efficient operation of power systems. With the continuous advancement of new power system construction and the increasing penetration of renewable energy, significant changes have occurred in system structure and characteristics, making model-driven methods based on expert experience unsustainable. In recent years, with the rapid development of artificial intelligence technology, data- and model-driven optimization solutions have attracted increasing attention from scholars both domestically and internationally.

[0003] The Optical Power Optimization (OPF) problem is essentially a non-convex optimization problem. As power systems expand and flexibility resources increase, OPF problems often exhibit characteristics such as massive scale, high-dimensional decision variables, and complex security mechanisms. Traditional numerical solutions are computationally expensive and cannot meet the requirements of online applications; therefore, artificial intelligence technologies are needed to accelerate algorithmic solutions.

[0004] Currently, deep neural networks (DNNs) and convolutional neural networks (CNNs) are widely used for OPF calculations. However, these methods often directly fit the input and output of the OPF problem, failing to consider the power grid topology. When the power grid's operating conditions change, the neural network needs to undergo large-scale offline retraining, significantly increasing time and computational costs. For data-driven methods that directly use graph neural networks (GNNs), since each node can only aggregate features from its neighbors, it is difficult to fit the highly global OPF problem, resulting in poor prediction accuracy for the optimal solution. Summary of the Invention

[0005] This application aims to at least partially address one of the technical problems in the related art.

[0006] Therefore, the purpose of this application is to propose an optimal power flow solution method and device assisted by a global attention graph neural network. It constructs a generator setpoint prediction model and a redundancy constraint identification model with global attention. After inputting the power system topology and node loads into the model, the predicted solution of the OPF problem and the predicted values ​​of the dual variables are obtained. Then, a mathematical solver is used to solve the OPF problem and the predicted solutions of the primal and dual problems are used to initialize the primal and dual variables. Furthermore, redundant constraints are removed based on the dual variables, thereby accelerating the solution of the OPF problem.

[0007] To achieve the above objectives, the first aspect of this application proposes a method for solving optimal power flow assisted by a global attention graph neural network, comprising:

[0008] Construct an optimal power flow mathematical model;

[0009] Based on the optimal power flow model, construct the original variable prediction training dataset D1;

[0010] Based on the optimal power flow model, a redundancy constraint identification training dataset D2 is constructed.

[0011] Based on the original variable prediction training dataset D1 and the graph neural network, a generator setpoint prediction model M1 with global attention is constructed.

[0012] Based on the redundant constraint recognition training dataset D2 and the graph neural network, a redundant constraint recognition model M2 with global attention is constructed.

[0013] Based on the load data of the actual power system, the generator setpoint prediction model M1 and the redundancy constraint identification model M2 are used to predict the generator setpoint and constraint dual variables, respectively. Based on the constraint dual variables, redundant constraints are identified. After initializing and simplifying the constraints of the optimal power flow problem, the optimal power flow calculation is completed.

[0014] Optionally, the optimal power flow mathematical model includes:

[0015] Objective function:

[0016]

[0017] Constraints:

[0018]

[0019] In the formula, N is the set of all nodes; G is the set of generator nodes; E is the set of transmission lines; and cost is the generator power generation cost. The active power from node i to node j; The reactive power from node i to node j; v i Let be the voltage magnitude at node i. v i These represent its maximum and minimum values, respectively; θ i The voltages at node i intersect; For the active power output of the generator at node i, p i g These represent its maximum and minimum values, respectively. For the reactive power output of the generator at node i, q i g These represent its maximum and minimum values, respectively. The active load of node i; For node i, the reactive load; This represents the maximum phase angle difference between node i and node j. Let be the active power flowing from node i to node j; Let be the reactive power flowing from node i to node j; This represents the maximum apparent power of the transmission line between nodes i and j.

[0020] Optionally, based on the optimal power flow model, a training dataset D1 for predicting the original variables is constructed, including:

[0021] During the initial training, based on historical power grid operation data or public datasets, m different power grid topologies are extracted. Load information under each topology is sampled, and k load samples are generated according to a probability distribution, serving as the input to the training set, resulting in a total of m×k samples. The optimal power flow mathematical model is solved using the interior-point method, and generator setpoints are obtained as labels. The training set generated under the i-th topology in the generator setpoint prediction training set is denoted as...

[0022] If a trained generator setpoint prediction model M1 already exists, sample the power grid load information under a given topology and generate k samples according to the probability distribution; solve the optimal power flow mathematical model for all samples based on the interior point method, and obtain the generator setpoint as a label.

[0023] Optionally, based on the optimal power flow model, the redundancy constraint identification training dataset D2 includes:

[0024] During the initial training, based on historical power grid operation data or public datasets, m different power grid topologies are extracted. Load information under each topology is sampled, and k load samples are generated according to the probability distribution as input to the training set, resulting in a total of m×k samples. The optimal power flow mathematical model is solved based on the interior point method, and the dual variables of each constraint are obtained as labels. Let the training set generated under the i-th topology in the redundancy constraint identification training set be denoted as...

[0025] If a trained redundancy constraint identification model M2 already exists, sample the power grid load information under a given topology and generate k samples according to the probability distribution; solve the optimal power flow mathematical model for all samples based on the interior point method, and obtain the dual variables of each constraint as labels.

[0026] Optionally, based on the original variable prediction training dataset D1 and the graph neural network, a generator setpoint prediction model M1 with global attention is constructed, including:

[0027] Determine whether a generator setpoint prediction model M1 trained with parameters exists;

[0028] If not, construct a graph structure using the nodes and lines in the power system as nodes and edges, respectively. in, Representation diagram, Let them represent the node set and edge set, respectively, and the node features be... The edge feature is e ij =exp(-k log|z ij |), where k is a hyperparameter, z ij Let be the impedance of the line between nodes i and j;

[0029] A linear layer is used as the embedding layer of the generator setpoint prediction model M1 to map the input node features and edge features to a high-dimensional vector space. The output dimension of the embedding layer is an adjustable hyperparameter.

[0030] The embedding layer is connected to multiple graph attention layers or graph convolutional layers, wherein the input dimension of the graph attention layer or graph convolutional layer is the same as that of the linear layer, and the output dimension is a specifyable hyperparameter.

[0031] An attention layer is connected after the graph attention layer or graph convolutional layer. The input dimension of the attention layer is consistent with the output dimension of the previous layer, and the number of attention heads is a specifyable hyperparameter when multi-head attention is used.

[0032] Following the attention layer, a fully connected network is constructed for each generator node based on the number of nodes in the power system. The output of each fully connected network corresponds to the setpoint prediction value for each generator node. Each fully connected network consists of a linear layer and a ReLU layer, and an activation function ReLU is constructed. bounded As the output layer of the fully connected network, the formula is:

[0033]

[0034] in, x These are the maximum and minimum values ​​of x, respectively.

[0035] Based on the original variable prediction training dataset D1, m corresponding network layers are constructed for m power system topologies in the dataset, and training is performed sequentially on m training sets; in the training set After training, in the training set The parameters of the embedding layer, graph neural network layer and attention layer of the generator setpoint prediction model M1 are further trained, and the fully connected network layer corresponding to the current topology is retrained.

[0036] The loss function of the generator setpoint prediction model M1 is set as follows:

[0037]

[0038] Among them, Loss mseLet be the mean squared error loss function, for the predicted value And label y, Loss Pbalance This is a power balance penalty term. in PD is the sum of the predicted active power values ​​of the i-th sample generator. i It is the sum of the load power of the i-th sample.

[0039] Optional, also includes:

[0040] If a generator setpoint prediction model M1 with parameters trained exists, determine whether the power grid topology in the optimal power flow problem to be solved exists in the training set D1.

[0041] If it exists, the generator setpoint prediction model M1 will not be retrained; if it does not exist, the parameters of the embedding layer, graph neural network layer and attention layer will be frozen, and only the parameters of the fully connected network layer will be trained.

[0042] Optionally, based on the redundant constraint recognition training dataset D2 and the graph neural network, a redundant constraint recognition model M2 with global attention is constructed, including:

[0043] Determine whether a redundant constraint identification model M2, trained with parameters, exists;

[0044] If not, construct a graph structure using the nodes and lines in the power system as nodes and edges, respectively. in, Representation diagram, Let them represent the node set and edge set, respectively, and the node features be... The edge feature is e ij =exp(-klog|z ij |), where k is a hyperparameter, z ij Let be the impedance of the line between nodes i and j;

[0045] A linear layer is used as the embedding layer of the redundancy constraint identification model M2 to map the input node features and edge features to a high-dimensional vector space. The output dimension of the embedding layer is an adjustable hyperparameter.

[0046] The embedding layer is connected to multiple graph attention layers or graph convolutional layers, wherein the input dimension of the graph attention layer or graph convolutional layer is the same as that of the linear layer, and the output dimension is a specifyable hyperparameter.

[0047] An attention layer is connected after the graph attention layer or graph convolutional layer. The input dimension of the attention layer is consistent with the output dimension of the previous layer, and the number of attention heads is a specifyable hyperparameter when multi-head attention is used.

[0048] The high-dimensional features processed by the attention layer are input into the fully connected network. The output of the fully connected network is the dual variable of each constraint. The fully connected network consists of linear layers and ReLU layers. The predicted value of each dual variable is used to determine whether the corresponding constraint is redundant.

[0049] Based on the redundancy constraint identification training dataset D2, m corresponding network layers are constructed for m types of power system topologies in the dataset, and training is performed sequentially on m sets of training data; in the training set After training, in the training set The parameters of the embedding layer, graph neural network layer and attention layer of the redundancy constraint identification model M2 are further trained, and the fully connected network layer corresponding to the current topology is retrained.

[0050] Optional, also includes:

[0051] If a redundant constraint identification model M2 trained with parameters exists, determine whether the power grid topology in the optimal power flow problem to be solved exists in the training set D2.

[0052] If the redundant constraint recognition model M2 exists, it will not be retrained; if it does not exist, the parameters of the embedding layer, graph neural network layer and attention layer will be frozen, and only the parameters of the fully connected network layer will be trained.

[0053] Optionally, the step of using the generator setpoint prediction model M1 and the redundancy constraint identification model M2 to predict the generator setpoint and constraint dual variables based on the load data of the actual power system, and identifying redundant constraints based on the constraint dual variables, and then performing initialization and constraint simplification on the optimal power flow problem to complete the optimal power flow calculation, includes:

[0054] The actual power system load data is sampled, and the sampled data is input into the generator setpoint prediction model M1 and the redundancy constraint identification model M2 to obtain the generator setpoint prediction value and the prediction value of each constraint dual variable of the optimal power flow problem.

[0055] Input the constructed optimal power flow mathematical model into the mathematical solver;

[0056] The solution to the optimal power flow problem is initialized using the generator setpoint prediction; the dual variable prediction for the i-th constraint... Initialize the corresponding dual variable λ in the optimal power flow problem. i And specify the critical value ∈, to determine if there is If so, the i-th constraint is considered redundant and removed from the optimal power flow problem;

[0057] The optimal power flow problem is solved using a mathematical solver after initialization and simplification, thus completing the optimal power flow calculation.

[0058] To achieve the above objectives, a second aspect of this application proposes a global attention graph neural network-assisted optimal power flow solution device, comprising:

[0059] The optimal power flow mathematical model construction module is used to construct the optimal power flow mathematical model;

[0060] The dataset construction module is used to construct the original variable prediction training dataset D1 and the redundancy constraint identification training dataset D2 based on the optimal power flow model.

[0061] The generator setpoint prediction model construction module is used to construct a generator setpoint prediction model M1 with global attention based on the original variable prediction training dataset D1 and the graph neural network.

[0062] A redundancy constraint identification model construction module is used to construct a redundancy constraint identification model M2 with global attention based on the redundancy constraint identification training dataset D2 and the graph neural network.

[0063] The solution module is used to predict the generator setpoint and constraint dual variables based on the load data of the actual power system using the generator setpoint prediction model M1 and the redundancy constraint identification model M2, respectively, and to identify redundant constraints based on the constraint dual variables. After initializing and simplifying the constraints of the optimal power flow problem, the module completes the optimal power flow calculation.

[0064] To achieve the above objectives, a third aspect of this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;

[0065] The memory stores computer-executed instructions;

[0066] The processor executes computer execution instructions stored in the memory to implement the method as described in any one of the first aspects.

[0067] To achieve the above objectives, a fourth aspect of this application provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, are used to implement the method as described in any one of the first aspects.

[0068] To achieve the above objectives, a fifth aspect of this application provides a computer program product that, when executed by a processor, implements the method described in any one of the first aspects.

[0069] The technical solutions provided by the embodiments of this application bring at least the following beneficial effects:

[0070] This application's method collects power system load information as input to a deep neural network. Combining graph convolutional layers or graph attention layers with a self-attention mechanism, it incorporates the power system topology into the forward propagation process, enabling each node to aggregate global information with weights. The mapping results are then passed through a fully connected layer to construct a generator setpoint prediction model and a redundancy constraint identification model. Finally, in a real power system, by collecting load information and inputting it into the deep neural network, the method obtains generator setpoint predictions and optimal power flow (OPF) constraint dual variable predictions. On one hand, this method simultaneously initializes the primal and dual variables of the OPF problem; on the other hand, it identifies redundant constraints through the dual variable predictions and accelerates the solution of the OPF problem by combining a hot-start mathematical solver. By introducing an attention mechanism into the graph neural network, this application's method allows for rapid application in new topology scenarios with only a small number of parameters trained, improving the computational adaptability of the method while maintaining solution speed.

[0071] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0072] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:

[0073] Figure 1 A flowchart illustrating a global attention graph neural network-assisted optimal power flow solution method provided in this application embodiment;

[0074] Figure 2 A flowchart illustrating a global attention graph neural network-assisted optimal power flow solution method provided in this application embodiment;

[0075] Figure 3 This is a schematic diagram of a global attention graph neural network-assisted optimal power flow solution device provided in an embodiment of this application. Detailed Implementation

[0076] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0077] To address the problems existing in the prior art, this application provides a method for solving optimal power flow problems assisted by a global attention graph neural network. Figure 1 and Figure 2These are all flowchart illustrations of a global attention graph neural network-assisted optimal power flow solution method provided in the embodiments of this application, but their forms of representation differ. For example... Figure 1 As shown, the method includes the following steps:

[0078] Step (1): Construct the optimal power flow mathematical model.

[0079] In this embodiment, an optimal power flow mathematical model is first constructed. The goal of this model is to optimize the operating cost of the power system while satisfying the physical constraints of power system operation. The optimal power flow mathematical model includes the following:

[0080] Objective function:

[0081]

[0082] Constraints:

[0083]

[0084]

[0085] In the formula, N is the set of all nodes; G is the set of generator nodes; E is the set of transmission lines; and cost is the generator power generation cost. The active power from node i to node j; The reactive power from node i to node j; v i Let be the voltage magnitude at node i. v i These represent its maximum and minimum values, respectively; θ i The voltages at node i intersect; For the active power output of the generator at node i, p i g These represent its maximum and minimum values, respectively. For the reactive power output of the generator at node i, These represent its maximum and minimum values, respectively. The active load of node i; For node i, the reactive load; This represents the maximum phase angle difference between node i and node j. Let be the active power flowing from node i to node j; Let be the reactive power flowing from node i to node j; This represents the maximum apparent power of the transmission line between nodes i and j.

[0086] The mathematical model described above comprehensively considers the costs and constraints of power system operation, providing a basis for optimization calculations in subsequent steps.

[0087] Step (2): Based on the optimal power flow model, construct the original variable prediction training dataset D1.

[0088] In this embodiment of the application, in order to achieve efficient prediction of generator setpoint, an original variable prediction training dataset D1 is constructed based on the optimal power flow mathematical model built in step (1). The construction of this dataset includes the following two cases:

[0089] (2.1) Construct a full-parameter training dataset.

[0090] During the initial training, all network layer parameters need to be fully trained. The steps are as follows:

[0091] Based on historical power grid operation data or public datasets, m different power grid topologies are extracted. Load information under each topology is sampled, and k load samples are generated according to probability distribution as input to the training set, resulting in a total of m×k samples covering variations in different topologies and load scenarios. Then, the optimal power flow mathematical model in step (1) is solved using the interior point method to obtain the optimized solution of the generator setpoint, which is used as the label of the training set. Let the training set generated under the i-th topology in the generator setpoint prediction training set be denoted as .

[0092] By following the steps above, a full-parameter training dataset is constructed to ensure that the model can adapt to different power grid topologies and load changes.

[0093] (2.2) Construct a training dataset for partial parameters.

[0094] When solving the optimal power flow (OPF) problem with a topology different from that of the fully parameterized training set grid, some parameters of the existing generator setpoint prediction model M1 can be retrained. The steps are as follows:

[0095] Load information of the power grid under a given topology is sampled, and k samples are generated according to a probability distribution. Then, the optimal power flow mathematical model is solved for all samples based on the interior-point method to obtain the optimized solution of the generator setpoint, which serves as the label for the new samples. Finally, the generated new samples are input into the existing generator setpoint prediction model M1, and only the parameters of a specific network layer are trained to adapt to the new power grid topology.

[0096] By following the steps above, we can meet the full coverage requirement during the initial training and achieve rapid adaptation in new topology scenarios by adjusting some parameters.

[0097] By constructing the original variable prediction training dataset D1, a comprehensive and flexible training foundation is provided for the generator setpoint prediction model M1. The full-parameter training dataset is used to cover various power grid topologies and load scenarios, while the partial-parameter training dataset supports rapid adaptation after topology changes, greatly improving the model's generalization ability and adaptability.

[0098] Step (3): Based on the optimal power flow model, construct the redundancy constraint identification training dataset D2.

[0099] In this embodiment of the application, in order to achieve redundancy identification of power system constraints, a redundancy constraint identification training dataset D2 is constructed based on the optimal power flow mathematical model built in step (1). The construction of this dataset includes the following two cases:

[0100] (3.1) Construct a full-parameter training dataset.

[0101] During the initial training, it is necessary to fully train all network layer parameters of the redundancy constraint recognition model M2. The steps are as follows:

[0102] First, based on historical power grid operation data or public datasets, m different power grid topologies are extracted. Load information under each topology is sampled, and k load samples are generated according to probability distribution as input to the training set. Finally, a total of m×k samples are generated, covering variations in different topologies and load scenarios. Then, based on the interior-point method, the optimal power flow mathematical model in step (1) is solved, and the dual variables of each constraint are extracted and used as labels for the training set. The value of the dual variable determines whether a constraint is redundant; the dual variable value of a redundant constraint is 0, while the dual variable value of a non-redundant constraint is not 0. Let the training set generated under the i-th topology in the redundant constraint identification training set be denoted as .

[0103] Through the above steps, a full-parameter training dataset is constructed, providing comprehensive support for the initial training of the redundancy constraint identification model M2.

[0104] (3.2) Construct a training dataset for partial parameters.

[0105] When solving the optimal power flow (OPF) problem with a topology different from that of the fully parameterized training set power grid, some parameters of the model can be retrained based on the existing redundancy constraint identification model M2. The steps are as follows:

[0106] First, load information of the power grid under a given topology is sampled, and k samples are generated according to a probability distribution. Then, the optimal power flow mathematical model is solved for all samples based on the interior-point method, and the dual variables of each constraint are extracted as labels for the new samples. Finally, the generated new samples are input into the existing redundancy constraint identification model M2, and only the parameters of specific network layers are trained to adapt to the new power grid topology.

[0107] By following the steps above, we can meet the full coverage requirement during the initial training and achieve rapid adaptation in new topology scenarios by adjusting some parameters.

[0108] By constructing a redundancy constraint identification training dataset D2, accurate identification of redundancy constraints for different power grid topologies and load scenarios was achieved. The full-parameter training dataset was used for the initial comprehensive model training, ensuring coverage of multiple possible topology scenarios; while the partial-parameter training dataset was designed for specific topology scenarios, enabling rapid model adaptation through partial parameter updates. This method significantly improves the efficiency and flexibility of redundancy constraint identification.

[0109] Step (4): Based on the original variable prediction training dataset D1 and the graph neural network, construct the generator setpoint prediction model M1 with global attention.

[0110] In this embodiment of the invention, to achieve high-precision prediction of the generator setpoint, a generator setpoint prediction model M1 with global attention is constructed based on the original variable prediction training dataset D1 and a graph neural network. The specific steps are as follows:

[0111] Step (4.1) First, determine whether there is a generator setpoint prediction model M1 that has been trained with parameters.

[0112] If the model does not exist, perform full parameter training and proceed to step (4.2). If the model already exists, use the trained model directly and proceed to the next step (4.9).

[0113] Step (4.2): If it does not exist, construct the graph structure using the nodes and lines in the power system as the nodes and edges of the graph, respectively. in, Representation diagram, Let them represent the node set and edge set, respectively, and the node features be... The edge feature is e ij =exp(-k log|z ij |), where k is a hyperparameter, z ij Let be the impedance of the line between nodes i and j.

[0114] In step (4.3), a linear layer is used as the embedding layer of the generator setpoint prediction model M1. The input node features and edge features are mapped to a high-dimensional vector space. The output dimension of the embedding layer is an adjustable hyperparameter to adapt to different power grid topologies.

[0115] In one embodiment of this application, the embedding layer can be represented as Y1 = w1X + b1, where X and Y1 are the linear layer input and output, the dimension of Y1 is 4 in one example of this application, and w1 and b1 are trainable parameters.

[0116] In step (4.4), the embedding layer is connected to multiple graph attention layers or graph convolutional layers. The input dimension of the graph attention layer or graph convolutional layer is the same as that of the linear layer, and the output dimension is a specified hyperparameter.

[0117] Specifically, the embedding layer is connected to several graph attention layers or graph convolutional layers. The input feature dimension is the same as Y1, and the output dimension is a specifyable hyperparameter. In one example of this application, two graph attention layers (GAT) are used. The first GAT layer has an input feature dimension of 4 and an output feature dimension of 8; the second GAT layer has both an input feature dimension and an output feature dimension of 8. The number of attention heads in both GAT layers is set to 8, and the output features of multi-head attention are averaged. For node i, let its input feature be... Then output features Where N i Let α be the set of neighboring nodes of node i. ij Let be the attention coefficient of node i to node j, and W be the linear transformation matrix, which are trainable parameters.

[0118] Step (4.5) connects an attention layer after the graph attention layer or graph convolutional layer to extract global topological association information.

[0119] In this embodiment, the input dimension of the attention layer is consistent with the output dimension of the previous layer, and the number of attention heads is a specifyable hyperparameter when multi-head attention is used.

[0120] In one example of this application, the hidden layer dimension is set to 8, and the number of attention heads is set to 8.

[0121] In step (4.6), after the attention layer, a fully connected network is constructed for each generator node according to the number of power system nodes.

[0122] In this embodiment of the application, the ReLU function is constructed. bounded As the output layer of a fully connected network in xThese represent the maximum and minimum values ​​of x, ensuring that the neural network output satisfies the upper and lower bound constraints. If the power system has ng generator nodes, then ng fully connected networks can be constructed, each consisting of a linear layer and a ReLU layer. The attention layer passes the output to each fully connected network as input, and the output of each fully connected network corresponds to the setpoint prediction value of each generator node, which in the OPF problem is the generator's active and reactive power output, voltage amplitude, and phase angle.

[0123] Taking the New England 10-generator 39-node system as an example, 10 fully connected networks need to be constructed. The input of each network is the output feature of the attention layer. Each network has two hidden layers, both of which consist of a linear layer and a ReLU function. The first layer has an input feature dimension of 8 and an output feature dimension of 32. The second layer has both input and output feature dimensions of 32. Finally, the output layer consists of a linear layer and a ReLU function. bounded The structure consists of linear layers with an input feature dimension of 32 and an output feature dimension of 4.

[0124] Step (4.7) involves predicting the training dataset D1 based on the original variables, constructing m corresponding network layers for the m power system topologies in the dataset, and training the m training sets sequentially.

[0125] In the embodiments of this application, in the training set After training, in the training set The parameters of the embedding layer, graph neural network layer, and attention layer of the generator setpoint prediction model M1 are then trained. Furthermore, during each training iteration, the fully connected network layer corresponding to the current topology needs to be retrained to ensure topology adaptability of the output results.

[0126] Step (4.8), set the loss function of generator setpoint prediction model M1 as follows:

[0127]

[0128] Among them, Loss mse Let be the mean squared error loss function, for the predicted value And label y, Loss Pbalance This is a power balance penalty term. in PD is the sum of the predicted active power values ​​of the i-th sample generator. i It is the sum of the load power of the i-th sample.

[0129] It is understandable that adding a power balance penalty term will make the neural network output tend to conform to the power balance constraint. After training is complete, proceed to step (5).

[0130] Step (4.9): If there is a generator setpoint prediction model M1 that has been trained with parameters, then it is further determined whether the power grid topology in the optimal power flow problem to be solved exists in the training set D1.

[0131] If it exists, it means that the power grid topology is already included in the training set. The current parameters of the generator setpoint prediction model M1 can adapt to the topology, and there is no need to retrain. The trained model can be used directly for prediction. Proceed to step (5).

[0132] If the power grid topology is not in the training set, the training strategy of the generator setpoint prediction model M1 is adjusted: the parameters of the embedding layer, graph neural network layer and attention layer shown in steps (4.3)-(4-5) are frozen to keep their global feature extraction capabilities unchanged; only the parameters of the fully connected network layer shown in step (4-6) are retrained to adapt to the new power grid topology, and the loss function is set in the same way as in step (4.8).

[0133] Through the optimized training strategy described in steps (4.1) to (4.9) above, this application effectively constructs and applies the generator setpoint prediction model M1, achieving efficient optimal power flow calculation. During model construction, the characteristics of the power grid topology and load scenarios are fully considered. Global features are extracted using graph neural networks and attention mechanisms to ensure the model has strong feature representation capabilities and adaptability to complex topologies. For power grid topologies already present in the training set, the trained model is used directly, avoiding redundant training. For topologies not included, the parameters of the embedding layer, graph neural network layer, and attention layer are frozen, and only the parameters of the fully connected network layer are adjusted to quickly adapt to new scenarios. This strategy not only significantly reduces training complexity and computational cost but also significantly improves the model's applicability and computational efficiency in new topology scenarios, fully meeting the needs of actual power system optimization.

[0134] Step (5): Based on the redundant constraint recognition training dataset D2 and the graph neural network, construct the redundant constraint recognition model M2 with global attention.

[0135] In this embodiment of the application, in order to achieve efficient identification of redundant constraints in the optimal power flow problem, a redundant constraint identification model M2 with global attention is constructed based on the redundant constraint identification training dataset D2 and the graph neural network.

[0136] Step (5.1) determines whether there is a redundant constraint recognition model M2 that has been trained with parameters.

[0137] Similar to step (4), if the model does not exist, perform full parameter training and proceed to step (5.2). If the model already exists, use the trained model directly and proceed to the next step (5.8).

[0138] Step (5.2): If it does not exist, construct the graph structure using the nodes and lines in the power system as the nodes and edges of the graph, respectively. in, Representation diagram, Let them represent the node set and edge set, respectively, and the node features be... The edge feature is e ij =exp(-k log|z ij |), where k is a hyperparameter, z ij Let be the impedance of the line between nodes i and j.

[0139] In step (5.3), a linear layer is used as the embedding layer of the redundancy constraint identification model M2 to map the input node features and edge features to a high-dimensional vector space. The output dimension of the embedding layer is an adjustable hyperparameter to adapt to different power grid topology characteristics.

[0140] In one embodiment of this application, the embedding layer can be represented as Y2 = w2X + b2, where X and Y2 are the linear layer input and output, the dimension of Y2 is 4 in one example of this application, and w2 and b2 are trainable parameters.

[0141] In step (5.4), the embedding layer is connected to multiple graph attention layers or graph convolutional layers. The input dimension of the graph attention layer or graph convolutional layer is the same as that of the linear layer, and the output dimension is a specified hyperparameter.

[0142] Specifically, the embedding layer is connected to several graph attention layers or graph convolutional layers. The input feature dimension is the same as Y2, and the output dimension is a specifyable hyperparameter. In one example of this application, three graph attention layers (GAT) are used. The first GAT layer has an input feature dimension of 8 and an output feature dimension of 16; the second and third GAT layers both have an input feature dimension and an output feature dimension of 16. The number of attention heads in all three GAT layers is set to 8, and the output features of multi-head attention are averaged. For node i, let its input feature be... Then output features Where N i Let α be the set of neighboring nodes of node i. ij Let be the attention coefficient of node i to node j, and W be the linear transformation matrix, which are trainable parameters.

[0143] In step (5.5), an attention layer is connected after the graph attention layer or graph convolutional layer. The input dimension of the attention layer is consistent with the output dimension of the previous layer, and when multi-head attention is used, the number of attention heads is a specifyable hyperparameter.

[0144] In this embodiment, the input dimension of the attention layer is consistent with the output dimension of the previous layer, and the number of attention heads is a specifyable hyperparameter when multi-head attention is used.

[0145] In one example of this application, the hidden layer dimension is set to 16, and the number of attention heads is set to 8.

[0146] In step (5.6), the high-dimensional features processed by the attention layer are input into the fully connected network. The output of the fully connected network is the dual variable of each constraint. The fully connected network consists of linear layers and ReLU layers. The predicted value of each dual variable is used to determine whether the corresponding constraint is redundant.

[0147] In this embodiment, the high-dimensional features processed by the attention layer are input into a fully connected network, and the output of the fully connected network is the dual variable of each constraint. The output dimension of the fully connected network is the same as the number of constraints in the specific power system OPF problem, and the i-th term of the fully connected network output vector is the predicted value of the dual variable of the i-th constraint of the OPF problem.

[0148] According to the Caro-Kun-Tucker conditions (KKT conditions), let the optimal solution of OPF be x. * For the inequality constraint d of the OPF problem i (x)≤0, its dual variable is λ. i It satisfies the following relationship:

[0149] There is f i (x * )×λ i =0, therefore if λ i =0, then f i (x * If λ < 0, it indicates that the constraint is redundant; if λ < 0, it indicates that the constraint is redundant. i If f ≠ 0, then f i (x * If ) = 0, it means that the constraint is a non-redundant constraint.

[0150] In addition, in this embodiment, the fully connected network consists of linear layers and ReLU layers. Since its output dimension is related to the number of constraints in the OPF problem of a specific power system, different fully connected neural networks need to be constructed for power systems with different topologies.

[0151] Taking the New England 39-node system as an example, two hidden layers are set after the attention layer. Both hidden layers consist of linear layers and ReLU functions. The first layer has an input feature dimension of 16 and an output feature dimension of 32. The second layer has an input and output feature dimensions of 32. Finally, the output layer consists of a linear layer with an input feature dimension of 32 and an output feature dimension of 1.

[0152] By inputting the high-dimensional features processed by the attention layer into a fully connected network, this application achieves efficient identification of redundant constraints. The fully connected network combines KKT conditions to determine the redundancy of each constraint and flexibly adjusts the design of network layers according to different topologies, significantly improving model adaptability and computational efficiency while ensuring computational accuracy.

[0153] Step (5.7) involves identifying the training dataset D2 based on redundancy constraints, constructing m corresponding network layers for the m power system topologies in the dataset, and training the m training sets sequentially.

[0154] In the embodiments of this application, in the training set After training, in the training set The parameters of the embedding layer, graph neural network layer, and attention layer of the redundancy constraint identification model M2 are then trained. Furthermore, during each training iteration, the fully connected network layer corresponding to the current topology needs to be retrained to ensure topology adaptability of the output results.

[0155] After the training is completed, proceed to step (6).

[0156] In step (5.8), if there is a redundant constraint identification model M2 that has been trained with parameters, then it is further determined whether the power grid topology in the optimal power flow problem to be solved exists in the training set D2.

[0157] If it exists, it means that the power grid topology is already included in the training set. In this case, the current parameters of the redundancy constraint identification model M2 can adapt to the topology, and there is no need to retrain. The trained model can be used directly for prediction. Proceed to step (6).

[0158] If the power grid topology is not in the training set, the training strategy of the redundancy constraint identification model M2 is adjusted: the parameters of the embedding layer, graph neural network layer and attention layer shown in steps (5.3)-(5-5) are frozen to keep their global feature extraction capabilities unchanged; only the parameters of the fully connected network layer shown in step (5-6) are retrained to adapt to the new power grid topology.

[0159] Through the optimization strategies described in steps (5.1) to (5.8), this application achieves efficient construction and flexible application of the redundancy constraint identification model M2. This method combines graph neural networks and attention mechanisms to comprehensively extract global topological features of the power grid and efficiently predict the dual variables of each constraint. During training, for topologies already present in the training set, the trained model M2 is directly used, avoiding redundant training. For uncovered topologies, only the parameters of the embedding layer, graph neural network layer, and attention layer need to be frozen, and the parameters of the fully connected network layer are adjusted to quickly adapt to the new topology scenario. This strategy significantly reduces the complexity and computational cost of model retraining while maintaining the model's high adaptability to new topology scenarios, ensuring the accuracy and efficiency of redundancy constraint identification, and effectively supporting the rapid solution of optimal power flow problems.

[0160] Step (6): Based on the load data of the actual power system, the generator setpoint prediction model M1 and the redundancy constraint identification model M2 are used to predict the generator setpoint and constraint dual variables respectively. Based on the constraint dual variables, redundant constraints are identified. After initializing and simplifying the constraints of the optimal power flow problem, the optimal power flow calculation is completed.

[0161] In this embodiment, the actual power system load data is first sampled, and the sampled data is input into the generator setpoint prediction model M1 and the redundancy constraint identification model M2. The generator setpoint in the optimal power flow problem is predicted by model M1 to obtain the predicted value of the generator setpoint. The dual variables of the constraints in the optimal power flow problem are predicted by model M2 to obtain the predicted value of the dual variables of each constraint.

[0162] Then, the constructed optimal power flow mathematical model is input into the mathematical solver, and the solution to the optimal power flow problem is initialized using the generator setpoint predictions. For the dual variable predictions of the i-th constraint... On the one hand, initialize the corresponding dual variable λ in the optimal power flow problem. i On the other hand, specifying the critical value ∈ determines whether there is a threshold value. If the constraint exists, the i-th constraint is considered redundant and removed from the optimal power flow problem; otherwise, the constraint is retained in the optimal power flow problem.

[0163] Finally, a mathematical solver is used to solve the optimal power flow problem after initialization and constraint simplification, thus accelerating the solution process. Simplifying the constraints significantly reduces the computational complexity of the mathematical solver and speeds up the solution of the optimal power flow problem.

[0164] In one possible implementation, a mathematical solver is used to solve the initialized and simplified OPF problem, thereby accelerating the problem-solving process. In this example, first, graph data with 39 nodes and 46 edges is created. Then, load information from the 39 nodes is sampled and input into the generator setpoint prediction model and the redundancy constraint identification model to obtain the generator setpoint prediction value and the predicted values ​​of each constraint dual variable. After initializing the mathematical solver using both, a critical value ∈ = 10 is specified. -8 Predicted values ​​for any dual variable If there is If the corresponding constraint is considered redundant, it is removed from the OPF mathematical model, and then the solution can be obtained.

[0165] Through the above steps, this invention, based on load data from actual power systems, utilizes a generator setpoint prediction model and a redundancy constraint identification model to initialize and simplify constraints for the optimal power flow problem. The generator setpoint prediction model M1 provides an efficient initial solution, while the redundancy constraint identification model M2 accurately identifies and removes redundant constraints, thereby significantly reducing the computational burden on the mathematical solver. This method effectively improves the efficiency of optimal power flow calculation, ensures the solution speed and accuracy in complex power grid scenarios, and provides reliable technical support for the operation optimization of actual power systems.

[0166] To implement the above embodiments, this application also proposes a global attention graph neural network-assisted optimal power flow solution device. Figure 3 This is a schematic diagram of a global attention graph neural network-assisted optimal power flow solution device provided in an embodiment of this application. Figure 3 As shown, the device includes:

[0167] Optimal power flow mathematical model construction module 100 is used to construct the optimal power flow mathematical model;

[0168] The dataset construction module 200 is used to construct the original variable prediction training dataset D1 and the redundancy constraint identification training dataset D2 based on the optimal power flow model.

[0169] The generator setpoint prediction model building module 300 is used to build a generator setpoint prediction model M1 with global attention based on the original variable prediction training dataset D1 and the graph neural network.

[0170] The redundant constraint identification model building module 400 is used to build a redundant constraint identification model M2 with global attention based on the redundant constraint identification training dataset D2 and the graph neural network.

[0171] The solver module 500 is used to predict the generator setpoint and constraint dual variables based on the load data of the actual power system using the generator setpoint prediction model M1 and the redundancy constraint identification model D2, respectively. Based on the constraint dual variables, it identifies redundant constraints, initializes and simplifies the constraints of the optimal power flow problem, and then completes the optimal power flow calculation.

[0172] To implement the above embodiments, this application also proposes an electronic device, including: a processor and a memory communicatively connected to the processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to implement the method provided in the foregoing embodiments.

[0173] To implement the above embodiments, this application also proposes a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods provided in the foregoing embodiments.

[0174] To implement the above embodiments, this application also proposes a computer program product, including a computer program that, when executed by a processor, implements the methods provided in the foregoing embodiments.

[0175] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0176] It should be noted that personal information collected from users should be used for legitimate and reasonable purposes and should not be shared or sold outside of these legitimate uses. Furthermore, such collection / sharing should only be conducted after receiving the user's informed consent, including but not limited to notifying the user to read the user agreement / user notice and sign an agreement / authorization that includes authorization of relevant user information before the user uses the function. In addition, any necessary steps must be taken to protect and safeguard access to such personal information data and ensure that others with access to personal information data comply with their privacy policies and procedures.

[0177] This application is intended to provide an implementation scheme for users to selectively prevent the use or access to their personal information data. Specifically, this disclosure is intended to provide hardware and / or software to prevent or block access to such personal information data. Once personal information data is no longer needed, risks can be minimized by restricting data collection and deleting data. Furthermore, where applicable, such personal information is de-identified to protect user privacy.

[0178] In the foregoing descriptions of the embodiments, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0179] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.

[0180] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for solving optimal power flow assisted by a global attention graph neural network, characterized in that, Includes the following steps: Constructing an optimal power flow mathematical model; Based on the aforementioned optimal power flow model, a training dataset for predicting the original variables is constructed. ; Based on the aforementioned optimal power flow model, a redundancy constraint identification training dataset is constructed. ; Predict the training dataset based on the original variables. Using graph neural networks, a generator setpoint prediction model with global attention is constructed. ; Based on the aforementioned redundancy constraint identification training dataset Using graph neural networks, a redundant constraint recognition model with global attention is constructed. ; Based on the load data of the actual power system, the generator setpoint prediction model is used. With the aforementioned redundant constraint identification model The generator setpoint and constraint dual variables are predicted respectively, and redundant constraints are identified based on the constraint dual variables. After initializing and simplifying the constraints of the optimal power flow problem, the optimal power flow calculation is completed. Predict the training dataset based on the original variables. Using graph neural networks, a generator setpoint prediction model with global attention is constructed. ,include: Determine if a parameter-trained generator setpoint prediction model exists. ; If not, construct a graph structure using the nodes and lines in the power system as nodes and edges, respectively. ,in, Representation diagram, , Let them represent the node set and the edge set, respectively. The node features are ( , ), edge features are ,in For hyperparameters, For nodes , The impedance of the line; A linear layer is used as the generator setpoint prediction model. The embedding layer maps the input node features and edge features to a high-dimensional vector space, and the output dimension of the embedding layer is an adjustable hyperparameter. The embedding layer is connected to multiple graph attention layers or graph convolutional layers, wherein the input dimension of the graph attention layer or graph convolutional layer is the same as that of the linear layer, and the output dimension is a specifyable hyperparameter. An attention layer is connected after the graph attention layer or graph convolutional layer. The input dimension of the attention layer is consistent with the output dimension of the previous layer, and the number of attention heads is a specifyable hyperparameter when multi-head attention is used. Following the attention layer, a fully connected network is constructed for each generator node based on the number of nodes in the power system. The output of each fully connected network corresponds to the setpoint prediction value for each generator node. Each fully connected network consists of a linear layer and a ReLU layer, and an activation function is constructed. As the output layer of the fully connected network, the formula is: in, , They are respectively The maximum and minimum values; Predict the training dataset based on the original variables. For the dataset Power system topology construction The corresponding network layers are then processed sequentially. Training is performed on a training set; in the training set After training, in the training set The above is a prediction model for the generator setpoint. The parameters of the embedding layer, graph neural network layer, and attention layer are continued to be trained, and the fully connected network layer corresponding to the current topology is retrained. Set the generator setpoint prediction model The loss function is: in, Let be the mean squared error loss function, for the predicted value and tags , ; This is a power balance penalty term. ,in For the first The sum of the predicted active power values ​​of each sample generator. For the first The sum of the load power of each sample; Based on the aforementioned redundancy constraint identification training dataset Using graph neural networks, a redundant constraint recognition model with global attention is constructed. ,include: Determine if a redundant constraint identification model trained with parameters exists. ; If not, construct a graph structure using the nodes and lines in the power system as nodes and edges, respectively. ,in, Representation diagram, , Let them represent the node set and the edge set, respectively. The node features are ( , ), edge features are ,in For hyperparameters, For nodes , The impedance of the line; A linear layer is used as the redundancy constraint identification model. The embedding layer maps the input node features and edge features to a high-dimensional vector space, and the output dimension of the embedding layer is an adjustable hyperparameter. The embedding layer is connected to multiple graph attention layers or graph convolutional layers, wherein the input dimension of the graph attention layer or graph convolutional layer is the same as that of the linear layer, and the output dimension is a specifyable hyperparameter. An attention layer is connected after the graph attention layer or graph convolutional layer. The input dimension of the attention layer is consistent with the output dimension of the previous layer, and the number of attention heads is a specifyable hyperparameter when multi-head attention is used. The high-dimensional features processed by the attention layer are input into the fully connected network. The output of the fully connected network is the dual variable of each constraint. The fully connected network consists of linear layers and ReLU layers. The predicted value of each dual variable is used to determine whether the corresponding constraint is redundant. Based on the aforementioned redundancy constraint identification training dataset For the dataset Power system topology construction The corresponding network layers are then processed sequentially. Training is performed on a training set; in the training set After training, in the training set The above is a redundant constraint identification model The parameters of the embedding layer, graph neural network layer, and attention layer are continued to be trained, and the fully connected network layer corresponding to the current topology is retrained.

2. The method according to claim 1, characterized in that, The optimal power flow mathematical model includes: Objective function: Constraints: In the formula, The set of all nodes; For the set of generator nodes; A collection of transmission lines; Cost of generating electricity by generator; For nodes To node Active power; For nodes To node Reactive power; For nodes voltage amplitude, , These represent its maximum and minimum values, respectively. For nodes The voltages intersect; For nodes Generator active power output, , These represent its maximum and minimum values, respectively. For nodes Generator reactive power output, , These represent its maximum and minimum values, respectively. For nodes Active load; For nodes Reactive load; For nodes and nodes Maximum phase angle difference; For the node Flow to Node The active power; For the node Flow to Node reactive power; For nodes , The maximum apparent power of the transmission line.

3. The method according to claim 2, characterized in that, Based on the aforementioned optimal power flow model, a training dataset for predicting the original variables is constructed. ,include: During the initial training, data is extracted based on historical power grid operation data or publicly available datasets. For different power grid topologies, load information under each topology is sampled and generated according to a probability distribution. The training set contains 100 load samples, which are used as input to the training set. Sample; based on the interior point method, solve the optimal power flow mathematical model, obtain the generator setpoint as a label, and denote the first sample in the generator setpoint prediction training set as the label. The training set generated under this topology is ; If a trained generator setpoint prediction model already exists The power grid load information under a given topology is sampled and generated according to a probability distribution. Samples; solve the optimal power flow mathematical model for all samples based on the interior point method, and obtain the generator setpoint as a label.

4. The method according to claim 2, characterized in that, Based on the aforementioned optimal power flow model, a redundancy constraint identification training dataset is used. ,include: During the initial training, data is extracted based on historical power grid operation data or publicly available datasets. For different power grid topologies, load information under each topology is sampled and generated according to a probability distribution. The training set contains 100 load samples, which are used as input to the training set. Sample; based on the interior point method, solve the optimal power flow mathematical model, obtain the dual variables of each constraint as labels, and denote the redundancy constraint identification training set as the first sample. The training set generated under this topology is ; If a trained redundant constraint identification model already exists The power grid load information under a given topology is sampled and generated according to a probability distribution. Samples; solve the optimal power flow mathematical model for all samples based on the interior point method, and obtain the dual variables of each constraint as labels.

5. The method according to claim 4, characterized in that, Also includes: If a generator setpoint prediction model that has been trained with parameters exists... Determine whether the power grid topology exists in the training set for the optimal power flow problem to be solved. middle; If it exists, then the generator setpoint prediction model will not be used. Retrain; if not, freeze the parameters of the embedding layer, graph neural network layer, and attention layer, and train only the parameters of the fully connected network layer.

6. The method according to claim 5, characterized in that, Also includes: If a redundant constraint identification model exists that has been trained with parameters. Determine whether the power grid topology exists in the training set for the optimal power flow problem to be solved. middle; If it exists, then the redundant constraint identification model is not used. Retrain; if not, freeze the parameters of the embedding layer, graph neural network layer, and attention layer, and train only the parameters of the fully connected network layer.

7. The method according to claim 1, characterized in that, The load data based on the actual power system is used in the generator setpoint prediction model. With the aforementioned redundant constraint identification model The generator setpoint and constraint dual variables are predicted separately, and redundant constraints are identified based on the constraint dual variables. After initializing and simplifying the constraints of the optimal power flow problem, the optimal power flow calculation is completed, including: The actual power system load data is sampled, and the sampled data is input into the generator setpoint prediction model. With the aforementioned redundant constraint identification model We obtain the generator setpoint predictions and the dual variables predictions for each constraint in the optimal power flow problem. Input the constructed optimal power flow mathematical model into the mathematical solver; The solution to the optimal power flow problem is initialized using the generator setpoint prediction value; for the ... Predicted values ​​of dual variables with term constraints Initialize the corresponding dual variables in the optimal power flow problem. and specify the critical value. Determine if there is If so, then the first one is considered to be... Redundant constraints are removed from the optimal power flow problem. The optimal power flow problem is solved using a mathematical solver after initialization and simplification, thus completing the optimal power flow calculation.

8. An optimal power flow solution device assisted by a global attention graph neural network based on the method of any one of claims 1-7, characterized in that, include: The optimal power flow mathematical model construction module is used to construct the optimal power flow mathematical model; The dataset construction module is used to construct training datasets for predicting original variables based on the optimal power flow model. Training dataset for identifying redundancy constraints ; The generator setpoint prediction model building module is used to predict the training dataset based on the original variables. Using graph neural networks, a generator setpoint prediction model with global attention is constructed. ; The redundant constraint identification model construction module is used to build a redundant constraint identification training dataset. Using graph neural networks, a redundant constraint recognition model with global attention is constructed. ; The solution module is used to predict the generator setpoint based on the load data of the actual power system using the generator setpoint prediction model. With the aforementioned redundant constraint identification model The generator setpoint and constraint dual variables are predicted separately, and redundant constraints are identified based on the constraint dual variables. After initializing and simplifying the constraints of the optimal power flow problem, the optimal power flow calculation is completed.

Citation Information

Patent Citations

  • Optimal power flow rapid solving method combining neural network and physical model

    CN116720436A

  • KKT conditional learning graph neural network construction method for real-time optimal power flow

    CN119026635A