New energy power system optimization regulation and control system and method based on large language model

The new energy power system control system based on a large language model has achieved automatic conversion from natural language dispatch instructions to optimized code, solving the problem of high professional knowledge requirements in the dispatch of new energy power systems and improving the automation and accuracy of dispatch.

CN121029155APending Publication Date: 2025-11-28TSINGHUA UNIVERSITY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511018245.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-23
Publication Date
2025-11-28

AI Technical Summary

Technical Problem

Existing large language models cannot directly generate dispatch strategies in the dispatch of new energy power systems, and the lack of professional knowledge among new entities leads to a high dispatch threshold. Existing technologies cannot effectively utilize large language models for automatic modeling and optimization.

Method used

Design a new energy power system optimization and control system based on a large language model, including a new energy power system dispatch model knowledge base, an information extraction agent, a problem modeling agent, and a code writing agent. Through multi-turn dialogue and text vectorization model, natural language dispatch instructions are transformed into optimization code to achieve automatic modeling and solving.

Benefits of technology

It reduces the professional knowledge requirements for dispatching new energy power systems, improves the automation and accuracy of dispatching, lowers the dispatching threshold, and enhances the reliability and accuracy of large language models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121029155A_ABST
    Figure CN121029155A_ABST
Patent Text Reader

Abstract

The invention provides a new energy power system optimization regulation and control system and method based on a large language model, and belongs to the technical field of power system operation control. In the system, a new energy power system scheduling model knowledge base stores an objective function and a constraint condition of a new energy power system scheduling problem model; the information extraction agent generates a structured scheduling demand according to an input scheduling instruction based on a natural language and sends the structured scheduling demand to the problem modeling agent; the problem modeling agent calls an objective function and a constraint condition corresponding to the scheduling demand from the new energy power system scheduling model knowledge base to construct a corresponding constraint optimization problem; and the code writing agent converts the constraint optimization problem into an executable code. According to the method, the scheduling instruction based on the natural language can be automatically converted into the optimization code to be output, the optimization result can be obtained after the code is operated, automatic modeling and solving of the new energy power system scheduling problem are achieved, and therefore the threshold of new energy power system scheduling is greatly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of power system operation and control technology, and specifically relates to a new energy power system optimization and control system and method based on a large language model. Background Technology

[0002] With the large-scale integration of distributed renewable energy into the power system, the optimization and control of the power system is becoming increasingly complex. The coupling relationship between active and reactive power and the complex power flow make traditional passive control strategies no longer applicable. New renewable energy power system control strategies need to be proposed to improve the overall economy and security of the power system by adjusting the active and reactive power output of distributed generation resources and controllable equipment.

[0003] On the other hand, with the rapid development of smart grid technology and the gradual improvement of the electricity market system, more and more new entities are participating in power system dispatching, such as distribution operators, virtual power plant managers, and end users. These new entities may lack professional knowledge in power system operation, modeling, optimization, and problem-solving, while the time and economic costs of introducing dispatching experts are too high. Therefore, these new entities urgently need an intelligent dispatching method that can meet their diverse dispatching needs and enable automatic modeling and optimization of dispatching problems in new energy power systems, thereby further lowering the barrier to entry.

[0004] In recent years, the rapid development of large language models has provided a feasible approach for intelligent dispatching of new energy power systems. Following the success of large language models in the field of artificial intelligence, some researchers have begun to apply them to power systems. However, current applications of large language models in power systems mainly focus on areas such as new energy forecasting, load forecasting, text analysis and generation, and intelligent question answering. There has been little exploration of how to use large language models to solve specific dispatching problems, which greatly limits their application in the dispatching field.

[0005] On the other hand, due to the complexity of scheduling problems and their dependence on external knowledge, existing large language models do not have the ability to directly generate scheduling strategies. The key to realizing intelligent scheduling of new energy power systems based on large language models lies in how to decompose scheduling problems, supplement external knowledge, reduce the illusion of large language models, and improve the accuracy and reliability of their content generation. Summary of the Invention

[0006] The purpose of this invention is to overcome the shortcomings of existing technologies and propose an optimization and control system and method for new energy power systems based on a large language model. This invention can automatically convert natural language-based scheduling instructions into optimized code output. After running the code, the optimized results can be obtained, realizing the automatic modeling and solving of new energy power system scheduling problems, thereby greatly reducing the threshold for new energy power system scheduling.

[0007] This invention proposes an optimized control system for a new energy power system based on a large language model, comprising:

[0008] A knowledge base for new energy power system dispatching models, an intelligent agent for information extraction, an intelligent agent for problem modeling, and an intelligent agent for code writing;

[0009] The knowledge base for the new energy power system dispatch model is used to store models of new energy power system dispatch problems. The models include: objective function, power flow constraints, node power constraints, equipment constraints, and security constraints.

[0010] The information extraction agent, built on a large language model, is used to generate structured scheduling requirements based on input natural language-based scheduling instructions and send them to the problem modeling agent. The structured scheduling requirements include: controlled area requirements, scheduling target requirements, controllable device requirements, and security constraint requirements.

[0011] The problem modeling agent, built on a large language model, is used to retrieve the objective function and constraints corresponding to the scheduling requirements from the knowledge base of the new energy power system scheduling model to construct a corresponding constraint optimization problem based on mathematical form, and then send it to the code writing agent.

[0012] The code-writing agent, built on a large language model, is used to transform the received mathematically constrained optimization problem into executable code.

[0013] In one specific embodiment of the present invention, it further includes:

[0014] Multi-turn dialogue prompts are set in the large language model of the problem modeling agent, and the multi-turn dialogue prompts cover modeling information extracted from the knowledge base of new energy power system dispatching model;

