Online Power Flow Calculation Method and Equipment Based on the Fusion of Graph Neural Networks and Large Models

By integrating graph neural networks and large language models, real-time power grid data is collected and power flow calculation configuration variables are intelligently adjusted, solving the efficiency and convergence problems of traditional power flow calculation in dynamic power grids, and realizing the intelligentization and stability improvement of power grid dispatch.

CN121456258BActive Publication Date: 2026-03-06STATE GRID ZHEJIANG ELECTRIC POWER CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610008015.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-06
Publication Date
2026-03-06
Estimated Expiration
2046-01-06

AI Technical Summary

Technical Problem

Traditional power flow calculations struggle to adapt to the uncertainties brought about by large-scale source-load access and dynamic changes in the power grid topology, resulting in low computational efficiency or non-convergence, which affects the accuracy and security of power grid dispatch.

Method used

By employing a method that integrates graph neural networks and large language models, the system collects power grid topology and measurement data in real time, calculates initial values ​​using graph neural networks, and adjusts power flow calculation configuration variables using large language models, thereby achieving automated and intelligent convergence adjustment.

Benefits of technology

It significantly improves the robustness and efficiency of power flow calculation, enabling online power flow calculation in scenarios with dynamic topology changes, thereby enhancing the intelligence level of power grid operation and the accuracy of scheduling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121456258B_ABST
    Figure CN121456258B_ABST
Patent Text Reader

Abstract

This invention provides a method and device for online power flow calculation in power grids that integrates graph neural networks and large-scale models, applicable to the field of smart grid technology. The invention constructs a real-time power grid operation dataset by collecting topology and measurement data in real time. This dataset is then input into a first graph neural network to calculate the voltage amplitude, voltage phase angle, and initial power values ​​of all nodes. Based on these initial values, a power flow calculation tool is invoked for calculation. If the result converges, the operating status is output; if not, the topology and status are input into a second graph neural network to extract topology and convergence feature vectors. These vectors are then combined with power flow configuration variables and input into a large-scale language model to obtain configuration adjustment amounts and update the variables. The power flow calculation is repeated until convergence or the maximum number of iterations is reached. An alarm is issued if convergence fails. This invention integrates the topology awareness capability of graph neural networks with the reasoning capability of large-scale language models, effectively improving the robustness and efficiency of power flow calculation and effectively meeting the complex operational needs of modern power grids.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of smart grid technology, and in particular to a method and device for online power flow calculation of power grids by fusing graph neural networks and large models. Background Technology

[0002] With the accelerated construction of new power systems, urban power grids are rapidly expanding, and new power sources such as distributed photovoltaics, electric vehicle charging stations, and user-side energy storage are being integrated in large numbers. Power grid operation is shifting from unidirectional flow to bidirectional interaction, and users are transforming from simple electricity consumers to integrated producers and consumers, making the power supply path increasingly complex. Simultaneously, society's demands for power supply reliability, power quality, and service quality are rising, and the goals of safe, economical, and low-carbon operation present new challenges for power dispatching. Power flow calculation, as a core tool for power grid dispatching, can accurately calculate node voltage and power status, providing a basis for safe and economical dispatching.

[0003] However, traditional power flow calculations struggle to adapt to the uncertainties brought about by large-scale source-load integration, and the dynamic changes in grid topology and the inaccuracy of component parameters exacerbate the problem, leading to reduced computational efficiency or even non-convergence. Non-convergence in online power flow calculations will severely impact scheduling accuracy and grid security and stability.

[0004] Therefore, how to improve the robustness and efficiency of power flow calculation to meet the needs of modern power grid operation has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] In view of the above problems, the present invention provides a method and device for online power flow calculation by fusing graph neural networks and large models to overcome or at least partially solve the above problems. The technical solution is as follows:

[0006] A method for online power flow calculation of power grids that integrates graph neural networks and large-scale models includes:

[0007] Real-time acquisition of power grid topology and measurement data to obtain real-time power grid operation dataset;

[0008] The real-time operation dataset of the power grid is input into a first graph neural network dedicated to calculating the initial values ​​of power flow, so as to obtain the initial values ​​of voltage amplitude, voltage phase angle, active power and reactive power of all nodes of the power grid.

[0009] Based on the initial values, the power flow calculation tool is invoked to perform power flow calculations and obtain the power flow calculation results.

[0010] Determine whether the power flow calculation results have converged. If they have converged, output the power grid operating status data.

[0011] If the power flow calculation results do not converge, the topology and measurement data are input into a second graph neural network dedicated to power flow convergence adjustment to obtain the topology feature vector and convergence feature vector of each node of the power grid.

[0012] The topological feature vector, the convergence feature vector, and the power flow calculation configuration variable are input into the large language model to obtain the adjustment amount of the power flow calculation configuration variable;

[0013] Update the current flow calculation configuration variable according to the adjustment amount, and call the current flow calculation tool again to perform current flow calculation;

[0014] If the power flow calculation result has converged after updating the power flow calculation configuration variables, then return to the step of collecting the topology and measurement data of the power grid in real time to obtain the real-time operation dataset of the power grid. If it still has not converged, then determine whether the preset maximum number of iterations has been reached. If not, then return to the step of inputting the topology and measurement data into the second graph neural network dedicated to power flow convergence adjustment to obtain the topology feature vector and convergence feature vector of each node of the power grid. If yes, then send an alarm message to the user.

[0015] A power flow online calculation device for a power grid that integrates a graph neural network and a large model includes: a power grid real-time operation dataset acquisition unit, a power grid node initial value acquisition unit, a first power flow calculation unit, a first convergence determination unit, a power grid operation status data output unit, a representation vector acquisition unit, a configuration variable adjustment amount acquisition unit, a second power flow calculation unit, a second convergence determination unit, an iteration number determination unit, and an alarm information sending unit.

[0016] The real-time power grid operation dataset acquisition unit is used to collect the topology and measurement data of the power grid in real time to obtain the real-time power grid operation dataset.

[0017] The power grid node initial value acquisition unit is used to input the real-time operation dataset of the power grid into a first graph neural network dedicated to power flow initial value calculation, and obtain the initial values ​​of voltage amplitude, voltage phase angle, active power and reactive power of all nodes of the power grid;

[0018] The first power flow calculation unit is used to call a power flow calculation tool to perform power flow calculation based on the initial value and obtain the power flow calculation result;

[0019] The first convergence determination unit is used to determine whether the power flow calculation result has converged. If it has converged, the power grid operation status data output unit is triggered. If it has not converged, the representation vector acquisition unit is triggered.

[0020] The power grid operation status data output unit is used to output power grid operation status data;

[0021] The representation vector acquisition unit is used to input the topology and measurement data into a second graph neural network dedicated to power flow convergence adjustment, and obtain the topology feature vector and convergence feature vector of each node of the power grid.

[0022] The configuration variable adjustment unit is used to input the topological feature vector, the convergence feature vector, and the power flow calculation configuration variable into the large language model to obtain the adjustment amount of the power flow calculation configuration variable;

[0023] The second current flow calculation unit is used to update the current flow calculation configuration variable according to the adjustment amount, and call the current flow calculation tool again to perform current flow calculation;

[0024] The second convergence determination unit is used to determine whether the power flow calculation result after updating the power flow calculation configuration variable has converged. If it has converged, the power grid real-time operation dataset acquisition unit is triggered. If it still has not converged, the iteration number determination unit is triggered.

[0025] The iteration count determination unit is used to determine whether the preset maximum iteration count has been reached. If not, the representation vector acquisition unit is triggered; if yes, the alarm information sending unit is triggered.

[0026] The alarm information sending unit is used to send alarm information to the user.

[0027] A computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the online power flow calculation method for fusing graph neural networks and large models.

[0028] An electronic device includes at least one processor, at least one memory connected to the processor, and a bus; wherein the processor and the memory communicate with each other via the bus; the processor is used to call program instructions in the memory to execute the online power flow calculation method of the fusion of graph neural network and large model.

[0029] By employing the above technical solution, the power flow online calculation method and device for power grids, which integrates graph neural networks and large-scale models, provided by this invention, constructs a real-time power grid operation dataset by collecting topology and measurement data in real time. This dataset is then input into a first graph neural network to calculate the voltage amplitude, voltage phase angle, and initial power values ​​of all nodes. Based on these initial values, a power flow calculation tool is invoked for calculation. If the result converges, the operating status is output; if it does not converge, the topology and status are input into a second graph neural network to extract topology and convergence feature vectors. These vectors are then combined with power flow configuration variables and input into a large-scale language model to obtain configuration adjustment amounts and update the variables. The power flow calculation is repeated until convergence or the maximum number of iterations is reached. An alarm is issued if convergence fails. This invention calculates initial power flow values ​​by embedding graph neural networks with the topology and measurement data of the power grid, thereby improving the efficiency of iterative calculations. By combining the topology perception capability of graph neural networks with the understanding and reasoning capabilities of large language models, it identifies and adjusts convergence problems in power grid power flow calculation, significantly improving the robustness and efficiency of power flow calculation. It enables online power flow calculation in scenarios with dynamic topology changes, providing assistance to power grid operators, enhancing the intelligence level of power grid power flow calculation, and meeting the needs of modern power grid dynamic and complex operation.

[0030] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0031] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0032] Figure 1 This illustration shows a flowchart of one implementation of the online power flow calculation method for fusing graph neural networks and large models provided by an embodiment of the present invention;

[0033] Figure 2 This is a flowchart illustrating a specific implementation of step S101 in the online power flow calculation method for the fusion of graph neural networks and large models provided in an embodiment of the present invention.

[0034] Figure 3 A schematic diagram of the structure of the online power flow calculation device for the fusion of graph neural network and large model provided in an embodiment of the present invention is shown. Detailed Implementation

[0035] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this invention will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.

