LLM Agent-based power system operation mode adaptive calculation method

By introducing an adaptive calculation method based on LLM Agent in the power system, the difficulty of adjusting the operation mode of the power system is solved, efficient and accurate flow calculation and parameter adjustment are achieved, and the reliable operation and adaptability of the system is ensured.

CN119813228AActive Publication Date: 2025-04-11SHANDONG UNIV

Patent Information

Application Number
CN202510296078.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-13
Publication Date
2025-04-11
Estimated Expiration
2045-03-13

AI Technical Summary

Technical Problem

The existing technology is difficult to adjust and calculate the operating mode of the power system, especially when facing complex nonlinear algebraic equations and high-dimensional solution spatial structures, the existence of solutions, initial value sensitivity and the physical significance of the current calculation results are difficult to effectively solve.

Method used

An adaptive calculation method for the operation mode of the power system based on LLM Agent is proposed. The LLM Agent framework includes the LLM model, multiple Agents, memory system modules, Prompt modules, tool modules, etc. By obtaining the task requirements of the power system, analyzing and splitting it into subtasks, calling the current calculation agent and parameter adjustment agent, iteratively adjusting the power system until the constraints are met.

Benefits of technology

The adaptive calculation and adjustment process guided by natural language is realized, the adaptability of the trend calculation adjustment strategy is enhanced, the accuracy of trend calculation and the reliable operation of the power system is ensured, and the experience limitations of existing operating personnel are exceeded, and the new operating mode can be automatically identified and adapted to.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119813228A_ABST
    Figure CN119813228A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of power grid control, particularly relates to an LLM Agent-based power system operation mode adaptive calculation method, and aims to solve the problem that load flow calculation of a power system operation mode is relatively difficult in the prior art. The method comprises the following steps: acquiring a task demand of a power system; the task demand is input into an LLM model, the LLM model splits the task demand into a plurality of sub-tasks, and Agents used for executing the sub-tasks are determined; determining the output of the LLM model, and allocating a plurality of subtasks to a load flow calculation Agent and a parameter adjustment Agent by calling a task management Agent; and calling the load flow calculation Agent and the parameter adjustment Agent, and executing each subtask allocated by the task management Agent. According to the method, the adaptability of the load flow calculation and adjustment strategy is improved by utilizing the LLM model, and meanwhile, the accuracy of load flow calculation is guaranteed through multi-Agent calling, so that the load flow calculation and adjustment effect on the power system in the prior art is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] With the accelerated advancement of the construction of new power systems, the inherent complexity of power systems has increased dramatically. Including risks in planning and operation, and requiring good adaptability to the generalized environment, conventional analysis and decision-making methods face serious challenges. The starting point for calculating the operation mode of the power system is the flow calculation, whose boundary conditions usually include power injection and switchable discrete quantities (such as parallel capacitors, reactors, etc.), and the mathematical essence is the numerical solution of a group of nonlinear algebraic equations. When the flow calculation results are not ideal, such as many voltage amplitudes exceeding the limit, branch power exceeding the limit, etc., the reverse adjustment measures (forming new boundary conditions) are usually relied on manual repeated flow calculations to obtain a reasonable operation mode.

[0003] Optimal power flow adjusts the parameters of various control devices in the system from the perspective of optimizing operation. Under the constraints of normal power balance of nodes and non-exceeding limits of key physical quantities, it guides the optimization of state transfer through information such as gradient or heuristic rules. The optimization process does not use traditional boundary condition adjustments, which conceals the physical meaning of the adjustment process and cannot fully utilize expert experience. Power flow calculation itself is a numerical solution problem for a set of nonlinear algebraic equations. The existence of solutions, sensitivity to initial values, and the structure of high-dimensional solution space are all basic problems that have not been effectively solved, making reliable optimization more challenging. Nowadays, with the large-scale access of renewable energy to the power system, new operating forms have begun to emerge. New operating scenarios and the laws behind them need to be recognized and accumulated experience, making the adjustment calculation of the power system operation mode increasingly difficult. Summary of the invention

[0004] In order to solve the above-mentioned problem in the prior art, that is, the problem that the prior art is difficult to adjust and calculate the operation mode of the power system, the present invention, in a first aspect, proposes an adaptive calculation method for the operation mode of the power system based on LLM Agent, which is applied to the LLM Agent framework, and the LLM Agent framework includes an LLM model, multiple Agents, and; A memory system module, including a short-term memory module and a long-term memory module, wherein the short-term memory module is used to provide short-term memory support for the Agent, and the long-term memory module is integrated with a knowledge base, wherein the knowledge base stores historical interaction data and historical optimization records, and the long-term memory module provides long-term memory support for multiple Agents based on the knowledge base; Prompt module, used to adjust the output and optimization behavior of the LLM model; A tool module, including a power flow calculation tool, an API interface and a RAG module. The power flow calculation tool is used to support the Agent to perform data analysis and power system status calculation. The API interface is used to support multiple Agents to interact with external data sources. The RAG module is used to provide retrieval services for the LLM model. The method comprises: Obtain mission requirements for power systems; Input the task requirements into the LLM model in the LLM Agent framework, the LLM model is used to parse the input task requirements, determine the task objectives, constraints and action sets, and split the task requirements into multiple subtasks according to the task objectives and action sets, and determine the Agent used to execute each subtask; Determine the output of the LLM model, and allocate the plurality of subtasks to the power flow calculation agent and parameter adjustment agent of the LLM Agent framework by calling the task management agent of the LLM Agent framework; The power flow calculation agent and the parameter adjustment agent are called to execute the subtasks assigned by the task management agent, wherein the power flow calculation agent executes the power flow calculation of the power system and determines the power flow calculation result by calling the power flow calculation tool, and the parameter adjustment agent iteratively adjusts the power system according to the power flow calculation result by calling the RAG module until the power system meets the constraint condition.