[0015] The first round of dialogue prompts covers scheduling targets and controllable devices, guiding the agent to output the mathematical form of the objective function;

[0016] The second round of dialogue prompts covers the scheduling target and controllable devices, guiding the intelligent agent to output the mathematical form of the device constraints;

[0017] The third round of dialogue prompts covers controllable devices, guiding the agent to output the mathematical forms of power flow constraints and node power constraints;

[0018] The fourth round of dialogue prompts covers controllable devices and security constraints, guiding the agent to output the mathematical form of the security constraints;

[0019] The fifth round of dialogue prompts covers the mathematical forms of the objective function, device constraints, power flow constraints and node power constraints, and security constraints output in the first four rounds of dialogue, guiding the agent to output a complete constraint optimization problem based on mathematical forms.

[0020] In one specific embodiment of the present invention, it further includes:

[0021] In the code writing agent, the mathematically-based constraint optimization problem is vectorized using a text vectorization model. The cosine similarity between the vectorized constraint optimization problem and historical optimization problems in a preset sample library is calculated. Then, the M historical optimization problems with the highest similarity and their corresponding codes are extracted from the sample library and embedded into the large language model prompts of the code writing agent.

[0022] In one specific embodiment of the present invention, it further includes:

[0023] The power flow constraints include:

[0024]

[0025] in, ε and P represent the set of nodes and the set of branches in the new energy power system, respectively; i,t and Q i,t V represents the active power injection and reactive power injection at node i at time t, respectively; j,t and θ j,t Let P be the voltage magnitude and voltage phase angle at node j at time t, respectively; ij,t and Q ij,t Let g represent the active power flow and reactive power flow of branch ij at time t, respectively; ij and b ij These are the conductance and susceptance of branch ij, respectively; G ij and B ij Y represents the nodal admittance matrix of the new energy power system. ij The real and imaginary parts of Y, i.e. ij =G ij +jB ij ; where Y ij The calculation method is as follows:

[0026]

[0027] Among them, y ij For the admittance of branch ij, y ii Let be the ground admittance of node i;

[0028] The node power constraints include:

[0029]

[0030] in, and Let be the active power output and reactive power output of the gas turbine at node i at time t, respectively. and These represent the discharge power and charging power of the energy stored at node i at time t, respectively. and Let be the active power output and reactive power output of the photovoltaic system at node i at time t, respectively. Let be the reactive power compensation of the static var compensator at node i at time t; and These represent the active and reactive loads of node i at time t, respectively.

[0031] The equipment constraints include gas turbine constraints, energy storage constraints, photovoltaic constraints, and static var compensator constraints.

[0032] The gas turbine constraints include:

[0033]

[0034] in, and These are the lower and upper limits of the active power output of the gas turbine, respectively. and These are the lower and upper limits of the reactive power output of the gas turbine, respectively. This represents the upper limit of the ramp power of the gas turbine;

[0035] The energy storage constraints include:

[0036]

[0037] in, and These are the upper limits for the discharge power and the charging power of energy storage, respectively. This represents the charging and discharging state of the energy stored at node i at time t. Indicates discharge. Indicates charging; Let be the state of charge of the energy stored at node i at time t; and These represent the lower and upper limits of the energy storage state of charge, respectively; η is the energy storage charge / discharge efficiency; Δt is the energy storage charge / discharge duration; The initial state of charge of the energy storage is T; the total scheduling duration is T.

[0038] The photovoltaic constraints include:

[0039]

[0040] in, This refers to the installed capacity of photovoltaic power.

[0041] The constraints of the static var compensator include:

[0042]

[0043] in, This represents the maximum reactive power compensation of the static var compensator.

[0044] The safety constraints include voltage safety constraints and branch power flow safety constraints;

[0045] The voltage safety constraints include:

[0046]

[0047] Among them, V min and V max These are the lower and upper limits of the voltage amplitude, respectively.

[0048] The branch power flow safety constraints include:

[0049]

[0050] in, This refers to the branch capacity.

[0051] In one specific embodiment of the present invention, it further includes:

[0052] The objective function includes a day-ahead objective and a single-period objective;

[0053] In the aforementioned current objective, the objective function for minimizing operating costs is expressed as:

[0054]

[0055] Where, ρ DG ρ represents the unit power generation cost of a gas turbine. BESS,dis and ρ BESS,cha These are the unit discharge cost and unit charging cost of energy storage, respectively.

[0056] The objective function for minimizing network loss is expressed as:

[0057]

[0058] The objective function for minimizing voltage fluctuations is expressed as:

[0059]

[0060] In the single-time period objective, the objective function for eliminating voltage over-limit is expressed as:

[0061]

[0062] in, Indicates the current moment;

[0063] The objective function for eliminating line overload is expressed as:

[0064]

[0065] In one specific embodiment of the present invention, it further includes:

[0066] Since equations (22) and (23) are non-convex objective functions, we introduce a variable z to transform the objective of the optimization problem into minz, and introduce the corresponding additional constraints equations (24) and (25) to perform convex relaxation:

[0067]

[0068] In one specific embodiment of the present invention, it further includes:

[0069] When constructing a constrained optimization problem, if any type of device is not in operation, the corresponding item for that device is removed from the objective function and constraints.

[0070] In one specific embodiment of the present invention, it further includes:

[0071] When constructing a constrained optimization problem, if the objective function is a day-ahead objective, then the equipment constraints include time-coupled constraints, i.e., equations (10), (14)-(16); if the objective function is a single-time-period objective, then the time-coupled constraints are removed from the equipment constraints.

[0072] This invention also proposes an optimized control method for a new energy power system based on the above system, comprising:

[0073] 1) Store the objective function, power flow constraints, node power constraints, equipment constraints, and security constraints contained in the new energy power system dispatch problem model into the new energy power system dispatch model knowledge base;

[0074] 2) The dispatcher inputs the natural language dispatch instructions into the information extraction agent, and the information extraction agent outputs the structured dispatch requirements and sends them to the problem modeling agent;

[0075] 3) The problem modeling agent retrieves the objective function and constraints corresponding to the received structured scheduling requirements from the knowledge base of the new energy power system scheduling model through multi-turn dialogue, so as to construct the corresponding constraint optimization problem based on mathematical form, and then sends it to the code writing agent.

[0076] 4) The code writing agent uses a text vectorization model to vectorize the constraint optimization problem based on mathematical form. It calculates the cosine similarity between the vectorized constraint optimization problem and the historical optimization problems in the preset sample library. Then, it extracts the M historical optimization problems with the highest similarity and their corresponding codes from the sample library and embeds them into the large language model prompt words of the code writing agent. The code writing agent outputs the optimization code.

[0077] 5) The scheduler runs the code to write the code output by the intelligent agent and obtains the final scheduling strategy.

[0078] The features and beneficial effects of this invention are as follows:

[0079] 1) This invention realizes the automatic conversion from natural language-based scheduling instructions to optimized code, effectively reducing the need for scheduling personnel to have professional knowledge in modeling, optimization, and solving, and lowering the scheduling threshold.

[0080] 2) This invention decomposes the new energy power system scheduling problem and proposes a multi-agent collaborative reasoning decision-making framework, which includes an information extraction agent based on a large language model, a problem modeling agent based on a large language model, and a code writing agent based on a large language model. Each agent handles a single professional problem, reducing the workload and professional knowledge requirements of each agent.

[0081] 3) This invention proposes methods such as prompt words, multi-turn dialogue, and external knowledge supplementation for the automatic modeling and solution of the scheduling problem of new energy power system, which avoids the illusion of large language model in content generation process and improves the accuracy and reliability of large language model. Attached Figure Description

[0082] Figure 1 This is a schematic diagram of the structure of a new energy power system optimization and control system based on a large language model, according to an embodiment of the present invention. Detailed Implementation

[0083] This invention proposes an optimization and control system and method for new energy power systems based on a large language model. The following is a detailed description in conjunction with the accompanying drawings and specific embodiments.

[0084] This invention proposes an optimized control system for a new energy power system based on a large language model, the structure of which is as follows: Figure 1 As shown, it includes: a knowledge base for new energy power system dispatching models, an information extraction intelligent agent, a problem modeling intelligent agent, and a code writing intelligent agent.

[0085] The knowledge base for scheduling models of new energy power systems is used to store typical scheduling problem models of new energy power systems. The scheduling problem models include: objective function, power flow constraints, node power constraints, equipment constraints, and security constraints.

[0086] The information extraction agent, built upon a large language model, generates unified, structured scheduling requirements based on input natural language-based scheduling instructions and sends these requirements to the problem modeling agent. These structured scheduling requirements encompass four categories of information: controlled area requirements, scheduling target requirements, controllable equipment requirements, and security constraint requirements. This information extraction agent can extract effective information from the scheduling instructions, facilitating processing by downstream agents.

[0087] The problem modeling agent, built on a large language model, is used to retrieve the objective function and constraints corresponding to the received structured scheduling requirements from the knowledge base of the new energy power system scheduling model to construct a corresponding constraint optimization problem based on mathematical form, and then send it to the code writing agent.

[0088] The code-writing agent, built on a large language model, is used to transform the received mathematically constrained optimization problem into executable code (in this embodiment, the output is Python code). The scheduler can then run this code to obtain the corresponding scheduling strategy.

[0089] Furthermore, in this embodiment, the constraints and objective functions stored in the knowledge base of the new energy power system dispatch model include:

[0090] The power flow constraints are as follows:

[0091]

[0092]

[0093] in, ε and P represent the set of nodes and the set of branches in the new energy power system, respectively; i,t and Q i,t V represents the active power injection and reactive power injection at node i at time t, respectively; j,t and θ j,t Let P be the voltage magnitude and voltage phase angle at node j at time t, respectively; ij,tand Q ij,t Let g represent the active power flow and reactive power flow of branch ij at time t, respectively; ij and b ij These are the conductance and susceptance of branch ij, respectively; G ij and B ij Y represents the nodal admittance matrix of the new energy power system. ij The real and imaginary parts of Y, i.e. ij =G ij +jB ij ; where Y ij The calculation method is as follows:

[0094]

[0095] Among them, y ij For the admittance of branch ij, y ii Let be the ground admittance of node i.

[0096] In this embodiment, the distributed generation resources of the new energy power system include gas turbines, energy storage, photovoltaics, and static var compensators. If all devices are controllable and in operation, the node power constraint can be expressed as:

[0097]

[0098] in, and Let be the active power output and reactive power output of the gas turbine at node i at time t, respectively. and These represent the discharge power and charging power of the energy stored at node i at time t, respectively. and Let be the active power output and reactive power output of the photovoltaic system at node i at time t, respectively. Let be the reactive power compensation of the static var compensator at node i at time t; and These represent the active and reactive loads of node i at time t, respectively. If any device is not in operation, such as being in a fault, maintenance, or disconnected state, the active and reactive loads corresponding to that device can be removed from equations (6) and (7), respectively.

[0099] In this embodiment, the equipment constraints include gas turbine constraints, energy storage constraints, photovoltaic constraints, and static var compensator constraints.

[0100] The gas turbine constraint can be expressed as:

[0101]

[0102] in, and These are the lower and upper limits of the active power output of the gas turbine, respectively. and These are the lower and upper limits of the reactive power output of the gas turbine, respectively. This represents the upper limit of the ramp power of the gas turbine.

[0103] Energy storage constraints can be expressed as:

[0104]

[0105] in, and These are the upper limits for the discharge power and the charging power of energy storage, respectively. This represents the charging and discharging state of the energy stored at node i at time t. Indicates discharge. Indicates charging; Let be the state of charge of the energy stored at node i at time t; and These represent the lower and upper limits of the energy storage state of charge, respectively; η is the energy storage charge / discharge efficiency; Δt is the energy storage charge / discharge duration; The initial state of charge of the energy storage is T; the total scheduling time is T; Equation (16) indicates that the state of charge of the energy storage should be the same as the initial state at the end of the scheduling.

[0106] Photovoltaic constraints can be expressed as:

[0107]

[0108] in, This refers to the installed capacity of photovoltaic power.

[0109] The constraints of a static var compensator can be expressed as:

[0110]

[0111] in, This represents the maximum reactive power compensation of the static var compensator.

[0112] In this embodiment, the objective function includes two types: day-ahead objectives and time-period objectives. Common day-ahead objectives include: minimizing operating costs, minimizing network losses, and minimizing voltage fluctuations. Common time-period objectives include: eliminating voltage overruns and eliminating line overloads.

[0113] In the current objective, the objective function for minimizing operating costs can be expressed as:

[0114]

[0115] Where, ρ DG ρ represents the unit power generation cost of a gas turbine. BESS,dis and ρBESS,cha These represent the unit discharge cost and unit charging cost of energy storage, respectively. If any device is not in operation, such as being in a fault, maintenance, or grid disconnection state, the cost item corresponding to that device can be removed from equation (19).

[0116] The objective function for minimizing network loss can be expressed as:

[0117]

[0118] The objective function for minimizing voltage fluctuations can be expressed as:

[0119]

[0120] In a single-time period, the objective function for eliminating voltage over-limits can be expressed as:

[0121]

[0122] in, Indicates the current moment.

[0123] The objective function for eliminating line overload can be expressed as:

[0124]

[0125] Since equations (22) and (23) are non-convex objective functions, they cannot be solved directly. In actual solution, a new variable z needs to be introduced to transform the objective of the optimization problem into minz, and corresponding additional constraints (24) and (25) are introduced for convex relaxation:

[0126]

[0127] In this embodiment, the safety constraints include voltage safety constraints and branch power flow safety constraints.

[0128] The voltage safety constraints are as follows:

[0129]

[0130] Among them, V min and V max These are the lower and upper limits of the voltage amplitude, respectively.

[0131] Branch power flow safety constraints are as follows:

[0132]

[0133] in, This refers to the branch capacity.

[0134] When modeling a complete mathematical optimization problem, it is only necessary to write out the corresponding power flow constraints, node power constraints, equipment constraints, objective function, and security constraints according to the scheduling requirements. It should be emphasized that if the objective function is a day-ahead objective, the time coupling constraints in the equipment constraints, i.e., equations (10), (14)-(16), need to be considered; if the objective function is a single-time-period objective, the time coupling constraints in the equipment constraints can be ignored.

[0135] Furthermore, in this embodiment, the large language model used by the information extraction agent is Qwen-Plus, version "2025-04-28", with a temperature coefficient of 0.6 and a top-p of 0.7.

[0136] Before use, this embodiment requires setting prompts for the large language model of the information extraction agent. These prompts cover the large language model role description, large language model task description, new energy power system scenario description, output format description, and examples. In this embodiment, the number of examples is 3.

[0137] In a specific embodiment of the present invention, the prompt words of a typical large language model for an information extraction agent are as follows:

[0138] "You are an expert in power system operation and optimization. The dispatcher has a power system and will provide a dispatch request. You need to identify and extract valid and relevant information from the request."

[0139] The following is information about the system:

[0140] #Controlled Area

[0141] The system comprises three zones: a residential zone, an industrial zone, and a commercial zone. Only one of these three zones will be specified in the request.

[0142] #Scheduling Objective

[0143] Users have two types of goals: daily goals and single-period goals.

[0144] The current objectives include: minimizing operating costs, minimizing network losses, and minimizing voltage fluctuations.

[0145] Single-period objectives include: eliminating voltage overruns and eliminating line overloads. Only one of these objectives will be included in the request.

[0146] #Controllable devices

[0147] The power distribution network includes the following equipment: gas turbines, energy storage, photovoltaic systems, and static var compensators. The request may involve several of these devices.

[0148] #Safety Constraints

[0149] The request may also contain some additional security constraints: voltage security constraints and branch power flow security constraints. The request may contain several of these constraints.

[0150] The scheduling request may contain the controlled area, scheduling objective, controllable devices, and security constraint information in an explicit or implicit manner. Your task is to extract them and output them in the following format:

[0151] # Output format

[0152] <Controlled area>An area identified from residential areas, industrial areas, and commercial areas< / Controlled area>

[0153] <Scheduling objective>An objective identified from minimizing operating costs, minimizing network losses, minimizing voltage fluctuations, eliminating voltage violations, and eliminating line overloads< / Scheduling objective>

[0154] <Controllable devices>Controllable devices identified from gas turbines, energy storage, photovoltaic, and static var compensators< / Controllable devices>

[0155] <Security constraint>Identified security constraints, such as voltage security constraints and branch power flow security constraints, etc.< / Security constraint>

[0156] The following are several examples:

[0157] # Example 1

[0158] Request:

[0159] Please try to reduce the operating costs of the residential area tomorrow. You can use gas turbines, energy storage systems, and photovoltaic systems. Note: Ensure that the voltage is within the limit range and the line is not overloaded.

[0160] Output: [[ID=​​​​​​​​​​​​​​​​​​​​

[0168] Output:

[0169] <Controlled Area>Industrial Area< / Controlled Area>

[0170] <Dispatch Objective>Minimize voltage fluctuations< / Dispatch Objective>

[0171] <Controllable Devices>Gas turbines, energy storage, photovoltaic, static var compensator< / Controllable Devices>

[0172] <Safety Constraint>None< / Safety Constraint>

[0173] # Example 3

[0174] Request:

[0175] Note: The voltage in the commercial area is now below the lower limit. Please use photovoltaic and compensation devices to ensure voltage safety.

[0176] Output:

[0177] <Controlled Area>Commercial Area< / Controlled Area>

[0178] <Dispatch Objective>Eliminate voltage violations< / Dispatch Objective>

[0179] <Controllable Devices>Photovoltaic, static var compensator< / Controllable Devices>

[0180] <Safety Constraint>None< / Safety Constraint>

[0181] Now, the user provides a specific dispatch request. Please gradually analyze and extract the corresponding controlled area, dispatch objective, controllable devices, and safety constraints based on the provided information.

[0182] In this embodiment, the large language model adopted by the problem modeling agent is Qwen-Plus, with the version "2025-04-28", the temperature coefficient is 0.6, and top-p is 0.7.

[0183] Before use, this embodiment needs to set the prompt words of the large language model for the problem modeling agent, which cover the role description of the large language model, the task description of the large language model, etc.; and set the multi-round dialogue prompt words, which cover the modeling information extracted from the new energy power system dispatch model knowledge base.

[0184] In a specific embodiment of the present invention, the prompt words of the large language model of a typical problem modeling agent are as follows:

[0185] "You are an expert in the operation and optimization of power systems. The dispatcher has a dispatch request. In the following multi-round dialogue, please write the required information in mathematical format according to the given knowledge base information."

[0186] The first round of dialogue prompts covers scheduling targets and controllable devices, guiding the agent to output the mathematical form of the objective function.

[0187] In one specific embodiment of the present invention, a typical first-round dialogue prompt is as follows:

[0188] "The dispatcher's objective is the <dispatch objective>. Controllable equipment includes <controllable equipment>."

[0189] The detailed description of this objective is as follows: <Detailed Description of Scheduling Objective>.

[0190] Based on the given scheduling objective, controllable equipment, and detailed specifications, please write the corresponding objective function in mathematical format. Note: Only write the objective function; do not include other mathematical formulas.

[0191] During the dialogue, <Scheduling Target> will be replaced with the scheduling target identified by the information extraction agent, <Controllable Device> will be replaced with the controllable device identified by the information extraction agent, and <Detailed Description of Scheduling Target> will be replaced with the corresponding scheduling target modeling information in the knowledge base.

[0192] The second round of dialogue prompts covers scheduling objectives and controllable devices, guiding the agent to output the mathematical form of device constraints.

[0193] In one specific embodiment of the present invention, a typical second-round dialogue prompt is as follows:

[0194] "The dispatcher's objective is the <dispatch objective>. Controllable equipment includes <controllable equipment>."

[0195] The detailed description of equipment constraints is as follows: <Detailed Description of Equipment Constraints>.

[0196] Based on the given scheduling objective, controllable equipment, and detailed specifications, please write out the corresponding equipment constraints using mathematical format. Note: Only write out the equipment constraints; do not include other mathematical formulas.

[0197] During the dialogue, <scheduling target> will be replaced with the scheduling target identified by the information extraction agent, <controllable device> will be replaced with the controllable device identified by the information extraction agent, and <detailed device constraint description> will be replaced with the corresponding device constraint modeling information in the knowledge base.

[0198] The third round of dialogue prompts covers controllable devices, guiding the agent to output the mathematical forms of power flow constraints and node power constraints.

[0199] In a specific embodiment of the present invention, a typical third-round dialogue prompt is as follows:

[0200] "Controllable equipment includes <controllable equipment>."

[0201] The detailed explanation of power flow constraints and node power constraints is as follows: <Detailed Explanation of Power Flow Constraints and Node Power Constraints>.

[0202] Based on the given controllable equipment and detailed specifications, please write out the corresponding power flow constraints and nodal power constraints using mathematical format. Note: Only write out the power flow constraints and nodal power constraints; do not include other mathematical formulas.

[0203] During the dialogue, "<controllable device>" will be replaced with the controllable device identified by the information extraction agent, and "<detailed description of power flow constraints and node power constraints>" will be replaced with the corresponding power flow constraints and node power constraints modeling information in the knowledge base.

[0204] The fourth round of dialogue prompts covers controllable devices and security constraints, guiding the agent to output the mathematical form of the security constraints.

[0205] In a specific embodiment of the present invention, a typical fourth-round dialogue prompt is as follows:

[0206] "Controllable equipment includes <controllable equipment>. Safety constraints include <safety constraints>."

[0207] The safety constraints are detailed below: <Detailed Description of Safety Constraints>.

[0208] Given the controllable equipment, safety constraints, and detailed specifications, please write out the corresponding safety constraints using mathematical format. Note: Only write out the safety constraints; do not include other mathematical formulas.

[0209] During the dialogue, <Security Constraints> will be replaced with the security constraints identified by the information extraction agent, and <Detailed Description of Security Constraints> will be replaced with the corresponding security constraint modeling information in the knowledge base.

[0210] The fifth round of dialogue prompts covers the mathematical forms of the objective function, device constraints, power flow constraints and node power constraints, and security constraints output in the first four rounds of dialogue, guiding the agent to output a complete constraint optimization problem based on mathematical forms.

[0211] In a specific embodiment of the present invention, a typical fifth-round dialogue prompt is as follows:

[0212] The mathematical format of the objective function is: <Mathematical Format of Objective Function>.

[0213] The mathematical format for equipment constraints is: <Mathematical Format for Equipment Constraints>.

[0214] The mathematical format for power flow constraints and node power constraints is: <Mathematical format for power flow constraints and node power constraints>.

[0215] The mathematical form of the security constraint is: <Security constraint mathematical form>.

[0216] Based on the above information, please summarize the complete constraint optimization problem in mathematical form as follows. Note that the symbols in all formulas should be uniformly defined. The output format should be:

[0217] <Constraint optimization problem> Please fill in this part with the complete constraint optimization problem. < / Constraint optimization problem>”

[0218] During the conversation, <Objective function mathematical form>, <Device constraint mathematical form>, <Power flow constraint and node power constraint mathematical form>, <Security constraint mathematical form> will be replaced with the outputs of the large model in the first four rounds of conversation respectively.

[0219] In this embodiment, the multi-round conversation form of the problem modeling agent effectively avoids the phenomena of large language model hallucination and information loss, and improves the modeling accuracy.

[0220] In this embodiment, the large language model adopted by the code writing agent is Qwen-Plus, the version is "2025-04-28", the temperature coefficient is 0.6, and top-p is 0.7.

[0221] Before use, this embodiment needs to set the prompt words of the large language model of the code writing agent, covering the role description of the large language model, the task description of the large language model, the complete constraint optimization problem based on the mathematical form, the detailed explanation of the example format, the detailed explanation of the modeling language, examples, etc. In this embodiment, the number of examples is 3.

[0222] In a specific embodiment of the present invention, the prompt words of the large language model of a typical code writing agent are as follows: [[ID=​​​​​​​​​​​​​​​​Note: PyOptInterface only needs to be imported. For the solver part, we use Gurobi, so it needs to be imported from pyoptinterface.

[0229] #Model

[0230] model = gurobi.Model()

[0231] Note: To create a model, you need to import the corresponding module and call the constructor of the model class.

[0232] #variable

[0233] model.add_m_variables()

[0234] Note: Add multidimensional variables to the model.

[0235] #Linear constraints

[0236] model.add_linear_constraint()

[0237] Note: Add linear constraints to the model.

[0238] #Secondary Constraints

[0239] model.add_quadratic_constraint()

[0240] Note: Add quadratic constraints to the model.

[0241] #Second-order cone constraint

[0242] model.add_second_order_cone_constraint()

[0243] Note: Add a second-order cone constraint to the model.

[0244] #Objective function

[0245] model.set_objective()

[0246] Note: Set the objective function of the model.

[0247] #Solving optimization problems

[0248] model.optimize()

[0249] Note: Call the solver to solve the constructed constraint optimization problem.

[0250] #Get Results

[0251] model.get_value()

[0252] Note: After optimization, retrieve the value of a specific expression or variable.

[0253] The following is a detailed explanation of the example format:

[0254] This example is a Python dictionary with the following keys:

[0255] T: An integer representing the scheduling duration.

[0256] current_t: An integer representing the current time index.

[0257] BESS_num: An integer representing the amount of energy stored.

[0258] MVA: A floating-point number representing a baseline value for power.

[0259] rho_DG: A floating-point number representing the power generation cost coefficient of the gas turbine.

[0260] rho_BESS_dis: A floating-point number representing the cost factor for energy storage discharge.

[0261] rho_BESS_cha: A floating-point number representing the cost factor for energy storage charging.

[0262] bus: An array representing the node model in the power grid.

[0263] branch: An array representing the branch model in the power grid.

[0264] gen: An array representing the equipment models in the power grid.

[0265] P_DG_max: A floating-point number representing the upper limit of the active power of the gas turbine.

[0266] P_DG_min: A floating-point number representing the lower limit of the active power of the gas turbine.

[0267] Q_DG_max: A floating-point number representing the upper limit of reactive power of the gas turbine.

[0268] Q_DG_min: A floating-point number representing the lower limit of the reactive power of the gas turbine.

[0269] R_max: A floating-point number representing the ramp rate limit of the gas turbine.

[0270] S_PV_max: A floating-point number representing the installed capacity of photovoltaic power.

[0271] P_BESS_dis_max: A floating-point number representing the upper limit of the energy storage discharge power.

[0272] P_BESS_cha_max: A floating-point number representing the upper limit of the energy storage charging power.

[0273] SOC_BESS_max: A floating-point number representing the upper limit of the energy storage state of charge.

[0274] SOC_BESS_min: A floating-point number representing the lower limit of the energy storage state of charge.

[0275] SOC_init: A floating-point number representing the initial state of charge of the stored energy.

[0276] Q_SVC_max: A floating-point number representing the upper limit of reactive power of the static var compensator.

[0277] eta: A floating-point number representing the energy storage charging and discharging efficiency.

[0278] V_max: A floating-point number representing the upper limit of the node voltage.

[0279] V_min: A floating-point number representing the lower limit of the node voltage.

[0280] S_branch_max: A floating-point number representing the maximum capacity of a branch.

[0281] PV: An array representing the photovoltaic output at each point in time.

[0282] P_load: An array representing the active load at each time point.

[0283] Q_load: An array representing the reactive load at each time point.

[0284] Here are 3 examples:

[0285] <Example 1>

[0286] <Example 2>

[0287] <Example 3>

[0288] The following is the mathematical form of the constrained optimization problem:

[0289] <Constrained Optimization Problem>

[0290] Please write complete Python code based on the given instructions and examples.

[0291] During the conversation, the <constraint optimization problem> is replaced with the output of the problem modeling agent. <Example 1>, <Example 2>, and <Example 3> are the problem codes that are the most similar to the current one retrieved from the historical optimization problem sample library. The retrieval method is as follows:

[0292] Furthermore, in this embodiment, in the code writing agent, a text vectorization model is used to vectorize the current constraint optimization problem in mathematical form, calculate the cosine similarity between the vectorized constraint optimization problem and the historical optimization problems in the preset sample library, and thus retrieve the M (in a specific embodiment of the present invention, M is 3) historical optimization problems with the highest similarity and the corresponding codes from the sample library and embed them into the prompt words of the large language model of the code writing agent. In this embodiment, the text vectorization model is text-embedding-v3, the vector dimension is 1024, and the number of historical optimization problems in the sample library is 10. This ensures that the code written by the code writing agent can refer to the most similar historical optimization problems, improving the accuracy of the content output of the large language model.

[0293] Furthermore, this embodiment also proposes a new energy power system optimization regulation method based on the above system, including the following steps:

[0294] 1) Store the objective function, power flow constraints, node power constraints, equipment constraints, and security constraints included in the new energy power system typical scheduling problem model in the new energy power system scheduling model knowledge base.

[0295] 2) The dispatcher inputs the natural language dispatching instruction information into the information extraction agent, and the information extraction agent outputs unified structured dispatching requirements and sends them to the problem modeling agent. The structured dispatching requirements cover four types of information: controlled area requirements, dispatching target requirements, controllable device requirements, and security constraint requirements.

[0296] For example, a typical input is:

[0297] "We need a dispatching strategy to reduce the network loss in the business district tomorrow, and the photovoltaic and compensator can be called, and the voltage constraint is satisfied."

[0298] Under the above input, the output of the information extraction agent is:

[0299] "<Controlled area>Business district< / Controlled area>

[0300] <Dispatching target>Minimize network loss< / Dispatching target>

[0301] <Controllable devices>Photovoltaic, static var compensator< / Controllable devices>

[0302] <Security constraint>Voltage security constraint< / Security constraint>"

[0303] 3) The problem modeling agent retrieves the objective function and constraints corresponding to the received structured scheduling requirements from the knowledge base of the new energy power system scheduling model through multi-turn dialogue, so as to construct the corresponding constraint optimization problem based on mathematical form, and then sends it to the code writing agent.

[0304] For example, based on the output of the information extraction agent, the first round of dialogue output of the problem modeling agent is the mathematical form of the objective function of the constrained optimization problem:

[0305]

[0306] The second round of dialogue output from the problem-modeling agent is the mathematical form of the device constraints for the constraint optimization problem:

[0307]

[0308] The third round of dialogue output from the problem-modeling agent is the mathematical form of the power flow constraints and node power constraints for the constraint optimization problem:

[0309]

[0310] The fourth round of dialogue output from the problem-modeling agent is the mathematical form of the safety constraints for the constraint optimization problem:

[0311]

[0312] The fifth round of dialogue output from the problem-modeling agent yields the complete mathematical form of the constrained optimization problem:

[0313]

[0314]

[0315] 4) The code writing agent uses a text vectorization model to vectorize the complete optimization problem based on mathematical form. It calculates the cosine similarity between the vectorized constrained optimization problem and the historical optimization problems in the preset sample library. Then, it extracts the three historical optimization problems with the highest similarity and their corresponding codes from the sample library and embeds them into the large language model prompt words of the code writing agent. The code writing agent outputs the optimization code.