[0036] With the accelerated construction of new power systems, modern large-scale urban power grids are undergoing an unprecedented transformation towards large-scale and active power generation. On the one hand, with the continuous growth of urban electricity demand, the power grid is expanding rapidly, and the number of substations, lines, and other equipment is increasing explosively. However, the number and professional capabilities of power dispatching and maintenance personnel are not keeping pace, leading to an increasingly prominent contradiction between personnel capacity and equipment expansion. On the other hand, the large-scale integration of new power sources and loads such as distributed photovoltaic power generation, electric vehicle charging piles, and user-side energy storage has changed the operating characteristics of traditional distribution networks. The power flow pattern has shifted from unidirectional to bidirectional "source-load interaction," and users are gradually changing from simple electricity consumers to integrated producers and consumers. Furthermore, more and more users are participating in grid regulation, making the power supply path increasingly complex. Simultaneously, society's demands for power supply reliability, power quality, and service quality are constantly increasing. Coupled with the comprehensive operational goals of safety, economy, and low carbon emissions, this presents new and severe challenges for power grid operation and dispatch.

[0037] Power flow calculation, as a core analytical tool for power grid operation and dispatch, can accurately calculate key parameters such as voltage and branch power at each node of the power grid, predict the electrical behavior of the power grid under different operating modes, and provide important decision-making basis for dispatchers to formulate safe, economical, and reliable dispatch plans. It is the foundation for ensuring the stable and reliable operation of the power grid. For example, in large ring networks, the active power and voltage amplitude of generator nodes, the active power and reactive power of load nodes, and the voltage amplitude and voltage phase angle of slack nodes are usually known; in radial networks, the voltage amplitude and voltage phase angle of the starting nodes and the active power and reactive power of the ending nodes are usually known.

[0038] However, traditional power flow calculations struggle to effectively address the significant uncertainties brought about by large-scale source-load integration. The output of distributed photovoltaic power generation fluctuates significantly due to natural factors such as sunlight and temperature; the charging behavior of charging piles is random, influenced by users' travel habits; and the charging and discharging strategies of energy storage devices are linked to various factors such as electricity prices and grid load. The large-scale application of these new source-load technologies makes the grid's operating status highly uncertain.

[0039] Furthermore, the real-time dynamic changes in the power grid topology pose a significant challenge to traditional power flow calculations. The rapid expansion of the power grid scale leads to continuous iteration of the topology structure, and frequent network reconfigurations occur in scenarios such as fault handling, planned maintenance, and load transfer, resulting in the power grid topology (especially the distribution network topology) being in a state of dynamic change.

[0040] Meanwhile, the inaccuracy of power grid component parameter models is becoming increasingly prominent. Due to the diversification of new source and load equipment types, the variety of power grid equipment has increased significantly, and factors such as aging parameters of old equipment and measurement errors of newly added equipment parameters make it difficult to guarantee the accuracy of the overall power grid parameter model.

[0041] The aforementioned problems directly lead to a core bottleneck in traditional power flow calculation: low computational efficiency or non-convergence. Online power flow calculation, using real-time power grid measurement data as input, calculates the current and short-term future operating status of the power grid, serving as a crucial foundation for modern real-time power grid dispatching. If non-convergence or unsolvable conditions occur, dispatchers will be unable to accurately grasp the power grid's operating status, resulting in insufficient precision in dispatching decisions. This hinders the achievement of multi-objective optimization goals, including safety, economy, and low carbon emissions, and in severe cases, may even lead to equipment damage, power outages, and other safety incidents.

[0042] Power flow calculation is essentially a process of solving large-scale nonlinear equations. Traditional methods, such as the Newton-Raphson method, rely heavily on initial value selection, the quality of which directly affects the algorithm's convergence and speed. Good initial values ​​approximate the true solution and accelerate convergence, while inappropriate initial values ​​can lead to iterative path deviations or even non-convergence. To meet the real-time requirements of online power flow calculation, initial value selection must be optimized to improve efficiency. Although classical iterative algorithms face efficiency challenges in large-scale complex network calculations, they remain the mainstream in engineering applications due to their clear mathematical and physical foundations. In contrast, pure artificial intelligence methods, due to insufficient interpretability, are still difficult to gain widespread trust. This invention employs a PowerInjection Graph Neural Network (PIGNN) embedded with power flow electrical quantities to calculate initial values, combined with classical iterative algorithms, to improve the efficiency of online power flow calculation. Non-convergence in power flow calculation is often caused by factors such as abnormal active or reactive power output, unreasonable transformer ratios, and line parameters. Current methods rely on empirical adjustments, resulting in low efficiency and insufficient real-time performance. In recent years, Large Language Models (LLMs) have been used in the power sector to enhance understanding and reasoning capabilities through professional fine-tuning, potentially aiding in convergence optimization. However, their ability to handle dynamic graph structures is limited, making it difficult to cope with dynamic changes in power grid topology, especially in distribution networks. Graph Neural Networks (GNNs) excel at processing graph-structured data. This invention innovatively combines GNNs and LLMs to address the convergence problem in power flow calculations under dynamic topology environments, achieving automated and intelligent tuning to improve convergence rate and adaptability.

[0043] Based on this, embodiments of the present invention provide an online power flow calculation method for power grids that integrates graph neural networks and large language models. By fusing graph neural networks and large language models in online power flow calculation, automatic convergence adjustment of power flow calculations is achieved. By specifically training the graph neural network and large language model for convergence adjustment, the advantages of graph neural networks in topology perception are fully utilized, combined with the powerful understanding and reasoning capabilities of large language models, to achieve real-time identification and dynamic adjustment of convergence problems during power flow calculations. Simultaneously, this technology possesses good adaptability to topology changes and can cope with dynamic adjustments to the power grid structure. Furthermore, the present invention also includes training methods for the graph neural network and large language model used, ensuring model performance and application effectiveness.

[0044] like Figure 1 The diagram shows a flowchart of one embodiment of the online power flow calculation method for integrating graph neural networks and large models provided by this invention. The method may include:

[0045] S100: Real-time acquisition of power grid topology and measurement data to obtain real-time power grid operation dataset.

[0046] In this context, topology refers to the connection relationships and layout of various components in a power grid (such as buses, generators, transformers, lines, and loads), reflecting the physical connections and network structure of the power grid.

[0047] Among them, the measurement data refers to the real-time collected power grid operation parameter data, including node voltage, current, active power, reactive power, etc., which are used to reflect the current actual operating status of the power grid.

[0048] The real-time power grid operation dataset consists of real-time collected power grid measurement data and topology information. It is a comprehensive data set reflecting the current state of the power grid, and comprehensively describes the operating status and structural information of the power grid at a certain moment. It is used as input for calculation models and algorithms.

[0049] Specifically, embodiments of the present invention can use sensors and measuring devices deployed at key nodes of the power grid to collect electrical parameters such as node voltage, current, active power, and reactive power, as well as the topology information of the power grid in real time. These data are then integrated to form a real-time operating dataset that reflects the current state of the power grid, providing basic input for subsequent power flow calculations.

[0050] As examples, embodiments of the present invention can acquire two types of core data in real time through remote terminal units (RTUs), phasor measurement units (PMUs), and energy management systems (EMS) deployed in the power grid: first, the power grid topology, i.e., the on / off states of circuit breakers and disconnectors, to determine the actual connection relationships of components such as buses, lines, transformers, generators, and loads, forming the network structure; second, measurement data, including the voltage amplitude of nodes, injected active and reactive power, and real-time operating electrical quantities such as line power flow. Integrating these data constitutes a real-time power grid operation dataset for subsequent analysis.

[0051] S101. Input the real-time operation dataset of the power grid into the first graph neural network dedicated to calculating the initial value of power flow, and obtain the initial values ​​of voltage amplitude, voltage phase angle, active power and reactive power of all nodes in the power grid.

[0052] The first graph neural network refers to a dedicated graph neural network for calculating initial power flow values. By utilizing the electrical quantities and topology information of the power grid nodes, it simulates the iterative calculation process to generate initial power flow values ​​for voltage amplitude, voltage phase angle, active power, and reactive power for all nodes in the power grid.

[0053] Voltage amplitude refers to the magnitude of the node voltage in the power grid, reflecting the strength of the node voltage.

[0054] The voltage phase angle refers to the phase angle of the node voltage in the power grid, which represents the phase difference between the voltage waveform and the reference waveform.

[0055] Active power refers to the power actually consumed or generated by nodes in the power grid, representing the portion of electrical energy converted into mechanical energy, heat energy, etc.

[0056] Reactive power refers to the reactive power generated or consumed by nodes in the power grid. It is related to the exchange of energy between electric and magnetic fields and affects voltage stability.

[0057] Specifically, in this embodiment of the invention, the collected real-time electrical quantities and topology information can be constructed into a graph structure, which is then input into a pre-trained power flow initial value calculation graph neural network, i.e., the first graph neural network. The first graph neural network, through simulating the iterative calculation process, fuses node features and edge features to predict and output the initial values ​​of voltage magnitude, phase angle, and power of all nodes, providing an accurate starting point for subsequent power flow calculations.

[0058] S102. Based on the initial values, call the power flow calculation tool to perform power flow calculation and obtain the power flow calculation results.

[0059] Power flow calculation tools refer to the software or algorithms used to calculate the power flow distribution in a power grid, enabling power flow solutions based on given initial values ​​and network parameters. For example, mathematical methods for power flow calculation can include the Newton-Raphson method, PQ decomposition, and forward-backward substitution. Power flow calculation tools can include BPA, PSASP, Pandapower, and MatPower.

[0060] Among them, the power flow calculation results are the power grid electrical quantity distribution results output by the power flow calculation tool, including the voltage amplitude, voltage phase angle and power flow of each node.

[0061] Specifically, in this embodiment of the invention, the obtained initial value can be used as input to call professional power flow calculation software or algorithm to perform power flow solution of the power system, calculate the voltage, current and power distribution of the entire power grid, and output the power flow calculation results.