[0005] In some preferred implementations, the calling of the power flow calculation agent and the parameter adjustment agent to execute each subtask assigned by the task management agent includes: Calling the power flow calculation agent, performing an initial power flow calculation on the power system by expanding the node load of the power system, and determining a first calculation result, wherein the first calculation result is received by the parameter adjustment agent; calling the parameter adjustment agent, determining a reactive power compensation strategy according to the first calculation result, and correcting the power system according to the reactive power compensation strategy, wherein the reactive power compensation strategy is transmitted to the power flow calculation agent; Calling the power flow calculation Agent, performing power flow calculation again on the power system after voltage adjustment according to the reactive power compensation strategy, and determining a second calculation result; Repeatedly calling the parameter adjustment Agent to determine whether the power system satisfies the constraint condition according to the second calculation result; If it is determined that the power system does not meet the constraint condition, the power flow calculation Agent is repeatedly called to iteratively correct the power system until the power system meets the preset constraint condition.

[0006] In some preferred implementations, calling the parameter adjustment agent to determine a reactive power compensation strategy according to the first calculation result includes: Calling the parameter adjustment Agent to synchronously obtain the current voltage state of the power system; According to the current voltage state, determining whether the power system meets preset constraint conditions; If it is determined that the power system does not satisfy the preset constraint condition, the reactive power compensation strategy is determined according to the first calculation result.

[0007] In some preferred implementations, determining the reactive power compensation strategy according to the first calculation result includes: Determining an initial adjustment strategy according to a current voltage state of the power system; Call the RAG module to determine the reactive power compensation strategy according to the initial adjustment strategy and the first calculation result, wherein the RAG module searches a preset knowledge graph database according to the first calculation result to optimize the initial adjustment strategy and obtain the reactive power compensation strategy.

[0008] In some preferred embodiments, the RAG module uses a preset knowledge graph database to search and generate search results. Before searching, the RAG module divides the documents in the preset knowledge graph database into multiple text blocks, and converts the text blocks into vector representations through a preset encoding model, satisfying the following formula: ; In the formula, q is the query vector and di is the knowledge base vector; When performing a search, the RAG module determines the first k most relevant knowledge base vector sets Dk in the knowledge base vectors as the search results according to a preset similarity scoring standard, where k is greater than 0.

[0009] In some preferred embodiments, the RAG module inputs the search results into the LLM model of the LLM Agent framework, and the LLM model generates a response for optimizing the initial adjustment strategy according to the search results, including: The retrieved knowledge base vector set Dk and the query vector q are input as conditions into the LLM model, and the LLM model generates a corresponding reply according to the condition input: ; Where G is the LLM model, and y is the response generated by the LLM model.

[0010] In some preferred embodiments, the LLM Agent framework further includes an information recording Agent, which is used to record the working data of each Agent, and the working data is uploaded by the information recording Agent to a preset database, and the preset database is used to store the state and adjustment actions of the power system; The state of the power system is specifically: S(P(L1, L2, ...), R(LP1, LP2, ...)); Where P is the input of power flow calculation, L1 and L2 are input parameter matrices, R is the power flow calculation result, LP1 and LP2 are the output power flow states; The adjustment action is specifically: A(I, V); Where I is the position of the modified parameter, and V is the modified value.

[0011] In some preferred embodiments, the LLM Agent framework further includes an information recording Agent, and the LLMAgent framework further includes an information recording Agent, and the information recording Agent is used to record the working data of each Agent, and the working data is uploaded to a preset database by the information recording Agent; The preset database is used to store the state and adjustment actions of the power system: the state of the power system, S ( P ( L 1, L 2, ...), R ( LP 1, LP 2, ...)), Where P is the input of power flow calculation, L1 and L2 are input parameter matrices, R is the power flow calculation result, LP1 and LP2 are the output power flow states; The adjustment action, A(I, V) , Where I is the position of the modified parameter, and V is the modified value.

[0012] The second aspect of the present invention provides an LLM Agent-based power system operation mode adaptive calculation device, comprising: Data acquisition module, used to obtain the task requirements of the power system; A data input module, used to input the task requirements into the LLM model in the LLM Agent framework, the LLM model is used to parse the input task requirements, determine the task objectives, constraints and action sets, and split the task requirements into multiple subtasks according to the task objectives and action sets, and determine the Agent used to execute each subtask; A data output module, used for determining the output of the LLM model, and allocating the plurality of subtasks to the power flow calculation agent and parameter adjustment agent of the LLM Agent framework by calling the task management agent of the LLM Agent framework; A data adjustment module is used to call the power flow calculation agent and the parameter adjustment agent to execute each subtask assigned by the task management agent, wherein the power flow calculation agent executes the power flow calculation of the power system and determines the power flow calculation result by calling the power flow calculation tool, and the parameter adjustment agent iteratively adjusts the power system according to the power flow calculation result by calling the RAG module until the power system meets the constraint condition.