[0316] 5) The scheduler runs the code to write the code output by the intelligent agent and obtains the final scheduling strategy.

Claims

1. A new energy power system optimization and control system based on a large language model, characterized in that, include: A knowledge base for new energy power system dispatching models, an intelligent agent for information extraction, an intelligent agent for problem modeling, and an intelligent agent for code writing; The knowledge base for the new energy power system dispatch model is used to store models of new energy power system dispatch problems. The models include: objective function, power flow constraints, node power constraints, equipment constraints, and security constraints. The information extraction agent, built on a large language model, is used to generate structured scheduling requirements based on input natural language-based scheduling instructions and send them to the problem modeling agent. The structured scheduling requirements include: controlled area requirements, scheduling target requirements, controllable device requirements, and security constraint requirements. The problem modeling agent, built on a large language model, is used to retrieve the objective function and constraints corresponding to the scheduling requirements from the knowledge base of the new energy power system scheduling model to construct a corresponding constraint optimization problem based on mathematical form, and then send it to the code writing agent. The code-writing agent, built on a large language model, is used to transform the received mathematically constrained optimization problem into executable code.

2. The system according to claim 1, characterized in that, Also includes: Multi-turn dialogue prompts are set in the large language model of the problem modeling agent, and the multi-turn dialogue prompts cover modeling information extracted from the knowledge base of new energy power system dispatching model; The first round of dialogue prompts covers scheduling targets and controllable devices, guiding the agent to output the mathematical form of the objective function; The second round of dialogue prompts covers the scheduling target and controllable devices, guiding the intelligent agent to output the mathematical form of the device constraints; The third round of dialogue prompts covers controllable devices, guiding the agent to output the mathematical forms of power flow constraints and node power constraints; The fourth round of dialogue prompts covers controllable devices and security constraints, guiding the agent to output the mathematical form of the security constraints; The fifth round of dialogue prompts covers the mathematical forms of the objective function, device constraints, power flow constraints and node power constraints, and security constraints output in the first four rounds of dialogue, guiding the agent to output a complete constraint optimization problem based on mathematical forms.