[0062] As examples, embodiments of the present invention can use the initial values ​​of voltage magnitude, voltage phase angle, active power, and reactive power of all nodes as a starting point, and input them into a conventional power flow calculation tool (such as a calculation program based on the Newton-Raphson method or the fast decoupling method). This tool performs precise iterative solutions based on the grid admittance matrix and power balance equations, ultimately outputting complete power flow calculation results, including the final voltage magnitude, phase angle, and power distribution of all nodes.

[0063] S103. Determine whether the power flow calculation results have converged. If yes, proceed to step S104; otherwise, proceed to step S105.

[0064] S104, Output power grid operation status data.

[0065] Among them, power grid operation status data refers to the electrical status data of each node and device of the power grid obtained after the power flow calculation converges, which is used for monitoring, analysis and other power system applications.

[0066] Specifically, in this embodiment of the invention, the convergence criterion can be determined based on the error index of the power flow calculation results. If the criterion is met, the calculation is confirmed to be valid, and detailed operating status data of the current power grid is output, which can be used for monitoring, analysis, and other applications.

[0067] As examples, the power flow calculation tool provided in this embodiment of the invention will provide a convergence status flag after completing the calculation. The program judges this flag: if the result is converged, it indicates that the current power grid model is physically balanced, and the calculated grid operating status data such as node voltages and line power are valid. This data will be output for subsequent advanced applications such as state estimation, risk assessment, and visualization.

[0068] S105. Input the topology and measurement data into the second graph neural network dedicated to power flow convergence adjustment to obtain the topology feature vector and convergence feature vector of each node in the power grid.

[0069] The second graph neural network refers to a dedicated graph neural network for power flow convergence adjustment, which is specifically designed to help solve the problem of non-convergence in power flow calculation. By inputting power grid topology and state data, it outputs the topological feature vector and convergence feature vector of each node to assist in subsequent adjustments.

[0070] In this context, topological feature vectors refer to vectors that abstractly represent the location, connection relationships, and functions of nodes within the power grid topology. Examples include feature descriptions of hub nodes or end-load nodes.

[0071] Among them, the convergence feature vector refers to the role and characteristics of a node in the power flow convergence adjustment process, such as whether adjusting a certain node can effectively promote power flow convergence.

[0072] Specifically, in this embodiment of the invention, the current power grid topology and measurement data can be converted into a graph structure and input into a dedicated graph neural network for power flow convergence adjustment, namely the second graph neural network. The second graph neural network combines the topology and measurement data to extract the topological feature vector and convergence feature vector of each node, providing key features for intelligent adjustment.

[0073] As examples, embodiments of the present invention can construct a heterogeneous graph (node ​​types include buses, generators, loads, etc., and edges represent connections) from the original collected power flow calculation results when the power flow calculation results do not converge. This heterogeneous graph is then input into a pre-trained second graph neural network. The second graph neural network, through graph learning techniques, outputs two highly abstract feature vectors for each node: a topological feature vector and a convergence feature vector.

[0074] S106. Input the topological feature vector, convergence feature vector, and power flow calculation configuration variable into the large language model to obtain the adjustment amount of the power flow calculation configuration variable.

[0075] Among them, power flow calculation configuration variables refer to the parameters that can be adjusted in power flow calculation, such as the active power and voltage amplitude of generators, the reactive power injection of reactive power compensation devices, etc. Adjusting these variables helps to solve the non-convergence problem.

[0076] Among them, the large language model is a natural language processing model based on deep learning, which has powerful understanding and reasoning capabilities. It is used to combine topological feature vectors, convergent feature vectors and current power flow calculation configuration variables to intelligently generate adjustment suggestions for power flow calculation configuration variables.

[0077] Specifically, in this embodiment of the invention, the topological feature vector and convergence feature vector output by the graph neural network can be combined with the configuration variables and task prompt words in the current power flow calculation and input into a pre-trained and reinforcement learning optimized large language model. Based on its comprehensive understanding and reasoning ability, the large language model outputs specific adjustment suggestions for the configuration variables (such as adjustment magnitude and direction).

[0078] As examples, embodiments of the present invention can organize the topological feature vector and convergence feature vector of each node, along with the values ​​of currently adjustable configuration variables and prompts describing the current task (such as "The power flow is not converging, please adjust the configuration variables to make it converge"), into the input of a large language model. After analyzing this information, the specially trained large language model outputs specific adjustment suggestions, which can be expressed in natural language or structured instructions, such as "Increase the voltage setting of generator G1 by 5%".

[0079] S107. Update the power flow calculation configuration variables according to the adjustment amount, and call the power flow calculation tool again to perform power flow calculation.

[0080] Specifically, in this embodiment of the invention, the relevant configuration parameters in the power flow calculation can be updated according to the adjustment scheme given by the large language model, and then the power flow calculation tool can be called again to try to solve the power flow again.

[0081] As examples, embodiments of the present invention update the corresponding configuration variables in the power flow calculation tool by parsing the adjustment suggestions output by the large language model and converting them into numerical instructions. For example, the voltage setting value of generator G1 is updated from 1.02 to 1.02. (1+5%)=1.071. Then, based on the updated configuration variables, the power flow calculation tool used before is called again to perform a new round of power flow calculation.

[0082] S108. Determine whether the power flow calculation result has converged after updating the power flow calculation configuration variables. If yes, return to step S100; otherwise, proceed to step S109.

[0083] Specifically, in this embodiment of the invention, the convergence of the new round of power flow calculation results can be checked again. If convergence is achieved this time, it indicates that the adjustment was successful, the normal analysis process is restored, and the process will return to S100 to start processing the new data at the next moment. If convergence is still not achieved, the process proceeds to the next judgment step S109.

[0084] S109. Determine whether the preset maximum number of iterations has been reached. If not, return to step S105. If yes, proceed to step S110.

[0085] Specifically, in this embodiment of the invention, it can determine whether the number of adjustment iterations already performed exceeds a preset maximum number. If not, it loops back to S105 and continues to adjust using the graph neural network and large language model; if the limit is reached, it prepares to send an alarm.

[0086] As examples, embodiments of the present invention may maintain a counter to record the number of times the adjustment-recalculation loop has been executed since the current power flow calculation failed to converge. This number is compared with a preset maximum number of iterations (e.g., 5 or 10). If the maximum number has not been reached, the process returns to S105 to attempt a new round of feature extraction and adjustment based on the latest power grid state. If the maximum number has been reached or exceeded, the process proceeds to S110.

[0087] S110, Send alarm information to the user.

[0088] Among them, alarm information refers to the warning information sent by the system to the user when the power flow calculation fails to converge after reaching the maximum number of iterations, which is used to indicate the potential power grid operation risk or the need for manual intervention.

[0089] Specifically, in this embodiment of the invention, if the power flow calculation fails to converge after multiple adjustments, an alarm message will be automatically generated and notified to the operation and maintenance personnel via a monitoring platform, SMS, or email, indicating that there may be a power grid abnormality or calculation abnormality, requiring manual intervention.

[0090] As examples, embodiments of the present invention can determine that automatic adjustment has failed when the power flow cannot converge even after the maximum number of adjustment cycles, and generate and send an alarm message to the power grid dispatcher or engineer. The alarm message will clearly indicate that the power flow calculation continues to fail to converge, suggesting that manual intervention is needed for more in-depth fault diagnosis or other intervention measures.

[0091] This invention provides an online power flow calculation method for power grids that integrates graph neural networks and large-scale models. The method involves embedding graph neural networks with power grid topology and measurement data to calculate initial power flow values, improving iterative calculation efficiency. Furthermore, by combining the topology awareness of graph neural networks with the reasoning capabilities of large-scale models, convergence problems in power flow calculation are identified and addressed, significantly enhancing the robustness and efficiency of power flow calculation. This enables online power flow calculation in scenarios with dynamic topology changes, providing assistance to power grid operators, improving the intelligence level of power flow calculation services, and meeting the needs of modern power grid dynamic and complex operations.

[0092] Optional, based on Figure 1 The method shown is as follows: Figure 2The diagram shows a specific implementation of step S101 in the online power flow calculation method for the fusion of graph neural networks and large models provided in this embodiment of the invention. Step S101 may specifically include:

[0093] S200: Based on the real-time operation dataset of the power grid, initialize the voltage amplitude, voltage phase angle, active power and reactive power of all nodes in the power grid.

[0094] Specifically, in this embodiment of the invention, the collected real-time power grid operation dataset can be preprocessed to extract the measurement data and related parameters of each node. Based on the power grid structure and equipment type, an initial voltage amplitude and voltage phase angle are assigned to each node. Simultaneously, the active and reactive power of each node are initialized based on measurement information or set values ​​to serve as the starting state for subsequent power flow calculations.

[0095] As examples, embodiments of the present invention can initialize electrical quantities of all nodes based on a real-time power grid operation dataset: for load nodes, their active power... and reactive power The initial value is set to the measured or given value. ), voltage amplitude and voltage phase angle Typically set to a standard value or an estimated value based on historical data; for voltage control nodes, its voltage amplitude... and / or phase angle The power is initialized to the estimated value, set to the setpoint. This yields the initial state vector for all nodes. ), where the superscript k=0 indicates the 0th iteration.

[0096] S210. Input the voltage amplitude, voltage phase angle, active power and reactive power into the first graph neural network dedicated to calculating the initial value of power flow, and calculate the correction values ​​of voltage amplitude and voltage phase angle.

[0097] Specifically, in the later embodiments of the present invention, the voltage magnitude, voltage phase angle, active power, and reactive power of all nodes, along with the given target values ​​and network topology parameters, can be input into a pre-trained first graph neural network dedicated to calculating the initial power flow values. The first graph neural network utilizes the feature information of nodes and edges to perform feature fusion and depth calculation, outputting corrected values ​​for the voltage magnitude and phase angle of each node, preparing for the next round of updates.