[0013] According to a third aspect of the present invention, an electronic device is provided, comprising: at least one processor; and, a memory communicatively connected to at least one of the processors; wherein, The memory stores instructions that can be executed by the processor, and the instructions are used to be executed by the processor to implement the method described in the first aspect.

[0014] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to be executed by the computer to implement the method described in the first aspect.

[0015] Beneficial effects of the present invention: The adaptive calculation method of the power system operation mode based on LLM Agent proposed in the present invention uses the reasoning ability of the LLM large language model to enhance the adaptability of the power flow calculation adjustment strategy, and calls the power flow calculation module through multiple agents to ensure the accuracy of the power flow calculation, thereby realizing the adaptive calculation and adjustment process guided by natural language. In addition, since the retrieval augmented generation (RAG) technology is introduced in the calculation and adjustment process, the external knowledge base and database information are obtained, which further improves the multi-agent framework's ability to understand the power system operation law and the decision-making accuracy. The present invention gives full play to the advantages of the large language model in logic and natural language processing, integrates with traditional power flow calculation tools, and realizes the closed loop of boundary condition adjustment based on the power flow calculation results. It can not only enhance the adaptability to the new power system operation form, but also discover new ways to adjust the mode by mining potential operation modes, surpassing the experience limitations of existing operators, automatically identifying and adapting to new operation modes, dynamically adjusting the power flow calculation strategy, and responding quickly to various emergencies to ensure the reliable operation of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings: Figure 1 It is a flowchart of an adaptive calculation method for power system operation mode based on LLM Agent proposed in an embodiment of the present invention; Figure 2 It is a general schematic diagram of an adaptive solution mechanism for an LLM Agent framework proposed in an embodiment of the present invention; Figure 3 It is a schematic diagram of an LLM Agent framework proposed in an embodiment of the present invention; Figure 4 It is a schematic diagram of a workflow of an LLM Agent framework proposed in an embodiment of the present invention; Figure 5 is a schematic diagram of a RAG working mechanism proposed in an embodiment of the present invention; Figure 6 It is a result schematic diagram of the adaptive calculation device for power system operation mode based on LLM Agent proposed in an embodiment of the present invention; Figure 7 It is a structural diagram of a computer system of a server for implementing the method, device, and electronic device embodiments of the present application. DETAILED DESCRIPTION

[0017] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.

[0018] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0019] The present invention provides an adaptive calculation method for power system operation mode based on LLM Agent, which is applied to LLMAgent framework, wherein the LLM Agent framework includes an LLM model and multiple Agents, wherein the multiple Agents include at least a task management Agent, a power flow calculation Agent and a parameter adjustment Agent; and A memory system module, including a short-term memory module and a long-term memory module, wherein the short-term memory module is used to provide short-term memory support for the Agent, and the long-term memory module is integrated with a knowledge base, wherein the knowledge base stores historical interaction data and historical optimization records, and the long-term memory module provides long-term memory support for multiple Agents based on the knowledge base; Prompt module, used to adjust the output and optimization behavior of the LLM model; A tool module, including a power flow calculation tool, an API interface and a RAG module. The power flow calculation tool is used to support the Agent to perform data analysis and power system status calculation. The API interface is used to support multiple Agents to interact with external data sources. The RAG module is used to provide retrieval services for the LLM model. In order to explain the above method more clearly, Figure 1 Each step in the embodiment of the present invention is described in detail. Figure 1 The first embodiment of the present invention provides a method for adaptively calculating an operation mode of a power system based on an LLM Agent, comprising: Step S10, obtaining task requirements of the power system; In this embodiment, the mission requirements of the power system refer to the operational adjustment requirements of the power system at the global level, including but not limited to the adjustment requirements of the power system at the levels of power generation, transmission, distribution and distribution coordination. Specifically, by optimizing and adjusting the power flow distribution of the power system, the overall efficiency of the power system can be effectively improved while preventing line overload.

[0020] In this embodiment, the preset constraints are used to characterize the boundary conditions of the power system during the adjustment process, specifically including the constraint range of each grid parameter in the power system, and then based on the restrictions of the constraints, avoid arbitrary modification and adjustment of the parameters of the power system by each intelligent agent in subsequent steps.

