Power grid power flow analysis method and device based on quotient gradient method and neural network
By embedding the dynamic equations of the quotient gradient method into a physical information neural network and constructing a composite loss function, the problems of convergence difficulty and low computational efficiency in complex power grids are solved, and robust and efficient power flow calculation of power systems under extreme conditions is realized.
Patent Information
- Application Number
- CN202511144897.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-15
- Publication Date
- 2025-11-28
AI Technical Summary
Existing technologies suffer from convergence difficulties, poor physical interpretability, and low computational efficiency in complex power grid scenarios, making it difficult to meet the requirements for the safe and efficient operation of power systems under extreme conditions.
The dynamic equations of the quotient gradient method are embedded into a physical information neural network to construct a composite loss function. The neural network is then trained using the backpropagation algorithm to output the steady-state power flow solution.
It achieves stable convergence in ill-conditioned or heavily loaded power grids, possesses physical interpretability and efficient computing capabilities, and meets the real-time requirements of online power system analysis.
Smart Images

Figure CN121036047A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of power system analysis and control, in particular to a power grid power flow analysis method and device based on quotient gradient method and neural network. BACKGROUND
[0002] In power system planning, operation and control, power flow calculation is a core basic task, which solves the nonlinear algebraic equation set describing the relationship between the node voltage amplitude, phase angle and power distribution of the power grid, and provides key data support for system safety and stability analysis and dispatching decision. At present, traditional numerical method and data driven method are two main technical routes of power flow calculation. Among them, Newton-Raphson method is widely used in offline analysis of large power systems due to its fast convergence speed and high accuracy; fast decoupling method is commonly used in online monitoring of transmission network due to its simplified calculation advantage. With the increase of renewable energy penetration and the expansion of power grid scale, data driven methods such as artificial neural network and graph convolution network are used for real-time power flow estimation due to their fast reasoning ability. In addition, physical information neural network (PINN) has shown potential in terms of data efficiency and physical consistency by embedding the power flow equation as a constraint in training, and has gradually become a research hotspot.
[0003] However, the existing technology still has significant limitations in complex power grid scenarios. In the traditional numerical method, Newton-Raphson method depends on the inverse of Jacobian matrix, which is easy to approach singularity when the system is heavily loaded, the topology structure changes suddenly or the parameters are ill-conditioned, resulting in convergence failure and sensitivity to initial value selection; fast decoupling method is limited by the assumption that "resistance is much smaller than reactance", and has large error in high R / X ratio scenarios such as distribution network. Although the pure data driven method is efficient in calculation, the "black box" characteristic makes it lack of physical interpretability, and the prediction accuracy decreases sharply when the test conditions exceed the training data distribution range (such as extreme fault and sudden load surge). Although the existing physical information neural network introduces power flow equation constraints, when the system approaches the limit operating state, the constraint effect of physical constraints on the model is weakened, and it is difficult to guarantee the feasibility and accuracy of the solution. In addition, although the quotient gradient method and other trajectory-based methods are robust, the calculation amount is large in the process of solving dynamic system through numerical integration, which cannot meet the real-time demand of online application. These problems jointly restrict the safe and efficient operation of power system under complex conditions.
[0004] Therefore, how to invent a power grid power flow analysis method based on quotient gradient method and neural network to solve the existing problems in the prior art and realize robust, interpretable and efficient power flow calculation has become a problem to be solved. SUMMARY
[0005] To this end, the application provides a power grid power flow analysis method and device based on quotient gradient method and neural network, which embeds the dynamic equation of the quotient gradient method into a physical information neural network, solves the problems of convergence difficulty of traditional methods in ill-conditioned or heavy load power grids, poor physical interpretability and limited generalization ability of pure data-driven models, insufficient accuracy of existing physical information neural networks in extreme working conditions, and low calculation efficiency of the quotient gradient method that cannot meet real-time requirements, and realizes robust, interpretable and efficient power flow calculation.
[0006] To achieve the above-mentioned purpose, the application provides the following technical scheme: a power grid power flow analysis method based on quotient gradient method and neural network, comprising:
[0007] Converting the nonlinear algebraic equation set of power system power flow calculation into a common differential equation based on the quotient gradient method;
[0008] Based on the common differential equation, a physical information neural network model is constructed; the physical information neural network model outputs the predicted value of the system state variable;
[0009] The common differential equation is calculated by a common differential equation solver to obtain the system state reference trajectory under the set working condition and generate a training data set;
[0010] Based on the predicted value of the system state variable and the training data set, a composite loss function is defined;
[0011] Based on the composite loss function, the physical information neural network model is iteratively trained by a back propagation algorithm to obtain the trained physical information neural network model;
[0012] The system parameters of the working condition to be calculated and the set time to ensure that the system reaches a steady state are input into the trained physical information neural network model, and the forward propagation algorithm is used for calculation to output the steady-state power flow solution of the working condition to be calculated.
[0013] As a preferred scheme of the power grid power flow analysis method based on the quotient gradient method and the neural network, the expression of the common differential equation is:
[0014]
[0015] In the formula, is the derivative of the state variable x with respect to time t, i.e. the change rate of the state variable; J(x, u) is the Jacobian matrix of the power residual vector F(x, u) with respect to the state variable x; J T is the transpose of the Jacobian matrix; u is the known operating parameter of the system.
[0016] As the preferred solution of the power flow analysis method based on quotient gradient method and neural network, the composite loss function comprises data loss and physical loss.
[0017] The calculation formula of the data loss is:
[0018]
[0019] In the formula, L data is the data loss; N1 is the number of samples in the training data set; t i is the time point of the i-th sample; x NN (t i ,u) is the state vector predicted by the neural network under the time point t i and the operation parameter u; x data (t i ,u) is the corresponding reference trajectory data point, that is, the real system state obtained by numerical integration or other methods under the same condition; and the symbol ||·|| is the Euclidean norm;
[0020] The calculation formula of the physical loss is:
[0021]
[0022] In the formula, L physics is the physical loss; N2 is the number of sampling points for calculating the physical loss; is the state derivative calculated by automatic differentiation, and is the state change rate predicted by the neural network;
[0023] -J T (x NN (t i ,u),u) F(x NN (t i ,u),u) is the state change rate calculated according to the quotient gradient theory;
[0024] J T (x NN (t i ,u),u) is the Jacobian matrix calculated at the state point predicted by the neural network;
[0025] F(x NN (t i ,u),u) is the corresponding power residual vector;
[0026] The expression of the composite loss function is:
[0027] L total = α·L data + β·L physics
[0028] wherein L total is a composite loss function; alpha >= 0 is a weight coefficient of a data prediction error loss term; beta >= 0 is a weight coefficient of a physical consistency loss term.
[0029] As a preferred solution of the power grid power flow analysis method based on quotient gradient method and neural network, an expression of the physical information neural network model is as follows:
[0030]
[0031] wherein, is a deep neural network; theta is a set of learnable neural network parameters, including weight matrices and bias vectors of all layers of the network.
[0032] As a preferred solution of the power grid power flow analysis method based on quotient gradient method and neural network, in the process of iteratively training the physical information neural network model by the back propagation algorithm, an Adam optimizer is adopted, the composite loss function is minimized by the back propagation algorithm, and the training is completed.
[0033] The application also provides a power grid power flow analysis device based on quotient gradient method and neural network, based on the above power grid power flow analysis method based on quotient gradient method and neural network, comprising:
[0034] Ordinary differential equation conversion module, used for converting a nonlinear algebraic equation set of power system power flow calculation into an ordinary differential equation based on quotient gradient method;
[0035] Physical information neural network model construction module, used for constructing a physical information neural network model based on the ordinary differential equation; and outputting a predicted value of a system state variable through the physical information neural network model;
[0036] Training data set generation module, used for calculating the ordinary differential equation through an ordinary differential equation solver, obtaining a system state reference trajectory under a set working condition, and generating a training data set;
[0037] Composite loss function definition module, used for defining a composite loss function based on the predicted value of the system state variable and the training data set;
[0038] Physical information neural network model training module, used for iteratively training the physical information neural network model through a back propagation algorithm based on the composite loss function, and obtaining a trained physical information neural network model;
[0039] The steady-state power flow solution calculation module is configured to input system parameters of a to-be-calculated working condition and a set time for ensuring that the system reaches a steady state into the trained physical information neural network model, perform calculation through a forward propagation algorithm, and output a steady-state power flow solution of the to-be-calculated working condition.
[0040] As a preferred solution of the power grid power flow analysis device based on the quotient gradient method and the neural network, in the ordinary differential equation conversion module, the expression of the ordinary differential equation is:
[0041]
[0042] In the formula, is a derivative of the state variable x with respect to time t, that is, a change rate of the state variable; J(x, u) is a Jacobian matrix of the power residual vector F(x, u) with respect to the state variable x; J T is a transpose of the Jacobian matrix; u is a known operating parameter of the system.
[0043] As a preferred solution of the power grid power flow analysis device based on the quotient gradient method and the neural network, in the composite loss function definition module, the composite loss function includes data loss and physical loss.
[0044] The calculation formula of the data loss is:
[0045]
[0046] In the formula, L data is the data loss; N1 is a sample quantity in a training data set; t i is a time point of the i th sample; x NN (t i ,u) is a state vector predicted by the neural network under the time point t i and the operating parameter u; x data (t i ,u) is a corresponding reference trajectory data point, that is, a real system state obtained through numerical integration or other methods under the same condition; a symbol ||·|| is a Euclidean norm;
[0047] The calculation formula of the physical loss is:
[0048]
[0049] In the formula, L physics is the physical loss; N2 is a sampling point quantity for calculating the physical loss; is a state derivative calculated through automatic differentiation, and is a change rate of the state predicted by the neural network;
[0050] -J T (x NN (ti F(x NN (t i F(x
[0051] J(x NN (t i J(x
[0052] F(x NN (t i F(x
[0053] The expression of the composite loss function is:
[0054] L total = a * L data + b * L physics
[0055] In the formula, L total is a composite loss function; a>0 is the weight coefficient of the data prediction error loss term; b>0 is the weight coefficient of the physical consistency loss term.
[0056] As a preferred scheme of the power grid power flow analysis device based on the quotient gradient method and the neural network, in the physical information neural network model construction module, the expression of the physical information neural network model is:
[0057]
[0058] In the formula, is a deep neural network; and Q is a set of learnable neural network parameters, including weight matrices and bias vectors of all layers of the network.
[0059] As a preferred scheme of the power grid power flow analysis device based on the quotient gradient method and the neural network, in the physical information neural network model training module, in the process of iteratively training the physical information neural network model through the back propagation algorithm, an Adam optimizer is adopted, the composite loss function is minimized through the back propagation algorithm, and the training is completed.
[0060] The present application has the following advantages: the present application converts the nonlinear algebraic equations of power system power flow calculation into ordinary differential equations based on the quotient gradient method; based on the ordinary differential equations, a physical information neural network model is constructed; the predicted value of the system state variable is output through the physical information neural network model; the system state reference trajectory under the set working condition is obtained by calculating the ordinary differential equations through the ordinary differential equation solver, and a training data set is generated; based on the predicted value of the system state variable and the training data set, a composite loss function is defined; based on the composite loss function, the physical information neural network model is iteratively trained through the back propagation algorithm to obtain the trained physical information neural network model; the system parameters of the to-be-calculated working condition and the set time to ensure that the system reaches a steady state are input into the trained physical information neural network model, and the steady-state power flow solution of the to-be-calculated working condition is output through the forward propagation algorithm. Compared with the prior art, the robustness of the present application is strong, the power flow equation is converted into a dynamic system through the quotient gradient method, the inverse problem of the Jacobian matrix is avoided, and stable convergence can still be achieved under extreme working conditions such as ill-conditioned and heavy load; the present application has high physical interpretability, the quotient gradient dynamic equation is embedded into the neural network as a constraint, the output strictly follows the physical law, and the "black box" defect of the pure data-driven model is overcome; the generalization ability of the present application is excellent, without relying on a large amount of extreme working condition data, unknown scenes outside the training distribution can be accurately predicted; the present application is efficient in calculation, the trained neural network can be solved through one forward propagation, and the real-time demand of online analysis of the power system is met. BRIEF DESCRIPTION OF DRAWINGS
[0061] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only exemplary, and for those skilled in the art, other embodiments can be derived from the provided drawings without creative labor.
[0062] The structures, proportions, sizes, etc. shown in the specification are only used to cooperate with the content disclosed in the specification, to be understood and read by those skilled in the art, and do not define the limiting conditions under which the present application can be implemented, so they do not have technical significance. Any modification of structure, change of proportion relationship or adjustment of size, without affecting the effect and purpose that the present application can produce, should still fall within the scope of the technical content disclosed by the present application.
[0063] Figure 1 A flowchart of the power grid power flow analysis method based on the quotient gradient method and neural network provided in Embodiment 1 of the present application;
[0064] Figure 2A specific implementation framework process schematic diagram of the power grid power flow analysis method based on the quotient gradient method and the neural network provided in Embodiment 1 of the present application is provided.
[0065] Figure 3 A trajectory schematic diagram of the evolution of system state variables with time in the power grid power flow analysis method based on the quotient gradient method and the neural network provided in Embodiment 1 of the present application is provided.
[0066] Figure 4 A model training flow schematic diagram in the power grid power flow analysis method based on the quotient gradient method and the neural network provided in Embodiment 1 of the present application is provided.
[0067] Figure 5 An online solution flow schematic diagram in the power grid power flow analysis method based on the quotient gradient method and the neural network provided in Embodiment 1 of the present application is provided.
[0068] Figure 6 An architecture schematic diagram of the power grid power flow analysis device based on the quotient gradient method and the neural network provided in Embodiment 2 of the present application is provided. DETAILED DESCRIPTION
[0069] The embodiments of the present application are described below by the specific embodiments, and those skilled in the art can easily understand other advantages and effects of the present application from the content disclosed in the specification. Obviously, the described embodiments are part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0070] Embodiment 1
[0071] Referring to Figure 1 and Figure 2 Embodiment 1 of the present application provides a power grid power flow analysis method based on the quotient gradient method and the neural network, including the following steps:
[0072] S1, converting the nonlinear algebraic equation set of power system power flow calculation into a common differential equation based on the quotient gradient method;
[0073] S2, constructing a physical information neural network model based on the common differential equation; outputting a predicted value of a system state variable through the physical information neural network model;
[0074] S3, calculating the common differential equation through a common differential equation solver, obtaining a system state reference trajectory under a set working condition, and generating a training data set;
[0075] S4, defining a composite loss function based on the predicted value of the system state variable and the training data set;
[0076] S5. Based on the composite loss function, the physical information neural network model is iteratively trained using the backpropagation algorithm to obtain the trained physical information neural network model.
[0077] S6. Input the system parameters of the operating condition to be calculated and the set time to ensure that the system reaches steady state into the trained physical information neural network model, perform calculation through the forward propagation algorithm, and output the steady-state power flow solution of the operating condition to be calculated.
[0078] In this embodiment, in step S1, the nonlinear algebraic equations for power system flow calculation are transformed into ordinary differential equations based on the quotient gradient method.
[0079] Specifically, the traditional nonlinear power flow algebraic equations f(x,u)=0 are mathematically transformed. Unlike the Newton-Raphson method, which relies on the inversion of the Jacobian matrix, this invention adopts the idea of the Quotient Gradient (QG) method, transforming the problem into finding a stable equilibrium point of a dynamic system.
[0080] In this embodiment, the goal of power flow analysis is to determine the voltage magnitude and phase angle at each node of the power grid under specific operating conditions. Mathematically, this problem can be expressed as solving a set of nonlinear algebraic equations:
[0081]
[0082] In the formula, ΔP i and ΔQ i These represent the active and reactive power imbalances at node i, respectively; P is and Q is V represents the specified active and reactive power injection values (generation power minus load power) for node i, respectively; i and V j θ represents the voltage magnitudes at nodes i and j, respectively; ij The phase angle difference between node i and node j, i.e., θ i -θ j G ij and B ij These are the real part (conductance) and imaginary part (susceptance) of the corresponding element in the node admittance matrix, respectively; the symbol j∈i is the set of all nodes j electrically connected to node i, including node i itself.
[0083] like Figure 3As shown, in power system power flow calculations, nodes are classified into three categories based on their control methods: PQ nodes (specifying active and reactive power injection); PV nodes (specifying active power and voltage amplitude); and slack nodes (specifying voltage amplitude and phase angle). Let x be the system state variable to be solved, and u represent the known operating parameters of the system. Its structure is as follows:
[0084]
[0085] In the formula, V PQ θ is the voltage magnitude vector of node PQ; PQ θ is the phase angle vector of the PQ node voltage; PV P is the phase angle vector of the PV node voltage; PQ and Q PQ The active and reactive power injections specified for the PQ nodes are respectively; P PV Active power injection specified for PV nodes; V PV The voltage amplitude specified for the PV node; V slack and θ slack The voltage magnitude and phase angle (usually set to a reference angle of 0 degrees) are specified for the slack node. This method clearly divides the system variables into unknowns to be solved and known operating parameters, which facilitates the design and implementation of subsequent solution algorithms.
[0086] The power residual vector F(x,u) arranged according to the bus type can be as follows:
[0087] F(x,u)=[ΔP PQ ,ΔP PV ,ΔQ PQ ] T
[0088] In the formula, ΔP PQ Let ΔP be the active power imbalance vector at node PQ; PV ΔQ is the active power imbalance vector of the PV node; PQ Let x be the reactive power imbalance vector at node PQ. The solution to the power flow equation is the state variable vector x that makes F(x,u)=0.
[0089] This problem can be transformed from solving static algebraic equations into solving initial value problems of ordinary differential equations (ODEs). This approach redefines the solution-finding process as finding a trajectory that continuously minimizes an objective function, representing the error of the equation:
[0090]
[0091] The optimization objective is to use the square of the Euclidean norm of the power residual vector, multiplied by a coefficient. This is to eliminate the coefficient during differentiation, simplifying subsequent calculations. The goal of this optimization problem is to find the system state that minimizes the power imbalance; ideally, the power imbalance is zero, i.e., to find the exact solution to the power flow equations.
[0092] The Quotient Gradient (QG) method can be implemented by constructing a gradient flow that is least squared as the power flow equation. This gradient flow is defined by the following ordinary differential equation:
[0093]
[0094] In the formula, Let F(x,u) be the derivative of the state variable x with respect to time t, i.e., the rate of change of the state variable; J(x,u) is the Jacobian matrix of the power residual vector F(x,u) with respect to the state variable x; J T is the transpose of the Jacobian matrix; u represents the known operating parameters of the system. Each element of this Jacobian matrix... It is the partial derivative of the i-th component of the power residual vector with respect to the j-th component of the state variable.
[0095] In this dynamic system, the solution to the original power flow equation corresponds to the steady equilibrium point (satisfying...) And F(x,u)=0). From the perspective of system stability theory, this dynamic system is stable because it is designed as a gradient descent process that minimizes the power residual. The system will evolve along the direction of decreasing residual until it reaches a stable equilibrium point, which is the solution to the power flow equation.
[0096] In this embodiment, in step S2, a physical information neural network model is constructed based on the ordinary differential equation; the predicted values of the system state variables are output through the physical information neural network model.
[0097] Specifically, such as Figure 4 As shown, a deep neural network is constructed as the solver, namely the PINN-QG model. This model typically adopts a multilayer perceptron (MLP) structure, containing an input layer, multiple hidden layers, and an output layer. The input layer receives the concatenated time t and operating parameters u; the hidden layers process the information layer by layer through nonlinear activation functions; and the output layer generates the predicted value of the system state variable x at the corresponding time.
[0098] In one possible implementation, the multilayer perceptron (MLP) architecture can employ other more advanced neural network architectures, such as graph neural networks (GNNs) to better encode the topology information of the power system, or convolutional neural networks (CNNs) to extract local features of the data.
[0099] The PINN model employs a deep neural network. The mapping relationship of the state vector trajectory x(t;u) is learned by jointly inputting time t and operating parameters u, as follows:
[0100]
[0101] In the formula, Θ represents the set of learnable neural network parameters, including the weight matrices and bias vectors of all layers. This network employs a standard multilayer perceptron (MLP) structure, containing one input layer, L hidden layers, and one output layer. Information propagates between layers according to the following forward computation rules:
[0102] h k =σ k (W k h k-1 +b k ), k=1,…,L+1
[0103] In the formula, h k The activation output of the k-th layer is given; specifically, h0 is the network input, and h... L+1 This is the network output, i.e., the predicted state vector; symbol and Represent the weight matrix and bias vector of the k-th layer, respectively, where d k Let σ be the number of neurons in the k-th layer; σ is the function. k As a non-linear activation function, ReLU (Modified Linear Unit), tanh (Hyperbolic Tangent), Sigmoid, Leaky ReLU, etc. are usually chosen in the hidden layer, while linear activation functions are usually used in the output layer to ensure that the output range is unrestricted.
[0104] The input layer receives data from time. and operating parameters The concatenated vector:
[0105]
[0106] In the formula, n u The dimension of the operation parameter vector.
[0107] Output layer generates state vector prediction:
[0108]
[0109] In the formula, n x is the dimension of the state vector.
[0110] In this embodiment, automatic differentiation technique is used to accurately calculate the derivative of the neural network output with respect to the time variable t. This derivative is expressed as: This forms the basis of the physics-based loss function. In the neural network computation graph, time t is treated as an input variable, which enables the backpropagation algorithm to accurately and efficiently calculate partial derivatives. The derivative calculation process can be described as follows:
[0111]
[0112] By using the chain rule of the computation graph, the partial derivative can be calculated with high precision without the need for numerical approximation methods such as finite difference, thus avoiding the impact of numerical errors on the satisfaction of physical constraints.
[0113] Physical Information Neural Networks (PINNs) directly construct a continuous function mapping from input (t, u) to output state x(t). Given a set of operating parameters u, PINN can predict the state vector x(t) at any time t, including time points not covered in the training data. This continuous mapping characteristic allows PINN to capture the entire dynamic evolution of the system, unrestricted by discrete time-point sampling. Its goal is not to simulate transient processes, but to learn the complete trajectory of the quotient gradient dynamic system, thereby directly deriving the final steady-state power flow solution. By setting a sufficiently long time interval [0, T], it ensures that the system can fully evolve to a steady state, thus obtaining an accurate power flow solution.
[0114] In this embodiment, in step S3, the ordinary differential equation is calculated by an ordinary differential equation solver to obtain the system state reference trajectory under the set working conditions and generate a training dataset.
[0115] Specifically, to supervise the training of the neural network, a training dataset containing various operating conditions is needed. This dataset is generated as follows: For a series of randomly sampled power grid operating parameters p, the QG dynamic equations are solved using a high-precision traditional ODE solver (such as the fourth-order Runge-Kutta method), thereby obtaining complete trajectory data x of the system state x evolving from its initial value to its steady state under different operating conditions. ref (t,u).
[0116] In this embodiment, in step S4, a composite loss function is defined based on the predicted values of the system state variables and the training dataset;
[0117] Specifically, such as Figure 4 As shown, the complete loss function consists of two parts: data loss L data and physical loss L physics These two components work together to ensure that the model predictions match the training data and that the prediction results meet the physical constraints of the system, i.e., follow the evolution law of the quotient gradient mentioned above.
[0118] Data loss term L dataIt is used to measure the deviation between network predictions and reference data, and its calculation formula is as follows:
[0119]
[0120] In the formula, L data For data loss; N1 is the number of samples in the training dataset; t i x represents the time point of the i-th sample; NN (t i (u) represents the neural network at time point t. i The predicted state vector under operating parameters u; x data (t i (u) represents the corresponding reference trajectory data point, i.e., the real system state obtained under the same conditions through numerical integration or other methods; the symbol ||·|| represents the Euclidean norm;
[0121] This type of reference data is typically pre-generated using traditional ordinary differential equation solvers (such as the Runge-Kutta method, trapezoidal method, or backward Euler method), providing crucial supervisory signals for physical information neural networks. By minimizing L... data This ensures that the neural network can accurately fit the known dynamic trajectory of the system.
[0122] Physical loss term L physics To strengthen physical constraints, its core idea is to calculate the time derivative of the state vector using automatic differentiation techniques and compare it with the derivative value defined by the quotient gradient theory equation, ensuring that the dynamic evolution process learned by the neural network conforms to physical laws. The specific calculation formula is as follows:
[0123]
[0124] In the formula, L physics N1 represents the physical loss; N2 represents the number of sampling points used to calculate the physical loss. The state derivative, calculated via automatic differentiation, represents the rate of change of state predicted by the neural network; -J T (x NN (t i ,u),u)F(x NN (t i J represents the rate of change of state calculated according to the quotient gradient theory; T (x NN (t i F(x,u),u) is the Jacobian matrix calculated at the state points predicted by the neural network; NN (t i ,u),u) are the corresponding power residual vectors;
[0125] By minimizing L physicsThis ensures that the dynamic trajectory predicted by the neural network conforms to the physical laws of the quotient gradient, maintaining accurate physical behavior even in regions where training data is sparse or missing.
[0126] The expression for the composite loss function is:
[0127] L total =α·L data +β·L physics
[0128] In the formula, L total For the composite loss function; α≥0 is the weighting coefficient of the data prediction error loss term; β≥0 is the weighting coefficient of the physical consistency loss term.
[0129] α and β, as hyperparameters, are used to balance the neural network's ability to fit data and adhere to physical constraints. A lower α:β ratio reduces overfitting of the neural network to existing trajectory data, emphasizing instead adherence to the physical constraints of the quotient gradient; while a higher α:β ratio enhances the neural network's ability to learn from known trajectory data, but may reduce its adherence to physical constraints. In extreme cases, if α = 0, training relies entirely on physical constraints, which is called unsupervised learning; if β = 0, it degenerates into purely data-driven supervised learning. In practical applications, these two hyperparameters usually need to be adjusted according to the specific problem and data quality to achieve optimal model performance and generalization ability.
[0130] In one possible implementation, the construction of the physical loss term can be more flexible. For example, adaptive sampling or encrypted sampling can be performed in key regions of the dynamic trajectory. Furthermore, the weights of the data loss term and the physical loss term can be designed as variables that are dynamically adjusted during training.
[0131] In one possible implementation, the reference trajectory data used for the data loss term can be generated by a numerical solver for different types of ordinary differential equations (ODEs). In an extreme case, model training can be driven entirely by physical loss, without relying on pre-generated trajectory data, thus constituting an unsupervised or semi-supervised learning paradigm.
[0132] In this embodiment, in step S5, based on the composite loss function, the physical information neural network model is iteratively trained using the backpropagation algorithm to obtain the trained physical information neural network model;
[0133] Specifically, such as Figure 4As shown, by optimizing the aforementioned loss function, the physical information neural network can learn a state evolution trajectory that conforms to the dynamics of the quotient gradient. Using optimizers such as Adam, the network parameters are iteratively optimized through the backpropagation algorithm to minimize the defined total loss. When the loss converges to the preset accuracy or the maximum number of training epochs is reached, the training process ends, and the trained model parameters are saved and solidified for online use.
[0134] In one possible implementation, the gradient optimization algorithm is not limited to Adam; other algorithms can be used, such as stochastic gradient descent with momentum (SGD), RMSprop, etc.
[0135] In this embodiment, in step S6, the system parameters of the operating condition to be calculated and the set time to ensure that the system reaches steady state are input into the trained physical information neural network model, and the forward propagation algorithm is used to calculate and output the steady-state power flow solution of the operating condition to be calculated.
[0136] Specifically, such as Figure 5 As shown, when power flow calculations are needed for a new power grid operating condition, the corresponding operating parameter u and a sufficiently large time T to ensure the system reaches steady state are input into the pre-trained PINN-QG model. T is a parameter that can be dynamically adjusted according to the system size or load level. The model only needs to perform a single fast forward calculation to directly output the steady-state power flow solution x for that operating condition. final .
[0137] In summary, this invention is applicable to various power system scenarios:
[0138] First, it can perform integrated analysis of large-scale transmission and distribution networks, and efficiently handle power flow calculations of ill-conditioned systems caused by topological complexity and parameter differences.
[0139] Second, power grid operation assessment under heavy load or extreme conditions, such as solving power flow distribution during peak summer electricity consumption and fluctuations in new energy power.
[0140] Third, online real-time monitoring and dispatching of the power system, meeting real-time requirements with rapid reasoning capabilities;
[0141] Fourth, it analyzes power grids with a high proportion of renewable energy to address the challenges of power flow calculations brought about by bidirectional power flow, providing reliable data support for system planning and safety verification.
[0142] It should be noted that the method of this disclosure embodiment can be executed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method of this disclosure embodiment, and the multiple devices will interact with each other to complete the method described.
[0143] It should be noted that the above description describes some embodiments of this disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in a different order than that shown in the above embodiments and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0144] Example 2
[0145] See Figure 6 Embodiment 2 of the present invention also provides a power flow analysis device for power grids based on the quotient gradient method and neural networks, comprising:
[0146] The Ordinary Differential Equation Transformation Module 001 is used to transform the nonlinear algebraic equations for power flow calculation into ordinary differential equations based on the quotient gradient method.
[0147] The physical information neural network model construction module 002 is used to construct a physical information neural network model based on the ordinary differential equation; and output the predicted values of the system state variables through the physical information neural network model.
[0148] The training dataset generation module 003 is used to calculate the ordinary differential equation through the ordinary differential equation solver, obtain the system state reference trajectory under the set working conditions, and generate the training dataset.
[0149] The composite loss function definition module 004 is used to define a composite loss function based on the predicted values of the system state variables and the training dataset.
[0150] The physical information neural network model training module 005 is used to iteratively train the physical information neural network model based on the composite loss function and through the backpropagation algorithm to obtain the trained physical information neural network model.
[0151] The steady-state power flow solution calculation module 006 is used to input the system parameters of the operating condition to be calculated and the set time to ensure that the system reaches steady state into the trained physical information neural network model, perform calculation through the forward propagation algorithm, and output the steady-state power flow solution of the operating condition to be calculated.
[0152] In this embodiment, in the ordinary differential equation transformation module 001, the expression of the ordinary differential equation is:
[0153]
[0154] In the formula, Let F(x,u) be the derivative of the state variable x with respect to time t, i.e., the rate of change of the state variable; J(x,u) is the Jacobian matrix of the power residual vector F(x,u) with respect to the state variable x; J T is the transpose of the Jacobian matrix; u is the known operating parameter of the system.
[0155] In this embodiment, the composite loss function definition module 004 includes: data loss and physical loss;
[0156] The formula for calculating the data loss is:
[0157]
[0158] In the formula, L data For data loss; N1 is the number of samples in the training dataset; t i x represents the time point of the i-th sample; NN (t i (u) represents the neural network at time point t. i The predicted state vector under operating parameters u; x data (t i (u) represents the corresponding reference trajectory data point, i.e., the real system state obtained under the same conditions through numerical integration or other methods; the symbol ||·|| represents the Euclidean norm;
[0159] The formula for calculating the physical loss is:
[0160]
[0161] In the formula, L physics N1 represents the physical loss; N2 represents the number of sampling points used to calculate the physical loss. Let be the state derivative calculated by automatic differentiation, representing the rate of state change predicted by the neural network;
[0162] -J T (x NN (t i ,u),u)F(x NN (ti ,u),u) are the rates of change of state calculated according to the quotient gradient theory;
[0163] J(x NN (t i ,u),u) are the Jacobian matrices calculated at the state points predicted by the neural network;
[0164] F(x NN (t i ,u),u) are the corresponding power residual vectors;
[0165] The expression for the composite loss function is:
[0166] L total =α·L data +β·L physics
[0167] In the formula, L total For the composite loss function; α≥0 is the weighting coefficient of the data prediction error loss term; β≥0 is the weighting coefficient of the physical consistency loss term.
[0168] In this embodiment, in the physical information neural network model construction module 02, the expression of the physical information neural network model is:
[0169]
[0170] In the formula, Θ represents a deep neural network; Θ is the set of learnable neural network parameters, including the weight matrices and bias vectors of all layers in the network.
[0171] In this embodiment, in the physical information neural network model training module 005, during the iterative training of the physical information neural network model using the backpropagation algorithm, the Adam optimizer is used to minimize the composite loss function through the backpropagation algorithm to complete the training.
[0172] The method embodiments in Example 1 are based on the same concept, and the technical effects they bring are the same as those in the method embodiments of this application. For details, please refer to the description in the method embodiments shown above in this application, which will not be repeated here.
[0173] Example 3
[0174] Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium storing program code for a power flow analysis method based on the quotient gradient method and neural network. The program code includes instructions for executing the power flow analysis method based on the quotient gradient method and neural network of Embodiment 1 or any possible implementation thereof.
[0175] Computer-readable storage media can be any available medium that a computer can access, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives, SSDs).
[0176] Example 4
[0177] Embodiment 4 of the present invention provides an electronic device, including: a memory and a processor;
[0178] The processor and the memory communicate with each other via a bus; the memory stores program instructions that can be executed by the processor, and the processor can call the program instructions to execute the power flow analysis method based on the quotient gradient method and neural network of Embodiment 1 or any possible implementation thereof.
[0179] Specifically, a processor can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor that reads software code stored in memory. This memory can be integrated into the processor or located outside the processor and exist independently.
[0180] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable system. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.
[0181] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing systems. They can be centralized on a single computing system or distributed across a network of multiple computing systems. Optionally, they can be implemented using program code executable by a computing system, thereby storing them in a storage system for execution by the computing system. In some cases, the steps shown or described can be performed in a different order than those presented herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0182] Although the present invention has been described in detail above with general descriptions and specific embodiments, modifications or improvements can be made to it, which will be obvious to those skilled in the art. Therefore, all such modifications or improvements made without departing from the spirit of the present invention fall within the scope of protection claimed by the present invention.
Claims
1. A power flow analysis method for power grids based on the quotient gradient method and neural networks, characterized in that, include: The nonlinear algebraic equations for power flow calculation are transformed into ordinary differential equations based on the quotient gradient method. Based on the aforementioned ordinary differential equation, a physical information neural network model is constructed; the predicted values of the system state variables are output through the physical information neural network model. The ordinary differential equation is calculated using an ordinary differential equation solver to obtain the system state reference trajectory under the set operating conditions and generate a training dataset. Based on the predicted values of the system state variables and the training dataset, a composite loss function is defined; Based on the composite loss function, the physical information neural network model is iteratively trained using the backpropagation algorithm to obtain the trained physical information neural network model. The system parameters of the operating condition to be calculated and the set time to ensure that the system reaches steady state are input into the trained physical information neural network model, and the forward propagation algorithm is used to calculate and output the steady-state power flow solution of the operating condition to be calculated.
2. The power flow analysis method for power grids based on the quotient gradient method and neural networks according to claim 1, characterized in that, The expression for the ordinary differential equation is: In the formula, Let F(x,u) be the derivative of the state variable x with respect to time t, i.e., the rate of change of the state variable; J(x,u) is the Jacobian matrix of the power residual vector F(x,u) with respect to the state variable x; J T is the transpose of the Jacobian matrix; u is the known operating parameter of the system.
3. The power flow analysis method for power grids based on the quotient gradient method and neural networks according to claim 2, characterized in that, The composite loss function includes: data loss and physical loss; The formula for calculating the data loss is: In the formula, L data For data loss; N1 is the number of samples in the training dataset; t i x represents the time point of the i-th sample; NN (t i (u) represents the neural network at time point t. i The predicted state vector under operating parameters u; x data (t i (u) represents the corresponding reference trajectory data point, i.e., the real system state obtained under the same conditions through numerical integration or other methods; the symbol ||·|| represents the Euclidean norm; The formula for calculating the physical loss is: In the formula, L physics N1 represents the physical loss; N2 represents the number of sampling points used to calculate the physical loss. Let be the state derivative calculated by automatic differentiation, and be the rate of change of state predicted by the neural network. -J T (x NN (t i ,u),u)F(x NN (t i u),u) represents the rate of change of state calculated according to the quotient gradient theory; J T (x NN (t i ,u),u) are the Jacobian matrices calculated at the state points predicted by the neural network; F(x NN (t i ,u),u) are the corresponding power residual vectors; The expression for the composite loss function is: L total =α·L data +β·L physics In the formula, L total For the composite loss function; α≥0 is the weighting coefficient of the data prediction error loss term; β≥0 is the weighting coefficient of the physical consistency loss term.
4. The power flow analysis method for power grids based on the quotient gradient method and neural networks according to claim 3, characterized in that, The expression for the physical information neural network model is: In the formula, It is a deep neural network; Θ is the set of learnable neural network parameters, including the weight matrices and bias vectors of all layers in the network.
5. The power flow analysis method for power grids based on the quotient gradient method and neural networks according to claim 4, characterized in that, During the iterative training of the physical information neural network model using the backpropagation algorithm, the Adam optimizer is employed to minimize the composite loss function through the backpropagation algorithm, thereby completing the training.
6. A power flow analysis device based on the quotient gradient method and neural network, employing the power flow analysis method based on the quotient gradient method and neural network as described in any one of claims 1-5, characterized in that, include: The ordinary differential equation transformation module is used to transform the nonlinear algebraic equation system for power flow calculation into ordinary differential equations based on the quotient gradient method. The physical information neural network model construction module is used to construct a physical information neural network model based on the ordinary differential equation; and output the predicted values of the system state variables through the physical information neural network model. The training dataset generation module is used to calculate the ordinary differential equation through the ordinary differential equation solver, obtain the system state reference trajectory under the set working conditions, and generate the training dataset. The composite loss function definition module is used to define a composite loss function based on the predicted values of the system state variables and the training dataset. The physical information neural network model training module is used to iteratively train the physical information neural network model based on the composite loss function and through the backpropagation algorithm to obtain the trained physical information neural network model. The steady-state power flow solution calculation module is used to input the system parameters of the operating condition to be calculated and the set time to ensure that the system reaches steady state into the trained physical information neural network model, perform calculation through the forward propagation algorithm, and output the steady-state power flow solution of the operating condition to be calculated.
7. The power flow analysis device based on the quotient gradient method and neural network according to claim 6, characterized in that, In the ordinary differential equation transformation module, the expression of the ordinary differential equation is: In the formula, Let F(x,u) be the derivative of the state variable x with respect to time t, i.e., the rate of change of the state variable; J(x,u) is the Jacobian matrix of the power residual vector F(x,u) with respect to the state variable x; J T is the transpose of the Jacobian matrix; u is the known operating parameter of the system.
8. The power flow analysis device based on the quotient gradient method and neural network according to claim 7, characterized in that, In the composite loss function definition module, the composite loss function includes: data loss and physical loss; The formula for calculating the data loss is: In the formula, L data For data loss; N1 is the number of samples in the training dataset; t i x represents the time point of the i-th sample; NN (t i (u) represents the neural network at time point t. i The predicted state vector under operating parameters u; x data (t i (u) represents the corresponding reference trajectory data point, i.e., the real system state obtained under the same conditions through numerical integration or other methods; the symbol ||·|| represents the Euclidean norm; The formula for calculating the physical loss is: In the formula, L physics N1 represents the physical loss; N2 represents the number of sampling points used to calculate the physical loss. Let be the state derivative calculated by automatic differentiation, and be the rate of change of state predicted by the neural network. -J T (x NN (t i ,u),u)F(x NN (t i u),u) represents the rate of change of state calculated according to the quotient gradient theory; J(x NN (t i ,u),u) are the Jacobian matrices calculated at the state points predicted by the neural network; F(x NN (t i ,u),u) are the corresponding power residual vectors; The expression for the composite loss function is: L total =α·L data +β·L physics In the formula, L total For the composite loss function; α≥0 is the weighting coefficient of the data prediction error loss term; β≥0 is the weighting coefficient of the physical consistency loss term.
9. The power flow analysis device based on the quotient gradient method and neural network according to claim 8, characterized in that, In the physical information neural network model construction module, the expression of the physical information neural network model is: In the formula, It is a deep neural network; Θ is the set of learnable neural network parameters, including the weight matrices and bias vectors of all layers in the network.
10. The power flow analysis device based on the quotient gradient method and neural network according to claim 9, characterized in that, In the physical information neural network model training module, during the iterative training of the physical information neural network model using the backpropagation algorithm, the Adam optimizer is employed to minimize the composite loss function through the backpropagation algorithm, thereby completing the training.