[0098] As some examples, embodiments of the present invention can represent the state vectors of all nodes in the current round k ( ) and power setpoint ( and nodal admittance matrix The input is fed into a pre-trained first graph neural network. This first graph neural network, based on the graph's topology and the current state of the nodes, utilizes its internal multi-layer perceptual mechanism (including the use of trainable matrices) to... , , Calculate the attention coefficient between nodes and trend contribution value A correction value is calculated for each node, and the final output is the voltage amplitude correction value for all nodes. and voltage phase angle correction value ,Right now: .

[0099] in, For the first Voltage amplitude at the wheel node; For the first The voltage phase angle at the wheel node; For the first Active power of the wheel node; For the first Reactive power of the wheel node; The set value for active power, This is the set value for reactive power; Here is the nodal admittance matrix; This is a correction value for the voltage amplitude; This is the correction value for the voltage phase angle. It's important to note that there are no subscripts in the formula, so each quantity represents a known or unknown parameter of the entire network, for example... This represents the voltage amplitude of all nodes.

[0100] S220. Update the voltage amplitude and voltage phase angle according to the correction value, and recalculate the active power and reactive power.

[0101] Specifically, in this embodiment of the invention, the voltage amplitude and phase angle of all nodes can be adjusted one by one according to the correction value output by the graph neural network. After adjustment, the active power and reactive power of each node are recalculated according to the power flow equation and node parameters to ensure that the data is updated synchronously with the node status, thus preparing for the next step of residual judgment.

[0102] As examples, embodiments of the present invention can use the correction value calculated in step S210 to update the current node voltage state: = + , = + Then, based on the updated voltage amplitude... and phase angle Using nodal admittance matrix Recalculate the injected active power at each node. and reactive power Thus, a new round of The complete state vector ( ).

[0103] S230. Calculate the residuals between the updated active power and reactive power and the set values.

[0104] Specifically, in this embodiment of the invention, the newly calculated active and reactive power in the current round can be compared with the set target value to calculate the residual. The residual can be expressed using indicators such as mean square error, reflecting the deviation between the node state and the target value, and providing a basis for determining whether convergence has occurred.

[0105] As some examples, embodiments of the present invention can recalculate the power value ( ) and the known power setpoint or measurement value ( The power residuals of all nodes are compared and calculated. Typically, the sum of squares of the active power residuals and the sum of squares of the reactive power residuals of all nodes are calculated, or their mean square errors are calculated, as criteria for judging the convergence of the current iteration.

[0106] S240. Determine whether the residual meets the accuracy requirements. If not, proceed to step S250. If yes, proceed to step S260.

[0107] Specifically, in this embodiment of the invention, a preset accuracy standard (such as residuals less than a certain threshold) can be used to determine whether the current power flow calculation has met the convergence requirements. If the residuals do not meet the standard, it means that the calculation results need to be further iterated and proceed to the next step of judgment; if the standard has been met, the current result can be considered valid and the initial value can be prepared for output.

[0108] S250. Determine whether the specified number of iterations has been reached. If yes, proceed to step S260. If no, return to step S210.

[0109] Specifically, in this embodiment of the invention, when the residual does not meet the requirements, it is necessary to determine whether the number of iterations has exceeded the set upper limit. If the number of iterations has been reached, the current result is directly used as the initial value, and optimization is no longer continued; if the number of iterations has not been reached, the loop continues, the updated data is input into the graph neural network, and a new round of correction and calculation is carried out, that is, using the currently updated state vector ( As a new round The first graph is the input for the neural network calculation, and the process continues to iterate and optimize.

[0110] S260 outputs the current voltage amplitude, voltage phase angle, active power, and reactive power as initial values.

[0111] When the accuracy requirement of S240 is met or the maximum number of iterations of S250 is reached, the state vectors of voltage magnitude, voltage phase angle, active power, and reactive power of all nodes calculated in the current round are used. The output value is used as the initial value for power flow calculation and provided to the power flow calculation tool in S120 to initiate accurate power flow calculation.

[0112] In this embodiment of the invention, the real-time operation dataset of the power grid is input into a first graph neural network dedicated to the calculation of the initial power flow value. By iteratively updating the voltage amplitude, voltage phase angle, and power, the residuals of active and reactive power with the set values ​​are continuously reduced. This can effectively improve the accuracy and stability of the initial power flow value, which is conducive to improving the convergence speed and accuracy of subsequent power flow calculations, reducing the consumption of computing resources, enhancing the real-time monitoring capability of the power grid operation status, and thus ensuring the safe and stable operation of the power system.

[0113] Optionally, in the above Figure 1 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, the training process of the first graph neural network may include:

[0114] Construct a first training dataset, which includes multiple first training samples. Each first training sample includes the topology, measurement data, and corresponding active and reactive power. Initialize the model parameters of the first graph neural network, including the number of node features, the number of multi-sensor layers, and the weight matrix of each layer. For each node in the first training samples: fuse node features with power flow electrical quantities to obtain a fused feature vector. For each edge in the first training samples, use the mutual admittance value in the node admittance matrix as the edge feature. In each layer of the multi-sensor layer, calculate the edge power flow perception coefficient and edge power flow contribution coefficient of each node, and summarize them to obtain the power flow contribution value of a single layer. Summarize the power flow contribution values ​​of all layers to obtain the total power flow contribution value, and update the node features. Calculate the mean square error loss between the active and reactive power and the set values ​​during the iteration process. To minimize the mean square error loss, use the gradient descent algorithm to update the model parameters until the first graph neural network converges.

[0115] Specifically, embodiments of the present invention can pre-collect a large amount of power grid operation data, including power grid topology under different operating conditions and corresponding real-time measurement data. Each training sample contains complete node connection relationships, component parameters, and electrical quantities such as node voltage amplitude, voltage phase angle, active power, and reactive power. The data is cleaned and formatted to ensure accuracy and suitability for the input requirements of the graph neural network model, forming a structured training dataset.

[0116] Specifically, embodiments of the present invention can determine the number of node features. Number of layers in a multi-sensory layer And the weight matrix required for each layer (such as the self-current perception matrix). Neighbor perception matrix Trend Contribution Matrix These parameters are typically initialized randomly or based on pre-trained weights to prepare for subsequent training.

[0117] As examples, embodiments of the present invention can set hyperparameters of the model, such as initial feature vectors of nodes. Dimensions Number of layers in a multi-sensory layer and the matrix in each layer , and Hidden layer dimensions * Then, the trainable parameters of these models are initialized. It is important to note that for each layer... , and These are independent parameters.

[0118] Specifically, in this embodiment of the invention, for each node, its inherent node characteristics can be compared with the voltage amplitude of the current iteration round. Voltage phase angle Active power reactive power and the given target power , The features are spliced ​​and merged to form a fused feature vector. This fusion process ensures that node characteristics include both topological information and dynamic electrical state information.

[0119] As examples, embodiments of the present invention apply to each node in the training samples. , its current model internal node features The fused feature vector is obtained by concatenating and fusing the known electrical quantities of the node in the current training samples. :

[0120] .

[0121] Specifically, embodiments of the present invention can, based on the power grid topology and component parameters, obtain the node admittance matrix. Extract each pair of nodes and mutual admittance values As a feature of the corresponding edge ,Right now . It reflects the electrical characteristics of the line, providing a physical basis for the transmission of edge information in graph neural networks.

[0122] Specifically, in each perception layer, the weight matrix of the current layer can be used. and For nodes and its neighboring nodes The fused feature vectors are linearly transformed and multiplied by a dot product, combined with edge features. Calculate the edge power flow perception coefficient Subsequently, on The side power flow contribution coefficient is obtained by performing softmax normalization. Finally, based on the contribution coefficient and the power flow contribution matrix Calculate the nodes of this layer Trend contribution value .

[0123] As some examples, embodiments of the present invention can be applied to each sensing layer l (from layer 1 to layer 2). Each layer independently performs message-passing computations. traverse all its neighbor nodes Calculate the edge power flow perception coefficient for each edge. :

[0124] ,

[0125] in, It is a proportional constant.

[0126] compute nodes The edge power flow contribution coefficient for each edge :

[0127] ,

[0128] node Single-layer power flow contribution value :

[0129] .

[0130] Specifically, in embodiments of the present invention, the node contribution values ​​calculated by each layer in the multi-sensing layer can be used. Multiply by layer weight The summation is then performed to obtain the total power flow contribution value of node i. . use For nodes Node features The feature mapping is updated to complete one iteration, providing input for the next iteration.

[0131] As some examples, for each node i, the total power flow contribution value of all multi-sensor layers is summarized as follows:

[0132]

[0133] in, These are the weights of each layer, which are variable parameters that the network model can train.

[0134] In the In the round of calculation, based on the total power tidal contribution value Node features Update.

[0135] Specifically, in this embodiment of the invention, the active power of each node in each iteration round can be accumulated during the training process. and reactive power Rather than setting target values , The mean squared error between the two parameters is used as the loss function. The gradient of the loss function with respect to the model parameters is calculated using the backpropagation algorithm. The model parameters are iteratively updated using optimization algorithms such as gradient descent until the loss function converges to a preset threshold, thus completing the training of the graph neural network.

[0136] As examples, the mean square error between the active power and reactive power in each iteration during the cumulative iteration process and a given value is used as the loss value. :

[0137]

[0138] With the goal of minimizing the aforementioned loss value, a graph neural network is trained to obtain a graph neural network specifically for calculating the initial value of power flow.

[0139] This invention constructs a training set containing rich real topology and measurement data, and combines a multi-layered, multi-sensor mechanism. The first graph neural network can effectively fuse node features and power flow electrical quantity information to accurately capture the complex topology and physical relationships of the power grid. Based on the optimization objective of the mean square error loss function, the gradient descent algorithm is used to iteratively update the model parameters to ensure that the network learns accurate voltage amplitude, voltage phase angle, and power correction rules. This significantly improves the estimation accuracy and stability of the initial power flow value, promotes the rapid convergence and efficient operation of subsequent power flow calculations, and enhances the reliability and intelligence level of real-time power grid state estimation and operation scheduling.

[0140] Optionally, in the above Figure 1 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, the training process of the second graph neural network may include:

[0141] A second training dataset is constructed, comprising multiple second training samples. Each second training sample includes a topology, measurement data, power flow convergence results, and corresponding configuration variable adjustment values. The topology and measurement data of each second training sample are converted into a heterogeneous graph structure, where grid components are nodes, connections are edges, and component parameters are node attributes. The heterogeneous graph is input into a dedicated second graph neural network for power flow convergence adjustment. Unsupervised learning is used to generate topological feature vectors, ensuring that nodes with similar topologies are close together in the vector space. Based on the configuration variable adjustment values, supervised learning training is performed on the second graph neural network, causing nodes with significant impact on power flow convergence to cluster in the convergence feature vector space. The generation process of the topological feature vectors and convergence feature vectors is jointly optimized until the second graph neural network converges.

[0142] Specifically, embodiments of the present invention can collect a large amount of power grid operation data, including power grid topology and real-time measurement data under different operating conditions, and simultaneously record whether the power flow calculation for each sample converges and the corresponding configuration variable adjustment scheme. The data is then processed to ensure completeness and accurate labeling of the data samples, constructing a training dataset that includes both convergent and non-convergent cases.

[0143] Power grid components may include buses, generators, loads, lines, and transformers.

[0144] The component parameters can include voltage amplitude, active power, reactive power, and impedance, etc.

[0145] Specifically, in each training sample, based on the physical connection relationship of the power grid, different types of components are used as different types of nodes in the heterogeneous graph. Edges are constructed using the electrical connection relationship between components, and the node attributes include their electrical parameters. This achieves accurate conversion of power grid information from raw data to graph structure, supporting the input requirements of graph neural networks.

[0146] As examples, embodiments of the present invention can construct a heterogeneous graph for a training sample. Nodes in the heterogeneous graph are no longer simply buses, but are expanded to include nodes of different types of physical components, such as generator nodes, load nodes, bus nodes, line / transformer branch nodes, reactive power compensation device nodes, etc. Edges between nodes are established based on actual physical connections; for example, generator nodes are connected to their respective bus nodes, and bus nodes are interconnected through line / transformer branch nodes. Each node carries its own attributes; for example, generator node attributes include rated capacity, current active power output, and voltage setpoint; load node attributes include active / reactive power demand; line node attributes include resistance and reactance, etc.

[0147] Specifically, embodiments of the present invention can utilize unsupervised learning methods (such as autoencoders, contrastive learning, etc.) to train the input heterogeneous graph and learn the topological feature vector of each node. The training objective is to maximize the vector similarity of nodes with similar structures and minimize the vector similarity of nodes of different categories or those that are far apart, ensuring that the feature vectors can effectively reflect the position and connection relationships of nodes in the power grid topology.

[0148] As examples, embodiments of the present invention can input the constructed heterogeneous graph into a second graph neural network. A core task of the second graph neural network is to learn to generate the topological feature vector for each node. This part of the training employs an unsupervised learning paradigm. The goal is that, in the generated topological feature vector space, nodes that play similar roles in the original power grid topology (e.g., all are inter-regional tie-line nodes, all are pure load nodes at the network end, all are main power supply access points) or have similar connection patterns should have vector representations that are close to each other (small Euclidean distance or high cosine similarity); conversely, nodes with different functions or locations should have vector representations that are far apart.

[0149] Specifically, embodiments of the present invention can utilize training samples with configuration variables to adjust labels, and employ supervised learning to train the convergent feature vector output layer of a graph neural network. The training objective is to ensure that the convergent feature vectors of nodes that significantly influence power flow convergence form discriminative clusters in the vector space, thereby helping to identify key nodes and providing an effective representation foundation for subsequent large-scale language models.

[0150] As examples, another core task of the second graph neural network provided in this embodiment of the invention is to learn to generate convergence feature vectors for each node. This part of the training adopts a supervised learning paradigm, with the supervision signal coming from the "configuration variable adjustment values" of non-converging samples in the second training dataset. The goal is that for nodes that are frequently adjusted in historical adjustment schemes, or whose adjustments are critical and effective in solving the power flow non-convergence problem (e.g., a generator with strong voltage support capability, or a load on a critical section of an overload), their convergence feature vectors should form specific clusters or patterns in the vector space. The model maps the node information encoded by the GNN to convergence feature vectors through a specific output head, and uses the adjustment value as a label (or indirectly associated through a classification / regression task) to train the model to learn to identify and extract node features that are highly correlated with "adjustability to promote convergence".

[0151] Specifically, embodiments of the present invention can simultaneously train unsupervised topological feature vectors and supervised convergent feature vectors, and iteratively update network parameters through a joint loss function (combining topological similarity loss and convergent node differentiation loss). An optimization algorithm (such as Adam) is used for gradient descent until the network's loss function on the training set stably converges, ensuring that the generated representation vectors accurately reflect the power grid topology characteristics and effectively assist in power flow convergence adjustment.

[0152] As examples, embodiments of the present invention can simultaneously calculate the contrastive loss of topology learning and the supervised loss of convergence learning in each training iteration, and then sum them with certain weights to obtain the total loss. All model parameters are jointly optimized through backpropagation and gradient descent algorithms. Training continues until the total loss no longer decreases on the validation set or reaches a preset number of iterations. At this point, the second graph neural network is considered to have converged and can output high-quality node representation vectors for use by downstream large language models.

[0153] This invention constructs a training dataset containing rich power grid topology, measurement data, power flow convergence results, and configuration adjustment values. The second graph neural network can fully learn the topological relationships and convergence characteristics of each node in the power grid during actual operation. A heterogeneous graph structure is used to represent power grid components and their connections. Unsupervised learning is combined to effectively extract the topological feature vectors of nodes, causing structurally similar nodes to cluster in the feature space. Supervised learning guides the network to focus on key nodes that have a significant impact on power flow convergence, improving the discriminative ability of convergence feature vectors. The joint optimization of the training strategy for topology and convergence feature vectors enables the model to accurately capture the power grid state and identify non-converging nodes, thereby significantly enhancing the effect and stability of power flow convergence adjustment. This provides high-quality input representation for subsequent large-scale language models and improves the intelligence and reliability of overall power flow calculation.

[0154] Optionally, in the above Figure 1 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, the training process of the large language model may include:

[0155] A third training dataset is obtained, comprising multiple third training samples. Each third training sample includes the power grid topology and measurement data, power flow calculation results, and a representation vector for cases where the power flow calculation results do not converge. The representation vector includes topological feature vectors and convergence feature vectors. Using prompt words, a large language model is used to generate self-questions related to the representation vectors. For each self-question, the large language model generates multiple candidate answers. Semantic and logical consistency statistics are performed on the multiple candidate answers for any self-question, and the target answer with the highest consistency is selected. The self-question reward and self-answer reward are then calculated. Using the self-question reward and self-answer reward, a first total reward is calculated. With maximizing the first total reward as the objective, a policy optimization algorithm is used to update the model parameters of the large language model.

[0156] Specifically, embodiments of the present invention can collect various power grid operating state samples through real-time data acquisition and historical operational data aggregation, including power grid topology and corresponding measurement data. Power flow calculation results are then calculated using power flow calculation tools, and convergence status is indicated. For non-converged samples, a dedicated graph neural network for power flow convergence adjustment is used to extract the topological feature vector and convergence feature vector of each node, constructing a third training dataset containing complete power grid state information and abstract representation vectors. This ensures that the training samples are diverse and accurately reflect the complexity of the power grid.

[0157] Specifically, embodiments of the present invention can design prompt words targeting the meaning and characteristics of representation vectors, guiding the large language model to automatically generate open-ended questions exploring the representation vectors for each training sample, such as "Does the distance between node feature vectors reflect the topological proximity of nodes?". By constructing questions to guide the model to actively conduct semantic mining and knowledge exploration, its ability to understand high-dimensional abstract vectors is enhanced.

[0158] As examples, embodiments of the present invention can input the representation vectors from a third training sample into the large language model in the form of a structured list or descriptive text, along with specific prompts. The prompts define the task scope and objectives, for example: "You are learning node feature vectors generated by a power grid graph neural network. Based on the provided vector data, please ask questions that explore and interpret the potential meanings of these vectors, such as their relationship to the power grid structure, function, or physical quantities." Guided by the prompts, the large language model is required to autonomously generate a series of exploratory questions for the input vector data, such as: "The topological feature vectors of node A and node B are very similar. What similar positions might they occupy in the power grid?" or "Are nodes with larger convergent feature vector norms generally more adaptable?"

[0159] Specifically, in the embodiments of the present invention, for each self-posed question, the large language model is called multiple times to generate independent answers, forming multiple candidate answer sets. By means of diversified generation strategies (such as random sampling, temperature adjustment, etc.), the richness and diversity of the answers are ensured, providing sufficient data support for subsequent consistency analysis, and promoting the self-examination and improvement of the model's internal knowledge.

[0160] As some examples, in the embodiments of the present invention, for each question proposed by the large language model itself, the same large language model (or a model copy with the same parameters) is made to perform multiple inferences and answers independently and repeatedly. For example, for the question "For nodes with a larger norm of the convergent eigenvector, is their adjustability usually stronger?", the model may generate N independent text answers. These answers may vary in specific wording and examples, but the core ideas can be the same. This process aims to explore different perspectives of understanding and possibilities of interpretation of the question through multiple rounds of "thinking" by the model itself.

[0161] Specifically, in the embodiments of the present invention, a text embedding model can be used to convert the candidate answers into vector representations, calculate the cosine similarity between pairs of answers, and statistically analyze the consistency level in semantics and logic. The answer with the highest similarity and wide coverage is selected as the target answer. According to the consistency results, the self-posed question reward and the self-answered question reward are calculated, providing a quantitative evaluation index for subsequent reinforcement learning.

[0162] As some examples, in the embodiments of the present invention, a pre-trained text embedding model (such as Sentence-BERT) can be used to convert all N candidate answers for each question into vectors. Then, the cosine similarity between all answer vectors is calculated to form a similarity matrix. The number of times each answer's similarity to other answers exceeds a preset threshold is counted, and the answer with the most occurrences is selected as the target answer, and the number of times of its consistency is recorded as M. Then, the self-posed question reward is calculated: if 0 < M < N (that is, the question is neither too difficult nor too easy), the reward is 1, otherwise it is 0. At the same time, a self-answered question reward is calculated for each candidate answer: if the semantic vector of the answer is similar to the semantic vector of the target answer exceeding the threshold, it is considered "correct" and the reward is 1, otherwise it is 0.

[0163] Specifically, in the embodiments of the present invention, the self-posed question reward and the self-answered question reward can be weighted and synthesized into a total reward according to a preset weight, serving as the optimization target of reinforcement learning. A policy optimization algorithm is used to iteratively update the parameters of the large language model, maximizing the reward signal through gradient ascent, improving the accuracy and stability of the model's self-posed question and self-answered question, realizing self-supervised reinforcement training for the ability to understand representation vectors, and promoting the improvement of the model's autonomous learning and reasoning abilities.

[0164] As examples, embodiments of the present invention can perform a weighted summation of the calculated self-question reward and all self-answer rewards according to a pre-set weighting coefficient to obtain the first total reward for the current training sample. :

[0165]

[0166] in, Reward yourself for asking questions; For the number Self-answering reward; For self-questioning weight coefficients; This is the self-response weighting coefficient.

[0167] The initial total reward reflects the model's combined ability to "ask good questions" and "provide good answers." Then, policy gradient optimization algorithms (such as DPO and GRPO) are used to update the parameters of the large language model. The optimization objective is to maximize the probability that the model will obtain a higher expected reward when encountering similar representation vectors in the future. Specifically, the algorithm compares the probability of the model generating the current (question, answer) sequence with the probability of a reference model and adjusts the parameters in a direction that favors high-reward behavior. By iterating this process repeatedly on the entire third training dataset, the model gradually learns how to interpret the abstract representation vectors output by the graph neural network and associate them with knowledge concepts related to the power grid.

[0168] This invention constructs a third training dataset containing power grid topology, measurement data, and power flow calculation results. It combines topological feature vectors and convergence feature vectors obtained under non-convergence conditions as high-dimensional abstract representations. This allows the large language model to deeply understand the complex relationship between power grid state and power flow convergence. Prompt words guide the model to generate self-questioning questions related to the representation vectors. Diverse candidate answers and their semantic and logical consistency analysis promote the model's self-exploration and verification of the inherent meaning of the power grid representation. An effective reinforcement learning feedback mechanism is constructed based on self-questioning and self-answering rewards to drive model parameter optimization, continuously improving its reasoning and generation capabilities for power flow convergence adjustment schemes. This enhances the intelligent auxiliary decision-making effect of the large language model in complex power system problems, improving the convergence rate and operational safety of power flow calculations.

[0169] Optionally, in the above Figure 1 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, the training process of the large language model may further include:

[0170] A fourth training dataset is obtained, comprising multiple fourth training samples. Each fourth training sample includes node topology feature vectors, convergence feature vectors, power flow calculation configuration variables, and a list of actual adjusted nodes and their corresponding actual adjustment amounts labeled with these configuration variables. Each fourth training sample is input into a large language model to obtain the configuration adjustment scheme output by the model. This scheme includes a suggested list of adjusted nodes and their suggested adjustment amounts. The configuration adjustment scheme is then input into a power flow calculation tool for simulation verification, yielding the adjusted power flow calculation results. The convergence reward is calculated using the adjusted power flow calculation results. The suggested list of adjusted nodes is compared with the actual list of adjusted nodes to calculate the node selection reward. The suggested adjustment amount and actual adjustment amount for each node are compared to calculate the adjustment amount reward. Using the convergence reward, node selection reward, and adjustment amount reward, a second total reward is calculated. With the goal of maximizing this second total reward, a policy optimization algorithm is used to update the model parameters of the large language model.

[0171] Specifically, embodiments of the present invention can collect sample data containing topological feature vectors and convergence feature vectors of power grid nodes, and simultaneously record the corresponding power flow calculation configuration variables and actual adjustment schemes determined by experts or simulations. These adjustment schemes include specific adjustment nodes and corresponding adjustment amounts. A fourth training dataset that conforms to the actual operation of the power grid is constructed to ensure that the samples cover various power flow non-convergence scenarios and their adjustment conditions.

[0172] Specifically, in this embodiment of the invention, the node topology feature vector, convergence feature vector, and current power flow calculation configuration variables in the sample can be used as input. By designing reasonable prompt words, the large language model is guided to generate the corresponding configuration adjustment scheme, and the list of nodes to be adjusted and their adjustment percentages are output in text or structured format to complete the model's reasoning and generation of adjustment strategies.

[0173] As examples, embodiments of the present invention can input the node topology feature vectors, convergence feature vectors, and power flow calculation configuration variables from the fourth training sample into the large language model in the form of structured text, along with task instructions (prompt words). The prompt words will explicitly require the model to propose a specific adjustment scheme based on its understanding of the power grid state and analysis of the representation vectors. For example: "Based on the topology and convergence feature vectors of the following power grid nodes, and the currently adjustable configuration variables, please output a specific adjustment scheme to help the power flow calculation converge. The scheme should clearly list the nodes that need to be adjusted and the percentage of adjustment of their configuration variables." The model will then output a "suggested adjustment node list" and its corresponding "suggested adjustment amount," for example: "Suggested adjustment node: Generator node G1, increase its voltage amplitude setpoint by 7.5%."

[0174] Specifically, in this embodiment of the invention, the configuration adjustment scheme output by the large language model can be applied to the power flow calculation configuration variables, and the power flow calculation tool can be called to perform simulation to obtain the power flow calculation results of the adjusted power grid, including whether it has converged and the electrical state of each node, thereby verifying the effectiveness of the adjustment scheme.

[0175] Specifically, in this embodiment of the invention, a reward can be given based on whether the adjusted power flow calculation converges. If convergence occurs, the maximum reward is given; if convergence does not occur, the degree of improvement in the convergence features before and after adjustment is quantified by calculating the cosine similarity of the node convergence feature vectors output by the graph neural network, and a corresponding convergence reward value is assigned as a feedback signal in reinforcement learning.

[0176] As examples, embodiments of the present invention can calculate the convergence reward according to the following formula. :

[0177] ;

[0178] in, This is a coefficient, with a value between 0 and 1; The convergence index is denoted as .

[0179] Convergence index The calculation formula is:

[0180] ,

[0181] in, The total number of nodes; Two nodes are the output of the graph neural network. and The cosine similarity of the convergent eigenvectors.

[0182] The purpose of the convergence reward is to evaluate the effect of the power flow convergence adjustment. If the power flow converges after adjustment (which can be verified using power flow calculation tools), the maximum reward is given. If the power flow does not converge after adjustment, since it is difficult to evaluate the reward using power flow calculation tools, the similarity of the node convergence feature vectors output by the graph neural network is used to give the reward.

[0183] Specifically, embodiments of the present invention can compare the adjustment nodes suggested by the large language model with the actual adjustment nodes labeled in the training samples, calculate the hit rate or accuracy, and give node selection rewards based on the degree of matching, thereby encouraging the model to accurately identify key adjustment nodes and improving the pertinence and practicality of the solution.

[0184] As examples, embodiments of the present invention calculate node rewards according to the following formula. :

[0185] .

[0186] Specifically, in this embodiment of the invention, the adjustment amount of each suggested adjustment node can be compared with the corresponding actual adjustment amount. The error can be calculated using an exponential decay function or other distance metrics. The smaller the error, the higher the reward. The adjustment range output by the incentive model is closer to the actual optimal adjustment, thus ensuring the refinement of the adjustment scheme.

[0187] As some examples, embodiments of the present invention can calculate the adjustment reward according to the following formula. :

[0188] ,

[0189] in, is a coefficient.

[0190] Specifically, in this embodiment of the invention, the convergence reward, node selection reward, and adjustment reward can be weighted and synthesized into a second total reward. Using the policy optimization algorithm in reinforcement learning, the parameters of the large language model are iteratively optimized based on the total reward, thereby continuously improving the decision quality and generalization ability of the model in the power flow non-convergence adjustment task, and realizing intelligent and efficient power flow convergence adjustment support for the power grid.

[0191] As examples, the formula for calculating the second total reward is:

[0192] ,

[0193] in, is a coefficient.

[0194] This invention, based on existing reinforcement learning using real-time power grid data and graph neural network-extracted representation vectors, further introduces a fourth training dataset containing node topology feature vectors, convergence feature vectors, and labeled actual adjustment schemes. This enables the large language model to not only explore the meaning of abstract representation vectors on its own but also systematically learn reasonable power flow calculation configuration variable adjustment methods through comparison with real adjustment strategies and simulation verification. This reinforcement learning training mechanism, combining semantic self-supervision and real adjustment feedback, significantly improves the model's ability to identify and adjust complex power flow non-convergence problems, enhances the accuracy and practicality of adjustment schemes, and thus strengthens the overall convergence performance of power flow calculation and the safety and stability of power grid operation.

[0195] Although the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous.

[0196] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.

[0197] Corresponding to the above method embodiments, this invention also provides an online power flow calculation device that integrates graph neural networks and large models, the structure of which is as follows: Figure 3 As shown, it may include: a power grid real-time operation dataset acquisition unit 10, a power grid node initial value acquisition unit 11, a first power flow calculation unit 12, a first convergence determination unit 13, a power grid operation status data output unit 14, a representation vector acquisition unit 15, a configuration variable adjustment amount acquisition unit 16, a second power flow calculation unit 17, a second convergence determination unit 18, an iteration number determination unit 19, and an alarm information sending unit 20.

[0198] The real-time power grid operation dataset acquisition unit 10 is used to collect the topology and measurement data of the power grid in real time to obtain the real-time power grid operation dataset.

[0199] The power grid node initial value acquisition unit 11 is used to input the real-time operation dataset of the power grid into the first graph neural network dedicated to power flow initial value calculation, and obtain the initial values ​​of voltage amplitude, voltage phase angle, active power and reactive power of all nodes in the power grid.

[0200] The first power flow calculation unit 12 is used to call the power flow calculation tool to perform power flow calculation based on the initial value and obtain the power flow calculation result.

[0201] The first convergence determination unit 13 is used to determine whether the power flow calculation result has converged. If it has converged, the power grid operation status data output unit 14 is triggered. If it has not converged, the representation vector acquisition unit 15 is triggered.

[0202] The power grid operation status data output unit 14 is used to output power grid operation status data.

[0203] The vector acquisition unit 15 is used to input the topology and measurement data into the second graph neural network dedicated to power flow convergence adjustment, so as to obtain the topology feature vector and convergence feature vector of each node of the power grid.

[0204] The configuration variable adjustment amount acquisition unit 16 is used to input the topological feature vector, convergence feature vector and power flow calculation configuration variable into the large language model to obtain the adjustment amount of the power flow calculation configuration variable.

[0205] The second power flow calculation unit 17 is used to update the power flow calculation configuration variables according to the adjustment amount and call the power flow calculation tool again to perform power flow calculation.

[0206] The second convergence determination unit 18 is used to determine whether the power flow calculation result has converged after updating the power flow calculation configuration variables. If it has converged, the real-time power grid operation dataset acquisition unit 10 is triggered. If it still has not converged, the iteration number determination unit 19 is triggered.

[0207] The iteration count judgment unit 19 is used to determine whether the preset maximum iteration count has been reached. If not, the representation vector acquisition unit 15 is triggered; if so, the alarm information sending unit 20 is triggered.

[0208] The alarm information sending unit 20 is used to send alarm information to the user.

[0209] Optionally, the grid node initial value acquisition unit 11 can be used to initialize the voltage amplitude, voltage phase angle, active power, and reactive power of all nodes in the grid based on the real-time operation dataset of the grid; input the voltage amplitude, voltage phase angle, active power, and reactive power into a first graph neural network dedicated to power flow initial value calculation to calculate the correction values ​​of voltage amplitude and voltage phase angle; update the voltage amplitude and voltage phase angle according to the correction values, and recalculate the active power and reactive power; calculate the residual between the updated active power and reactive power and the set value; if the residual meets the accuracy requirements or reaches the specified number of iterations, output the current voltage amplitude, voltage phase angle, active power, and reactive power as the initial values; if the residual does not meet the accuracy requirements and has not reached the specified number of iterations, return to the process of inputting the voltage amplitude, voltage phase angle, active power, and reactive power into the first graph neural network dedicated to power flow initial value calculation to calculate the correction values ​​of voltage amplitude and voltage phase angle.

[0210] Optionally, the online power flow calculation device that integrates the graph neural network with the large model may further include: a first graph neural network training unit.

[0211] The first graph neural network training unit is used to construct the first training dataset, which includes multiple first training samples. Each first training sample includes a topology, measurement data, and corresponding active and reactive power. The unit initializes the model parameters of the first graph neural network, including the number of node features, the number of multi-sensor layers, and the weight matrix of each layer. For each node in the first training sample: the node features and power flow electrical quantities are fused to obtain a fused feature vector. For each edge in the first training sample, the mutual admittance value in the node admittance matrix is ​​used as the edge feature. In each layer of the multi-sensor layer, the edge power flow sensing coefficient and edge power flow contribution coefficient of each node are calculated and summed to obtain the power flow contribution value of a single layer. The power flow contribution values ​​of all layers are summed to obtain the total power flow contribution value, and the node features are updated. The mean square error loss between the active and reactive power and the set value is calculated during the iteration process. To minimize the mean square error loss, the gradient descent algorithm is used to update the model parameters until the first graph neural network converges.

[0212] Optionally, the first graph neural network is calculated based on the following formula:

[0213] ,

[0214] in, For the first Voltage amplitude at the wheel node; For the first The voltage phase angle at the wheel node; For the first Active power of the wheel node; For the first Reactive power of the wheel node; This is the setpoint for active power; This is the set value for reactive power; Here is the nodal admittance matrix; This is a correction value for the voltage amplitude; This is the correction value for the voltage phase angle.

[0215] Optionally, the online power flow calculation device that integrates the graph neural network with the large model may further include: a second graph neural network training unit.

[0216] The second graph neural network training unit is used to construct a second training dataset, which includes multiple second training samples. Each second training sample includes a topology, measurement data, power flow convergence results, and corresponding configuration variable adjustment values. The topology and measurement data of each second training sample are converted into a heterogeneous graph structure, where grid components are nodes, connections are edges, and component parameters are node attributes. The heterogeneous graph is input into a dedicated second graph neural network for power flow convergence adjustment. Unsupervised learning is used to generate topological feature vectors, making nodes with similar topologies close in the vector space. Based on the configuration variable adjustment values, supervised learning training is performed on the second graph neural network, causing nodes with significant impact on power flow convergence to cluster in the convergence feature vector space. The generation process of the topological feature vector and the convergence feature vector is jointly optimized until the second graph neural network converges.

[0217] Optionally, the online power flow calculation device that integrates graph neural networks and large models may also include: a first large language model training unit.

[0218] The first large language model training unit is used to obtain the third training dataset, which includes multiple third training samples. Each third training sample includes the topology and measurement data of the power grid, power flow calculation results, and a representation vector when the power flow calculation results do not converge. The representation vector includes topological feature vectors and convergence feature vectors. Combining prompt words, the large language model generates self-questions related to the representation vectors. The large language model generates multiple candidate answers for each self-question. Semantic and logical consistency statistics are performed on the multiple candidate answers for any self-question, and the target answer with the highest consistency is selected. The self-question reward and self-answer reward are calculated. Using the self-question reward and self-answer reward, the first total reward is calculated. With the goal of maximizing the first total reward, the model parameters of the large language model are updated using a policy optimization algorithm.

[0219] Optionally, the online power flow calculation device that integrates graph neural networks and large models may also include: a second large language model training unit.

[0220] The second large language model training unit is used to obtain the fourth training dataset, which includes multiple fourth training samples. Each fourth training sample includes node topology feature vectors, convergence feature vectors, power flow calculation configuration variables, and a list of actual adjusted nodes labeled with the power flow calculation configuration variables, along with the actual adjustment amounts of the corresponding nodes. Each fourth training sample is input into the large language model to obtain the configuration adjustment scheme output by the large language model. The configuration adjustment scheme includes a list of suggested adjusted nodes and the suggested adjustment amounts of the corresponding nodes. The configuration adjustment scheme is input into the power flow calculation tool for simulation verification to obtain the adjusted power flow calculation results. Using the adjusted power flow calculation results, the convergence reward is calculated. The list of suggested adjusted nodes is compared with the list of actual adjusted nodes to calculate the node selection reward. The suggested adjustment amount and the actual adjustment amount of each node are compared to calculate the adjustment amount reward. Using the convergence reward, node selection reward, and adjustment amount reward, the second total reward is calculated. With the goal of maximizing the second total reward, a policy optimization algorithm is used to update the model parameters of the large language model.

[0221] This invention provides an online power flow calculation device that integrates graph neural networks and large-scale models. It uses graph neural networks embedded with the power grid's topology and measurement data to calculate initial power flow values, improving iterative calculation efficiency. Furthermore, by combining the topology awareness of graph neural networks with the reasoning capabilities of large-scale models, it identifies and adjusts convergence issues in power flow calculation, significantly enhancing the robustness and efficiency of power flow calculation. This enables online power flow calculation in scenarios with dynamic topology changes, providing assistance to power grid operators, improving the intelligence level of power flow calculation services, and meeting the needs of modern dynamic and complex power grid operations.

[0222] Regarding the apparatus in the above embodiments, the specific manner in which each unit performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0223] The power flow online calculation device that integrates graph neural networks and large models includes a processor and a memory. The aforementioned power flow real-time operation dataset acquisition unit 10, power grid node initial value acquisition unit 11, first power flow calculation unit 12, first convergence determination unit 13, power grid operation status data output unit 14, representation vector acquisition unit 15, configuration variable adjustment amount acquisition unit 16, second power flow calculation unit 17, second convergence determination unit 18, iteration number determination unit 19, and alarm information sending unit 20 are all stored as program units in the memory. The processor executes the aforementioned program units stored in the memory to realize the corresponding functions.

[0224] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and by adjusting kernel parameters, the topology awareness capability of graph neural networks and the reasoning capability of large language models can be integrated, effectively improving the robustness and efficiency of power flow calculation and meeting the complex operational needs of modern power grids.

[0225] This invention provides a computer-readable storage medium storing a program that, when executed by a processor, implements the online power flow calculation method for fusing graph neural networks and large models.

[0226] This invention provides a processor for running a program, wherein the program executes the online power flow calculation method that fuses the graph neural network with a large model.

[0227] This invention provides an electronic device, which includes at least one processor, at least one memory connected to the processor, and a bus. The processor and memory communicate with each other via the bus. The processor is used to call program instructions from the memory to execute the aforementioned online power flow calculation method that integrates graph neural networks and large-scale models. The electronic device described herein can be a server, PC, tablet, mobile phone, etc.

[0228] The present invention also provides a computer program product, which, when executed on an electronic device, is suitable for executing the steps of an online power flow calculation method that integrates a graph neural network and a large model.

[0229] In this invention, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, without necessarily requiring or implying any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0230] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0231] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