[0021] Step S20, inputting the task requirement into the LLM model in the LLM Agent framework, wherein the LLM model is used to parse the input task requirement, determine the task goal, constraint conditions and action set, and split the task requirement into multiple subtasks according to the task goal and action set, and determine the Agent for executing each subtask; It should be noted that this embodiment combines the LLM Agent framework to perform adaptive adjustment and calculation on the power system. Figure 2 , Figure 2 The figure shows the overall schematic diagram of the adaptive solution mechanism of the LLM Agent framework in this embodiment, which consists of two parts: The first part is the LLM Agents framework. The planning, thinking, and memory functions of LLM give the intelligent agent the ability to perceive, reason, make decisions, and self-evolve. With these capabilities, the intelligent agent can understand the task requirements and make dynamic adjustments, thereby achieving efficient processing of complex power system tasks; The second part is the modeling and simulation requirements of the power system. The intelligent agent adjusts the flow calculation and parameter optimization in real time according to the operating data and task objectives of the power system. The adaptability of the LLM Agents framework enables it to automatically perform complex tasks, while ensuring the agent's resistance to disturbances, the intelligence of task processing, and the high interpretability of the decision-making process. Through the deep integration of the intelligent agent and the power system, the framework can adapt to the changing operating conditions of the power system, automatically complete complex tasks, and provide transparent and explainable decision support.

[0022] It is easy to understand that the LLM Agent framework includes LLM (Large Language Model) and multiple Agents. The planning, thinking, and memory functions of LLM give the Agent the ability to perceive, reason, make decisions, and self-evolve. Furthermore, based on the above capabilities, the Agent can understand task requirements and make dynamic adjustments, thereby achieving efficient processing of complex power system tasks.

[0023] For further information, please refer to Figure 3 , Figure 3 A schematic diagram of the LLM Agent framework provided in this embodiment is as follows: Figure 3As shown, this embodiment uses the LLM model to parse and decompose the task requirements, thereby splitting the total task requirements into multiple subtasks. Specifically, the LLM model decomposes the global operation adjustment requirements into several executable subtasks through its powerful natural language understanding and generation capabilities. Each subtask is executed by the corresponding intelligent agent, and the LLM is also responsible for planning the logical relationship and execution order between the subtasks to ensure the coordination and efficiency of the overall computing process.

[0024] After the task decomposition is completed, the LLM model delegates these tasks to the corresponding Agent intelligent agents. The above Agent intelligent agents each have different functions and task execution capabilities, and are responsible for specific subtasks such as reactive power compensation, power flow calculation, control parameter adjustment, information recording and feedback. In the process of executing subtasks, Agent intelligent agents perform corresponding calculation operations by calling external power flow calculation codes, optimization algorithms, database query interfaces and other tools. In addition, Agent intelligent agents can not only interact with external tools through APIs, but also dynamically generate and repair codes to ensure the smooth progress of calculation tasks.

[0025] Step S30, determining the output of the LLM model, and assigning the plurality of subtasks to the power flow calculation Agent and parameter adjustment Agent of the LLM Agent framework by calling the task management Agent of the LLM Agent framework; It should be noted that based on the LLM Agent framework, after the complex task requirements are split into modules to obtain sub-tasks, the overall task requirements are completed through the collaboration of multiple Agent intelligent bodies. Each intelligent body can not only perform its specific task, but also adjust the calculation in an overall manner by sharing calculation results and interacting and collaborating through natural language.

[0026] Specifically, the LLM Agent framework includes but is not limited to task management agent, power flow calculation agent and parameter adjustment agent, among which: The task management agent, as the core of the multi-agent system, is responsible for task requirement analysis, goal setting, control parameters and constraints, and decomposing tasks into subtasks and assigning them to other agents for execution. Specifically, the management agent receives and analyzes task requirements, which indicate the adjustment of goals, control parameters and related constraints. Based on the analysis results, the management agent decomposes the task into several subtasks and clarifies the execution order and specific requirements of each subtask, which include reactive compensation setting, power flow calculation, result verification, etc. The management agent also ensures that each agent accurately understands the task objectives and their expected outputs.

[0027] The parameter adjustment agent independently formulates the voltage adjustment strategy based on real-time feedback, determines whether the node voltage exceeds the limit, and sets the initial reactive power compensation value. According to the power flow calculation results, the parameter adjustment agent optimizes the reactive power compensation strategy through RAG technology, gradually reduces the number of iterations, and achieves efficient adjustment.

[0028] The power flow calculation agent is responsible for executing power flow calculation, executing power flow calculation code, and outputting calculation results. If an error occurs, LLM can be used to repair the code to ensure the accuracy of the calculation. Specifically, the power flow calculation agent receives the reactive compensation value provided by the parameter adjustment agent, executes the preset power flow calculation code, and calculates the adjusted power grid operation status. If an error occurs during the power flow calculation process, the power flow calculation agent will use the code repair function of LLM to automatically generate the correction code and re-execute it to ensure the accuracy of the calculation.

[0029] Step S40, calling the power flow calculation agent and the parameter adjustment agent to execute each subtask assigned by the task management agent, wherein the power flow calculation agent executes the power flow calculation of the power system and determines the power flow calculation result by calling the power flow calculation tool, and the parameter adjustment agent iteratively adjusts the power system according to the power flow calculation result by calling the RAG module until the power system meets the constraint condition.