3. The system according to claim 2, characterized in that, Also includes: In the code writing agent, the mathematically-based constraint optimization problem is vectorized using a text vectorization model. The cosine similarity between the vectorized constraint optimization problem and historical optimization problems in a preset sample library is calculated. Then, the M historical optimization problems with the highest similarity and their corresponding codes are extracted from the sample library and embedded into the large language model prompts of the code writing agent.

4. The system according to claim 3, characterized in that, Also includes: The power flow constraints include: in, ε and P represent the set of nodes and the set of branches in the new energy power system, respectively; i,t and Q i,t V represents the active power injection and reactive power injection at node i at time t, respectively; j,t and θ j,t Let P be the voltage magnitude and voltage phase angle at node j at time t, respectively; ij,t and Q ij,t Let g represent the active power flow and reactive power flow of branch ij at time t, respectively; ij and b ij These are the conductance and susceptance of branch ij, respectively; G ij and B ij Y represents the nodal admittance matrix of the new energy power system. ij The real and imaginary parts of Y, i.e. ij =G ij +jB ij ; where Y ij The calculation method is as follows: Among them, y ij For the admittance of branch ij, y ii Let be the ground admittance of node i; The node power constraints include: in, and Let be the active power output and reactive power output of the gas turbine at node i at time t, respectively. and These represent the discharge power and charging power of the energy stored at node i at time t, respectively. and Let be the active power output and reactive power output of the photovoltaic system at node i at time t, respectively. Let be the reactive power compensation of the static var compensator at node i at time t; and These represent the active and reactive loads of node i at time t, respectively. The equipment constraints include gas turbine constraints, energy storage constraints, photovoltaic constraints, and static var compensator constraints. The gas turbine constraints include: in, and These are the lower and upper limits of the active power output of the gas turbine, respectively. and These are the lower and upper limits of the reactive power output of the gas turbine, respectively. This represents the upper limit of the ramp power of the gas turbine; The energy storage constraints include: in, and These are the upper limits for the discharge power and the charging power of energy storage, respectively. This represents the charging and discharging state of the energy stored at node i at time t. Indicates discharge. Indicates charging; Let be the state of charge of the energy stored at node i at time t; and These represent the lower and upper limits of the energy storage state of charge, respectively; η is the energy storage charge / discharge efficiency; Δt is the energy storage charge / discharge duration; The initial state of charge of the energy storage is T; the total scheduling duration is T. The photovoltaic constraints include: in, This refers to the installed capacity of photovoltaic power. The constraints of the static var compensator include: in, This represents the maximum reactive power compensation of the static var compensator. The safety constraints include voltage safety constraints and branch power flow safety constraints; The voltage safety constraints include: Among them, V min and V max These are the lower and upper limits of the voltage amplitude, respectively. The branch power flow safety constraints include: in, This refers to the branch capacity.