[0232] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. A power grid power flow online calculation method combining a graph neural network with a large model, characterized in that, The method comprises the following steps: real-time acquisition of the topology structure and measurement data of the power grid to obtain a real-time operation data set of the power grid; initialization of the voltage amplitude, voltage phase angle, active power and reactive power of all nodes of the power grid based on the real-time operation data set of the power grid; input of the voltage amplitude, voltage phase angle, active power and reactive power into a first graph neural network dedicated to initial value calculation of power flow to obtain correction values of the voltage amplitude and voltage phase angle; updating of the voltage amplitude and voltage phase angle according to the correction values and recalculation of the active power and reactive power; calculation of the residual error of the updated active power and reactive power and the set value, and output of the current voltage amplitude, voltage phase angle, active power and reactive power as the initial value if the residual error meets the accuracy requirement or reaches the specified number of iterations; if the residual error does not meet the accuracy requirement and the specified number of iterations has not been reached, return to the step of inputting the voltage amplitude, voltage phase angle, active power and reactive power into the first graph neural network dedicated to initial value calculation of power flow to obtain correction values of the voltage amplitude and voltage phase angle; based on the initial value, calling a power flow calculation tool to perform power flow calculation and obtaining a power flow calculation result; judging whether the power flow calculation result converges, and outputting the power grid operation state data if it converges; in the case that the power flow calculation result does not converge, inputting the topology structure and measurement data into a second graph neural network dedicated to power flow convergence adjustment to obtain a topology feature vector and a convergence feature vector of each node of the power grid; inputting the topology feature vector, the convergence feature vector and a power flow calculation configuration variable into a large language model to obtain an adjustment amount of the power flow calculation configuration variable; updating the power flow calculation configuration variable according to the adjustment amount and calling the power flow calculation tool again to perform power flow calculation; judging whether the power flow calculation result after updating the power flow calculation configuration variable converges, and returning to the step of real-time acquisition of the topology structure and measurement data of the power grid to obtain a real-time operation data set of the power grid if it converges, and judging whether the preset maximum number of iterations is reached if it still does not converge, and returning to the step of inputting the topology structure and measurement data into the second graph neural network dedicated to power flow convergence adjustment to obtain a topology feature vector and a convergence feature vector of each node of the power grid if not, and sending an alarm information to the user if yes.