[0030] For details, please refer to Figure 4 , Figure 4 A schematic diagram of the LLM-Agent framework workflow provided in this embodiment is as follows: Figure 4 As shown in the figure, the management agent first receives and parses the task requirements, clarifies the adjustment objectives, control parameters and constraints, and decomposes the tasks into subtasks and assigns them to each agent for execution. The power flow calculation agent expands the node load and performs the initial power flow calculation, outputting the basic data. Subsequently, the parameter adjustment agent obtains the current voltage status and determines whether there is a node voltage exceeding the limit. If so, the reactive power compensation strategy is set and the voltage is corrected. The power flow calculation agent performs the adjusted power flow calculation according to the compensation value, and repairs the code through LLM to ensure the accuracy of the calculation if there is an error. The parameter adjustment agent evaluates the effectiveness of the compensation strategy based on the calculation results. If the voltage is still exceeding the limit, it continues to iterate until all constraints are met. Finally, the information recording agent records the iterative data to ensure the integrity and traceability of the adjustment process and provide support for subsequent strategy optimization.

[0031] More specifically, in this embodiment, the steps of calling the power flow calculation agent and the parameter adjustment agent to execute each subtask assigned by the task management agent specifically include: The power flow calculation agent is called to perform an initial power flow calculation on the power system by expanding the node load of the power system, and a first calculation result is determined, and the first calculation result is received by the parameter adjustment agent; the parameter adjustment agent is called to determine a reactive power compensation strategy according to the first calculation result, and the power system is corrected according to the reactive power compensation strategy, and the reactive power compensation strategy is transmitted to the power flow calculation agent; the power flow calculation agent is called to perform a power flow calculation again on the power system after voltage adjustment according to the reactive power compensation strategy, and a second calculation result is determined; the parameter adjustment agent is repeatedly called to determine whether the power system meets the preset constraint conditions according to the second calculation result; if it is determined that the power system does not meet the preset constraint conditions, the power flow calculation agent is repeatedly called to iteratively correct the power system until the power system meets the preset constraint conditions.

[0032] In this embodiment, the preset constraint condition is used to indicate whether the power system meets a specific adjustment expectation in the current adjustment mode. Preferably, the indicator of whether the voltage of each node in the power system exceeds the limit can be used as the above constraint condition.

[0033] For example, first, the node load is expanded and the initial power flow calculation is performed through the power flow calculation agent, and the preliminary power flow calculation results are output as the basic data for subsequent adjustments; then, the voltage state of the current power grid system is obtained through the parameter adjustment agent to determine whether there is a node voltage over-limit phenomenon (that is, the preset constraint conditions mentioned above). If over-limit is detected, the parameter adjustment agent will set the reactive power compensation strategy and perform voltage correction through reactive power compensation; then, the power flow calculation agent receives the reactive compensation value provided by the parameter adjustment agent, executes the preset power flow calculation code, and calculates the adjusted power grid operation state. If an error occurs during the power flow calculation process, the power flow calculation agent will use the code repair function of LLM to automatically generate a correction code and re-execute it to ensure the accuracy of the calculation. Finally, the parameter adjustment agent evaluates the effectiveness of the compensation strategy based on the power flow calculation results and determines whether the node voltage is still over-limit. If it is still over-limit, it returns to the above steps to continue iterative adjustment... until the system constraints are met and the target optimization adjustment is completed.

[0034] More specifically, calling the parameter adjustment agent and determining a reactive power compensation strategy according to the first calculation result includes: The parameter adjustment Agent is called to obtain the current voltage state of the power system; based on the current voltage state, whether the power system meets the preset constraint conditions is determined; if it is determined that the power system does not meet the preset constraint conditions, the reactive power compensation strategy is determined based on the first calculation result.

[0035] Among them, the LLM Agent framework also includes a RAG module, which determines the reactive compensation strategy based on the first calculation result, specifically including: determining an initial adjustment strategy based on the current voltage state of the power system; calling the RAG module to determine the reactive compensation strategy based on the initial adjustment strategy and the first calculation result, wherein the RAG module optimizes the initial adjustment strategy based on the first calculation result using a preset knowledge graph database to obtain the reactive compensation strategy.

[0036] In this embodiment, when formulating the reactive power compensation strategy of the power system, the RAG technology is used to query the indicator map database based on the current power flow calculation results, and feature judgment is performed based on the power flow calculation results. The state is determined based on the features satisfied by the data, and then the modification operation that should be performed on the state is selected to formulate the next round of adjustment strategies.

[0037] More specifically, the RAG module uses a preset knowledge graph database to search and generate search results. Before searching, the RAG module divides the documents in the preset knowledge graph database into multiple text blocks, and converts the text blocks into vector representations through a preset encoding model, satisfying the following formula: ; In the formula, q is the query vector and di is the knowledge base vector; When performing a search, the RAG module determines the first k most relevant knowledge base vector sets Dk in the knowledge base vectors as the search results according to a preset similarity scoring standard, where k is greater than 0.

[0038] For further information, please refer to Figure 5 , Figure 5 A schematic diagram of a RAG working mechanism provided in this embodiment, such as Figure 5 As shown in FIG, the workflow of RAG is divided into a retrieval phase and a generation phase. In the retrieval phase, RAG pre-segments the documents in the preset indication graph database into text blocks, and uses the encoding model to convert the text blocks into vector representations. During retrieval, the input query is also encoded into a vector representation. Based on the cosine similarity, the similarity between the query vector and the knowledge base vector is calculated to match the information, thereby outputting the retrieval results.