5. The system according to claim 4, characterized in that, Also includes: The objective function includes a day-ahead objective and a single-period objective; In the aforementioned current objective, the objective function for minimizing operating costs is expressed as: Where, ρ DG ρ represents the unit power generation cost of a gas turbine. BESS,dis and ρ BESS,cha These are the unit discharge cost and unit charging cost of energy storage, respectively. The objective function for minimizing network loss is expressed as: The objective function for minimizing voltage fluctuations is expressed as: In the single-time period objective, the objective function for eliminating voltage over-limit is expressed as: in, Indicates the current moment; The objective function for eliminating line overload is expressed as:

6. The system according to claim 5, characterized in that, Also includes: Since equations (22) and (23) are non-convex objective functions, we introduce a variable z to transform the objective of the optimization problem into minz, and introduce the corresponding additional constraints equations (24) and (25) to perform convex relaxation:

7. The system according to claim 5, characterized in that, Also includes: When constructing a constrained optimization problem, if any type of device is not in operation, the corresponding item for that device is removed from the objective function and constraints.

8. The system according to claim 5, characterized in that, Also includes: When constructing a constrained optimization problem, if the objective function is a day-ahead objective, then the equipment constraints include time-coupled constraints, i.e., equations (10), (14)-(16); if the objective function is a single-time-period objective, then the time-coupled constraints are removed from the equipment constraints.

9. A method for optimizing and controlling a new energy power system based on the system described in any one of claims 3-8, characterized in that, include: 1) Store the objective function, power flow constraints, node power constraints, equipment constraints, and security constraints contained in the new energy power system dispatch problem model into the new energy power system dispatch model knowledge base; 2) The dispatcher inputs the natural language dispatch instructions into the information extraction agent, and the information extraction agent outputs the structured dispatch requirements and sends them to the problem modeling agent; 3) The problem modeling agent retrieves the objective function and constraints corresponding to the received structured scheduling requirements from the knowledge base of the new energy power system scheduling model through multi-turn dialogue, so as to construct the corresponding constraint optimization problem based on mathematical form, and then sends it to the code writing agent. 4) The code writing agent uses a text vectorization model to vectorize the constraint optimization problem based on mathematical form. It calculates the cosine similarity between the vectorized constraint optimization problem and the historical optimization problems in the preset sample library. Then, it extracts the M historical optimization problems with the highest similarity and their corresponding codes from the sample library and embeds them into the large language model prompt words of the code writing agent. The code writing agent outputs the optimization code. 5) The scheduler runs the code to write the code output by the intelligent agent and obtains the final scheduling strategy.

Citation Information

Cited By

  • Power distribution network optimization scheduling method and system based on multi-agent system

    CN121727139A