2. The method of claim 1, wherein, The training process of the first graph neural network comprises: constructing a first training data set, wherein the first training data set comprises a plurality of first training samples, and each first training sample comprises a topology structure, measurement data and corresponding active power and reactive power; initializing model parameters of the first graph neural network, wherein the model parameters comprise node feature quantity, number of multi-perception layers and weight matrix of each layer; for each node in the first training sample, fusing node features and power flow electrical quantities to obtain a fusion feature vector; for each edge in the first training sample, taking mutual admittance values in a node admittance matrix as edge features. In each layer of the multiple perception layers, edge flow perception coefficients and edge flow contribution coefficients of each node are calculated, and a single-layer flow contribution value is obtained by summarizing; The flow contribution values of all layers are summarized to obtain a total flow contribution value, and the node features are updated; The mean square error loss value of active power and reactive power in the iteration process and the set value is calculated, and the model parameters are updated by using the gradient descent algorithm to minimize the mean square error loss value until the first graph neural network converges.

3. The method of claim 2, wherein, The first graph neural network is calculated based on the following formula: in, For the first Voltage amplitude at the wheel node; For the first The voltage phase angle at the wheel node; For the first Active power of the wheel node; For the first Reactive power of the wheel node; The set value for active power, This is the set value for reactive power; Here is the nodal admittance matrix; This is a correction value for the voltage amplitude; This is the correction value for the voltage phase angle.