[0039] In the generation phase of the RAG module, the RAG module inputs the retrieved relevant text blocks (knowledge base vector set) and the query input as conditions into the LLM model. The LLM model evaluates all possible generated responses and combines the retrieved knowledge to generate the answer that best meets the query context. The final output response is the intelligent generation and optimization of the retrieved content to ensure that the results are not only accurate but also rich in contextual logic.

[0040] The retrieved knowledge base vector set Dk and the input query q are used as conditional inputs, and LLM generates a response based on the conditional inputs: ; In the formula, y represents the generated response, G represents the above-mentioned LLM model, and LLM selects the one with the largest conditional probability as the optimal response by evaluating all possible generated responses. The optimal response is the most likely and optimal answer generated under given conditions (i.e., the retrieved knowledge base vector set Dk and the input query q): ; In the preset knowledge graph database, the knowledge graph is represented as a triple in the form of G(Gs, Gd, R), where Gs(Ns, Es) represents the knowledge graph pattern graph, Ns and Es represent the nodes and edges of the pattern graph respectively, Gd(Nd, Ed) represents the knowledge graph data graph, Nd and Ed represent the nodes and edges of the data graph respectively, and R is the two layers connecting the knowledge graph, representing the relationship between concepts and entities. The knowledge graph structure is established for the database in the form of "state"-"operation"-"state", where "state" represents the power grid operation parameters, "operation" represents the modification action, and the "state"-"operation"-"state" form represents the transition of the power grid operation state.

[0041] More specifically, the LLM Agent framework further includes an information recording Agent, which is used to record the power flow calculation results and reactive power compensation strategies of the power flow calculation Agent and the parameter adjustment Agent when iteratively adjusting the power system, and the power flow calculation results and reactive power compensation strategies are uploaded to a preset database by the information recording Agent; The preset database is used to record the state and adjustment actions of the power system, specifically including: The state of the power system, such as: S(P(L1, L2, ...), R(LP1, LP2, ...)), where P is the input of the power flow calculation, L1 and L2 are the input parameter matrices, R is the output of the power flow calculation, and LP1 and LP2 are the output power flow states; The adjustment action is A(I, V), where I is the position of the modified data and V is the modified value.

[0042] Specifically, the local database consists of actual data and information recording agent storage data. The formal expression of the power flow adjustment problem is: The current state of the power grid is expressed as S(P(L1, L2, ...), R(LP1, LP2, ...)), where P represents the input of the power flow calculation, L1 and L2 are the input parameter matrices, such as the parameters of the power grid components such as nodes and branches; R represents the output of the power flow calculation, LP1 and LP2 are the output power flow states, such as node voltage and power. The adjustment action is to modify the power grid parameters, that is, the reactive compensation amount of each node, represented by A(I, V), I represents the location of the modified data, and V represents the modified value. In the actual adjustment process, the power grid parameters restricted by the constraints need to be set with a constraint range to avoid the intelligent agent from making arbitrary modifications to them.

[0043] Based on the above embodiments, the adaptive calculation method of the power system operation mode based on LLM Agent proposed in the present invention uses the reasoning ability of the large language model to enhance the adaptability of the power flow calculation adjustment strategy, and calls the power flow calculation module through multiple agents to ensure the accuracy of the power flow calculation, thereby realizing the adaptive operation mode calculation and adjustment process guided by natural language. The retrieval augmented generation (RAG) technology is introduced in the calculation and adjustment process to obtain external knowledge base and database information, further improving the multi-agent framework's ability to understand the power system operation law and the accuracy of decision-making. The present invention gives full play to the advantages of large language in logic and natural language processing, combines industry knowledge enhancement, and integrates with traditional power flow calculation tools to achieve a closed loop of boundary condition adjustment based on power flow calculation results, which can not only enhance the adaptability to the new power system operation form, but also discover new ways to adjust the mode by mining potential operation modes, surpassing the experience limitations of existing operators, automatically identifying and adapting to new operation modes, dynamically adjusting the power flow calculation strategy, and responding quickly to various emergencies to ensure the reliable operation of the system.

[0044] Although the various steps in the above embodiment are described in the above-mentioned order, those skilled in the art can understand that in order to achieve the effect of this embodiment, different steps do not have to be executed in such an order. They can be executed simultaneously (in parallel) or in a reverse order. These simple changes are within the scope of protection of the present invention.

[0045] The second embodiment of the present invention proposes an adaptive computing device for power system operation mode based on LLM Agent. Among them, the adaptive computing device for power system operation mode based on LLM Agent can be a software module, and the software module includes several instructions, which are stored in the memory. The processor can access the memory and call the instructions for execution to complete the adaptive computing method for power system operation mode based on LLM Agent described in the above embodiments. In some embodiments, the adaptive computing device for power system operation mode based on LLM Agent can also be built by hardware devices. For example, the adaptive computing device for power system operation mode based on LLM Agent can be built by one or more chips, and each chip can work in coordination with each other to complete the adaptive computing method for power system operation mode based on LLMAgent described in the above embodiments. For another example, the adaptive computing device for power system operation mode based on LLM Agent can also be built by various logic devices, such as a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (AcornRISCMachine) or other programmable logic devices, discrete gates or transistor logic, discrete hardware components or any combination of these components.

[0046] Please refer to Figure 6 , Figure 6 The figure shows a schematic diagram of the structure of the power system operation mode adaptive calculation device based on LLM Agent. As shown in the figure, the power system operation mode adaptive calculation device based on LLM Agent also includes: A data acquisition module 210 is used to acquire task requirements of the power system; A data input module 220 is used to input the task requirements into the LLM model in the LLM Agent framework. The LLM model is used to parse the input task requirements, determine the task objectives, constraints and action sets, and divide the task requirements into multiple subtasks according to the task objectives and action sets, and determine the Agent used to execute each subtask; A data output module 230 is used to determine the output of the LLM model, and allocate the plurality of subtasks to the power flow calculation agent and parameter adjustment agent of the LLM Agent framework by calling the task management agent of the LLM Agent framework; The data adjustment module 240 is used to call the power flow calculation agent and the parameter adjustment agent to execute the various subtasks assigned by the task management agent, wherein the power flow calculation agent executes the power flow calculation of the power system and determines the power flow calculation result by calling the power flow calculation tool, and the parameter adjustment agent iteratively adjusts the power system according to the power flow calculation result by calling the RAG module until the power system meets the constraint conditions.

[0047] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process and related instructions of the above-described device can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0048] A third embodiment of the present invention provides an electronic device, including: At least one processor; and a memory communicatively connected to at least one of the processors; wherein the memory stores instructions executable by the processor, the instructions being executed by the processor to implement the above-mentioned LLM Agent-based adaptive calculation method for power system operation mode.

[0049] A fourth embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to be executed by the computer to implement the above-mentioned LLM Agent-based power system operation mode adaptive calculation method.

[0050] Technicians in the relevant technical field can clearly understand that, for the convenience and brevity of description, the specific working process and related instructions of the electronic device and computer-readable storage medium described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0051] Those skilled in the art should be able to appreciate that the modules and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two, and the programs corresponding to the software modules and method steps can be placed in random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the technical field. In order to clearly illustrate the interchangeability of electronic hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in electronic hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0052] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system of a server for implementing the method, system, and device embodiments of the present application. Figure 7 The server shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0053] like Figure 7 As shown, the computer system includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 302 or the program loaded from the storage part 308 to the random access memory (RAM) 303. Various programs and data required for system operation are also stored in the random access memory 303. The central processing unit 301, the read-only memory 302 and the random access memory 303 are connected to each other through a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0054] The following components are connected to the input / output interface 305: an input section 306 including a keyboard, a mouse, etc.; an output section 307 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the input / output interface 305 as needed. A removable medium 311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 310 as needed so that a computer program read therefrom is installed into the storage section 308 as needed.

[0055] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 309, and / or installed from the removable medium 311. When the computer program is executed by the central processing unit 301, the above-mentioned functions defined in the method of the present application are executed. It should be noted that the above-mentioned computer-readable medium of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, an apparatus or a device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, an apparatus or a device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0056] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0057] The flow chart and block diagram in the accompanying drawings illustrate the possible implementation framework, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0058] The terms "first", "second", etc. are used to distinguish similar objects, not to describe or indicate a particular order or precedence. The term "comprises" or any other similar term is intended to cover non-exclusive inclusion, so that a process, method, article, or device / apparatus that includes a list of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article, or device / apparatus.

[0059] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

Claims

1. An adaptive calculation method for power system operation mode based on LLM Agent, characterized in that: Applied to the LLMAgent framework, the LLM Agent framework includes an LLM model, multiple Agents, and; A memory system module, including a short-term memory module and a long-term memory module, wherein the short-term memory module is used to provide short-term memory support for the Agent, and the long-term memory module is integrated with a knowledge base, wherein the knowledge base stores historical interaction data and historical optimization records, and the long-term memory module provides long-term memory support for multiple Agents based on the knowledge base; Prompt module, used to adjust the output and optimization behavior of the LLM model; A tool module, including a power flow calculation tool, an API interface and a RAG module. The power flow calculation tool is used to support the Agent to perform data analysis and power system status calculation. The API interface is used to support multiple Agents to interact with external data sources. The RAG module is used to provide retrieval services for the LLM model. The method comprises: Obtain mission requirements for power systems; Input the task requirements into the LLM model in the LLM Agent framework, the LLM model is used to parse the input task requirements, determine the task objectives, constraints and action sets, and split the task requirements into multiple subtasks according to the task objectives and action sets, and determine the Agent used to execute each subtask; Determine the output of the LLM model, and allocate the plurality of subtasks to the power flow calculation agent and parameter adjustment agent of the LLM Agent framework by calling the task management agent of the LLM Agent framework; The power flow calculation agent and the parameter adjustment agent are called to execute the subtasks assigned by the task management agent, wherein the power flow calculation agent executes the power flow calculation of the power system and determines the power flow calculation result by calling the power flow calculation tool, and the parameter adjustment agent iteratively adjusts the power system according to the power flow calculation result by calling the RAG module until the power system meets the constraint condition.