4. The method of claim 1, wherein, The training process of the second graph neural network includes: A second training data set is constructed, wherein the second training data set includes multiple second training samples, and each second training sample includes a topology structure, measurement data, a power flow convergence result, and a corresponding configuration variable adjustment value; The topology structure and the measurement data of each second training sample are converted into a heterogeneous graph structure, wherein the grid elements are nodes, the connection relationships are edges, and the element parameters are node attributes; The heterogeneous graph is input into a second graph neural network dedicated to power flow convergence adjustment, and an unsupervised learning is performed to generate a topology feature vector, so that nodes with similar topology structures are close in the vector space; Based on the configuration variable adjustment value, the second graph neural network is supervised learning trained, so that nodes with significant influence on power flow convergence are gathered in the convergence feature vector space; The generation processes of the topology feature vector and the convergence feature vector are jointly optimized until the second graph neural network converges.

5. The method of claim 1, wherein, The training process of the large language model includes: A third training data set is obtained, wherein the third training data set includes multiple third training samples, and each third training sample includes a topology structure and measurement data of a power grid, a power flow calculation result, and a representation vector in the case of non-convergence of the power flow calculation result, the representation vector including a topology feature vector and a convergence feature vector; In combination with a prompt word, the large language model is used to generate self-question questions related to the representation vector; The large language model is used to generate multiple candidate answers for each self-question question; The semantic and logical consistency of the multiple candidate answers for any self-question question is counted, the target answer with the highest consistency is selected, and a self-question reward and a self-answer reward are calculated; The first total reward is calculated by using the self-question reward and the self-answer reward, and the model parameters of the large language model are updated by using a strategy optimization algorithm to maximize the first total reward.