2. The method according to claim 1, characterized in that The calling of the power flow calculation agent and the parameter adjustment agent to execute each subtask assigned by the task management agent includes: Calling the power flow calculation agent, performing an initial power flow calculation on the power system by expanding the node load of the power system, and determining a first calculation result, wherein the first calculation result is received by the parameter adjustment agent; calling the parameter adjustment agent, determining a reactive power compensation strategy according to the first calculation result, and correcting the power system according to the reactive power compensation strategy, wherein the reactive power compensation strategy is transmitted to the power flow calculation agent; Calling the power flow calculation Agent, performing power flow calculation again on the power system after voltage adjustment according to the reactive power compensation strategy, and determining a second calculation result; Repeatedly calling the parameter adjustment Agent to determine whether the power system satisfies the constraint condition according to the second calculation result; If it is determined that the power system does not meet the constraint condition, the power flow calculation Agent is repeatedly called to iteratively correct the power system until the power system meets the preset constraint condition.

3. The method according to claim 2, characterized in that The calling the parameter adjustment agent to determine a reactive power compensation strategy according to the first calculation result includes: Calling the parameter adjustment Agent to synchronously obtain the current voltage state of the power system; According to the current voltage state, determining whether the power system meets preset constraint conditions; If it is determined that the power system does not satisfy the preset constraint condition, the reactive power compensation strategy is determined according to the first calculation result.

4. The method according to claim 3, characterized in that The step of determining the reactive power compensation strategy according to the first calculation result includes: Determining an initial adjustment strategy according to a current voltage state of the power system; Call the RAG module to determine the reactive power compensation strategy according to the initial adjustment strategy and the first calculation result, wherein the RAG module searches a preset knowledge graph database according to the first calculation result to optimize the initial adjustment strategy and obtain the reactive power compensation strategy.

5. The method according to claim 4, characterized in that The RAG module uses a preset knowledge graph database to search and generate search results. Before searching, the RAG module divides the documents in the preset knowledge graph database into multiple text blocks, and converts the text blocks into vector representations through a preset encoding model, satisfying the following formula: ; In the formula, q is the query vector and di is the knowledge base vector; When performing a search, the RAG module determines the top k most relevant knowledge base vector sets D in the knowledge base vectors according to the preset similarity scoring criteria. k As a result of the search, k is greater than 0.

6. The method according to claim 5, characterized in that The RAG module inputs the search results into the LLM model of the LLMAgent framework, and the LLM model generates a response for optimizing the initial adjustment strategy according to the search results, including: The retrieved knowledge base vector set D k and query vector q as conditions to input into the LLM model, and the LLM model generates a corresponding reply according to the condition input: ; Where G is the LLM model, and y is the response generated by the LLM model.

7. The method according to claim 1, characterized in that The LLM Agent framework further includes an information recording Agent, which is used to record the working data of each Agent. The working data is uploaded by the information recording Agent to a preset database, and the preset database is used to store the state and adjustment actions of the power system; The state of the power system is specifically: S(P(L1, L2, ...), R(LP1, LP2, ...)); Where P is the input of power flow calculation, L1 and L2 are input parameter matrices, R is the power flow calculation result, LP1 and LP2 are the output power flow states; The adjustment action is specifically: A(I, V); Where I is the position of the modified parameter, and V is the modified value.

8. An adaptive calculation device for power system operation mode based on LLM Agent, characterized in that: include: Data acquisition module, used to obtain the task requirements of the power system; A data input module, used to input the task requirements into the LLM model in the LLM Agent framework, the LLM model is used to parse the input task requirements, determine the task objectives, constraints and action sets, and split the task requirements into multiple subtasks according to the task objectives and action sets, and determine the Agent used to execute each subtask; A data output module, used for determining the output of the LLM model, and allocating the plurality of subtasks to the power flow calculation agent and parameter adjustment agent of the LLM Agent framework by calling the task management agent of the LLM Agent framework; A data adjustment module is used to call the power flow calculation agent and the parameter adjustment agent to execute each subtask assigned by the task management agent, wherein the power flow calculation agent executes the power flow calculation of the power system and determines the power flow calculation result by calling the power flow calculation tool, and the parameter adjustment agent iteratively adjusts the power system according to the power flow calculation result by calling the RAG module until the power system meets the constraint condition.

9. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to at least one of the processors; wherein, The memory stores instructions that can be executed by the processor, and the instructions are used to be executed by the processor to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to be executed by the computer to implement the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Human-in-loop power grid dispatching system and method driven by large language model

    CN117350501A

  • AI intelligent agent and DAO driven power grid dispatching method

    CN117411180A

  • Multi-agent cooperation method and system

    CN118917632A

  • Power data management credible planning workflow method based on KCMAP

    CN119003744A

  • Electric power system digital twin interaction method and system based on large language model

    CN119442853A

Cited By

  • Network service processing method, electronic equipment and device

    CN120676044A

  • Power grid fault handling method and system based on large model and multiple agents

    CN120746348A

  • Multi-robot cooperation method and system in dynamic environment and electronic equipment

    CN120773027A

  • Power grid test data method and system based on RAG and LLM-Agent

    CN120850614A

  • Rag and llm-agent based power grid test data method and system

    CN120850614B