6. The method of claim 5, wherein, The training process of the large language model further includes: A fourth training data set is obtained, wherein the fourth training data set includes multiple fourth training samples, and each fourth training sample includes a node topology feature vector, a convergence feature vector, a power flow calculation configuration variable, and an actual adjustment node list and corresponding node actual adjustment amount labeled for the power flow calculation configuration variable; Each fourth training sample is input into the large language model to obtain a configuration adjustment scheme output by the large language model, wherein the configuration adjustment scheme includes a recommended adjustment node list and corresponding node recommended adjustment amount; The configuration adjustment scheme is input into a power flow calculation tool for simulation verification, and adjusted power flow calculation results are obtained; The adjusted power flow calculation results are used to calculate a convergence reward; The suggested adjustment node list and the actual adjustment node list are compared to calculate a node selection reward; The suggested adjustment amount and the actual adjustment amount of each node are compared to calculate an adjustment amount reward; The convergence reward, the node selection reward, and the adjustment amount reward are used to calculate a second total reward, and a strategy optimization algorithm is used to update model parameters of the large language model with the goal of maximizing the second total reward.

7. A power grid power flow online calculation device based on graph neural network and large model fusion, characterized in that, It comprises: a power grid real-time operation data set obtaining unit, a power grid node initial value obtaining unit, a first power flow calculation unit, a first convergence determination unit, a power grid operation state data output unit, a representation vector obtaining unit, a configuration variable adjustment amount obtaining unit, a second power flow calculation unit, a second convergence determination unit, an iteration number determination unit, and an alarm information sending unit; The power grid real-time operation data set obtaining unit is configured to collect the topology structure and the measurement data of the power grid in real time to obtain a power grid real-time operation data set; The power grid node initial value obtaining unit is configured to initialize the voltage amplitude, the voltage phase angle, the active power, and the reactive power of all nodes of the power grid based on the power grid real-time operation data set; The voltage amplitude, the voltage phase angle, the active power, and the reactive power are input into a first graph neural network dedicated to power flow initial value calculation to obtain correction values of the voltage amplitude and the voltage phase angle; The voltage amplitude and the voltage phase angle are updated according to the correction values, and the active power and the reactive power are recalculated; The residual error of the updated active power and reactive power and the set value is calculated, and if the residual error meets the accuracy requirement or reaches the specified number of iterations, the current voltage amplitude, voltage phase angle, active power, and reactive power are output as the initial values; if the residual error does not meet the accuracy requirement and the specified number of iterations has not been reached, the voltage amplitude, voltage phase angle, active power, and reactive power are input into the first graph neural network dedicated to power flow initial value calculation to obtain correction values of the voltage amplitude and the voltage phase angle; The first power flow calculation unit is configured to call a power flow calculation tool to perform power flow calculation based on the initial values to obtain power flow calculation results; The first convergence determination unit is configured to determine whether the power flow calculation results converge, and if they do, the power grid operation state data output unit is triggered, and if they do not, the representation vector obtaining unit is triggered; The power grid operation state data output unit is configured to output power grid operation state data; The representation vector obtaining unit is configured to input the topology structure and the measurement data into a second graph neural network dedicated to power flow convergence adjustment to obtain a topology feature vector and a convergence feature vector of each node of the power grid; The configuration variable adjustment amount obtaining unit is configured to input the topology feature vector, the convergence feature vector, and a power flow calculation configuration variable into a large language model to obtain an adjustment amount of the power flow calculation configuration variable; The second power flow calculation unit is configured to update the power flow calculation configuration variable according to the adjustment amount, and call the power flow calculation tool again to perform power flow calculation. The second convergence determination unit is configured to determine whether the power flow calculation result after updating the power flow calculation configuration variable is converged, and if yes, trigger the power grid real-time operation data set obtaining unit, and if not, trigger the iteration number determination unit. The iteration number determination unit is configured to determine whether the preset maximum iteration number is reached, and if not, trigger the representation vector obtaining unit, and if yes, trigger the alarm information sending unit. The alarm information sending unit is configured to send alarm information to a user.

8. A computer-readable storage medium having stored thereon a program, characterized in that, The program is executed by the processor to implement the power grid power flow online calculation method based on the graph neural network and the large model fusion as claimed in any one of claims 1 to 6.

9. An electronic device, comprising: The electronic device comprises at least one processor, at least one memory connected with the processor, and a bus; wherein the processor, the memory complete mutual communication through the bus; the processor is used to call the program instruction in the memory, to execute the power grid power flow online calculation method based on the graph neural network and the large model fusion as claimed in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Model-driven graph convolutional neural network load flow calculation method

    CN114861874A

  • Graph neural network-based power grid load flow calculation method and related device

    CN121071624A