Comprehensive energy storage system optimization method based on constraint perception reinforcement learning
By constructing a Q-value network and converting it into a mixed integer programming model based on the method of constraint-aware reinforcement learning, combined with microgrid constraints, the problems of computational efficiency and constraint satisfaction in integrated energy system optimization are solved, and efficient energy scheduling and constraint satisfaction are achieved. .
Patent Information
- Application Number
- CN202410657028.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-05-24
AI Technical Summary
It is difficult for existing technologies to simultaneously achieve efficient calculation and meet operational constraints in integrated energy system optimization, especially when faced with uncertain factors such as weather and price fluctuations. Mathematical programming methods are highly computationally efficient but difficult to obtain the global optimal solution, while strengthening The learning algorithm may not satisfy system constraints.
Using a method based on constraint-aware reinforcement learning, by constructing a Q-value network and converting it into a mixed integer programming model, combined with the constraints of the microgrid, a deep reinforcement learning algorithm is used to train the Q-value network, and the gurobi solver is used to solve the optimal action to achieve energy dispatch.
It effectively solves the problem of uncertainty and increased computational complexity, while ensuring that the scheduling scheme meets all operating constraints and ensures feasibility in real-time operations.
Smart Images

Figure CN118735028A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a comprehensive energy storage system optimization method based on constraint-aware reinforcement learning, and belongs to the field of energy system optimization. Background Art
[0002] The development of integrated energy systems supports the integration of diversified energy resources, including solar energy, wind energy, bioenergy, etc., and promotes the efficient use of energy and the innovation of energy storage technology. At present, mathematical programming or reinforcement learning algorithms are often used to solve integrated energy optimization problems. Among them, mathematical programming refers to establishing a mathematical model of the research object, and then using solving tools such as Cplex to obtain the optimal solution to achieve optimization. This method has high computational efficiency, but for many uncertain factors in the energy system, such as weather and price fluctuations, it is difficult for mathematical programming methods to obtain the global optimal solution. Reinforcement learning algorithms solve this problem well. They can interactively learn the dynamics of the energy system and provide high-quality solutions, but the solution may not meet the operating constraints of the energy system, including power balance constraints, uplink and downlink constraints of generator sets, etc. In summary, a method for energy scheduling optimization with less computational effort and meeting the operating constraints of the energy system is needed.
[0003] The patent "Multi-microgrid system optimization operation method and device based on hierarchical constrained reinforcement learning" with publication number CN117710146A discloses the following steps: including decomposing the optimization task of the integrated energy multi-microgrid system into the upper-level intelligent agent and the lower-level microgrid model, constructing the agent state space and agent action space of the upper-level intelligent agent, constructing the constraint conditions of the lower-level microgrid model, solving the hierarchical reinforcement learning optimization scheduling model based on the constrained reinforcement learning algorithm, and obtaining the optimized operation strategy of the integrated energy multi-microgrid system. Summary of the invention
[0004] In order to overcome the problems existing in the prior art, the present invention designs a comprehensive energy storage system optimization method based on constraint-aware reinforcement learning.
[0005] In order to achieve the above object, the present invention adopts the following technical solution:
[0006] Technical Solution 1
[0007] A comprehensive energy storage system optimization method based on constraint-aware reinforcement learning comprises the following steps:
[0008] Constructing a Q value network, wherein the Q value network includes a plurality of neural units, and the activation function of the neural unit is a RELU function;
[0009] The output power of the gas turbine unit and the output power of the energy storage unit are taken as actions, the output power of the wind power system, the load power, and the charge state of the energy storage system are taken as states, and the operating cost of the gas turbine unit, the cost of electricity sales and purchase, and the power imbalance are taken as penalty items to establish a reward function, and the Q-value network is trained to obtain the optimal parameters of the Q-value network;
[0010] Fixing the Q-value network parameters, converting the Q-value network into a mixed integer programming model, wherein the mixed integer programming model is provided with microgrid constraints;
[0011] Input the current state into the mixed integer programming model, solve the mixed integer programming model through the gurobi solver, and obtain the optimal action, that is, the energy scheduling plan.
[0012] Furthermore, the mixed integer programming model is expressed as:
[0013]
[0014]
[0015] In the formula, x i represents the i-th action; y j represents the jth state; z ij is the reward value corresponding to taking action i in state j; Q(·) represents the Q-value function.
[0016] Furthermore, the training of the Q value network comprises the following steps:
[0017] Initialize the Q value network, target Q value network, parameters in the execution strategy function, initialize the reply buffer, and input environment parameters;
[0018] According to the execution strategy function and noise sampling action; interact with the environment, calculate the reward, generate the next state, and store the new action, reward, and state in the reply buffer; repeat this step until the training time exceeds the threshold;
[0019] Randomly extract samples from the reply buffer to calculate the loss function; back-propagate the loss through the gradient of the neural network to update the Q-value network parameters; update the parameters in the execution strategy function; update the target Q-value network parameters; if the Q-value network parameters converge, the training is completed; otherwise, repeat the step.
[0020] Furthermore, the reward function is expressed as:
[0021]
[0022] In the formula, σ1 and σ2 are the penalty factors for cost minimization and power imbalance, respectively; is the operating cost of the i-th gas turbine unit, is the cost of selling electricity to the main grid; ΔP is the active power imbalance.
[0023] Furthermore, it is characterized in that the microgrid constraint conditions include power balance constraints and uphill constraints and downhill constraints of the gas turbine unit.
[0024] Furthermore, it is characterized in that the power balance constraint is expressed as:
[0025]
[0026] In the formula, They are the number of wind power generation systems, the number of energy storage systems, and the number of load groups. Power output / input to the main grid, x G 、x V 、x N 、x B 、x L They are binary variables corresponding to the gas turbine group, wind power generation system group, energy storage system group, and load group, and whether to connect is determined by binary constraints.
[0027] Furthermore, the uphill constraint and downhill constraint of the gas turbine group are expressed as follows:
[0028]
[0029]
[0030] In the formula, RU i , RD i are the pressure-raising and pressure-reducing capabilities of the gas turbine unit, respectively, and x t-1 、x t 、x t+1 They are the binary variables corresponding to different moments in the start-up and shutdown process of the gas turbine unit, and the start-up and shutdown states of the unit are controlled by binary constraints.
[0031] Technical Solution 2
[0032] A comprehensive energy storage system optimization device based on constraint-aware reinforcement learning includes a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the steps described in technical solution one when executing the program.
[0033] Compared with the prior art, the present invention has the following characteristics and beneficial effects:
[0034] The present invention utilizes deep reinforcement learning algorithm to train Q-value network, which can effectively solve the uncertainty problem in the integrated energy system and the problem of sharp increase in computational complexity as the system scale increases; at the same time, the Q-value network function is modeled as a mixed integer programming model using binary constraints, and combined with the constraints of each part in the microgrid, all operating constraints in the system can be strictly enforced, ensuring the feasibility of the scheduling scheme in real-time operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 The figure is a schematic diagram of the principle flow of the constraint-aware reinforcement learning algorithm according to an embodiment of the present invention.
[0036] Figure 2 The figure is a detailed flowchart of the constraint-aware reinforcement learning algorithm according to an embodiment of the present invention.
[0037] Figure 3 Schematic diagram of the energy environment of an embodiment of the present invention.
[0038] Figure 4 This is a prediction diagram of various loads and fan outputs according to an embodiment of the present invention.
[0039] Figure 5 This is the optimal scheduling solution for the embodiment of the present invention. DETAILED DESCRIPTION
[0040] The present invention is described in more detail below with reference to the embodiments.
[0041] Embodiment 1
[0042] like Figure 1 as well as Figure 2 As shown, this embodiment provides a comprehensive energy storage system optimization method based on constraint-aware reinforcement learning, comprising the following steps:
[0043] S1. Constructing a mathematical model for energy storage optimization and scheduling:
[0044] Construct an objective function with the goal of minimizing the day-ahead operating cost of the integrated energy storage system:
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051] In the formula, They are respectively the electricity purchase cost, gas purchase cost, heat purchase cost, wind and solar power abandonment penalty cost, and the operating cost of the i-th unit of the gas turbine system; is the penalty fee for purchasing electricity, gas, heat, wind and solar power per unit power in unit time; T is the dispatch period; P t E , P t Gas , is the amount of electricity, gas and heat purchased from the main grid; P t w , P t v is the amount of wind and solar power abandoned per unit time; is the power output of the i-th unit of the gas turbine system; is the unit operating cost of the unit unit; U t,e is the start and stop variable of the running unit; S e is the start-up and shutdown cost of the unit; n is the number of units in the gas turbine system.
[0052] S2. Construct microgrid operation constraints, including:
[0053] Power balance constraints:
[0054]
[0055] In the formula, is the output power of the wind power generation system, the power output / input to the main grid, the output power of the energy storage system, and the average load power; G, V, B, and L are the gas turbine system, wind power generation system, energy storage system, and load system, respectively; x i,G 、x i,V 、x i,N 、x i,B 、x i,L They are binary variables corresponding to gas turbine units, wind turbine units, energy storage units, and load units, and whether to connect to the microgrid is determined through binary constraints.
[0056] Uphill and downhill constraints of gas turbine units:
[0057]
[0058]
[0059] In the formula, RU i , RD i are the pressure-raising and pressure-reducing capabilities of the gas turbine unit, respectively, and x t-1 、x t 、x t+1They are binary variables corresponding to different moments (t-1, t, t+1) in the start-up and shutdown process of the gas turbine unit, and the start-up and shutdown states of the unit are controlled by binary constraints.
[0060] S3. Offline training of DQN network:
[0061] S31, construct a deep neural network with K hidden layers as a DQN network, wherein the hidden layer has a number of neural units and uses a RELU activation function. The function form of the Q value network is the Q value function Q θ , the function form of the target Q value network is the target Q value function Q θ target.
[0062] The Q value function is defined as follows:
[0063] Q θ (s t ,a t )=(1-α)·Q θ (s t ,a t )+α·(r t +γ·max a' Q θ (s t ',a t '))
[0064] Where θ is the function Q θ Parameters in; r t is the reward function; γ is the discount factor; s t is the state variable; a t is the action variable. max a' Q θ (s t ',a t ') means to select the one with the largest Q value among all possible actions in the next state s'.
[0065] Define the state space, action, and reward function as follows:
[0066]
[0067] In the formula, is the output power of the wind power generation system at time t; is the load system power at time t; is the power output of the gas turbine system at time t-1; SOC t is the charge state of the energy storage system at time t.
[0068]
[0069] In the formula, is the output power of the i-th gas turbine unit at time t, is the output power of the i-th energy storage unit at time t.
[0070]
[0071] In the formula, σ1 and σ2 are the penalty factors for cost minimization and power imbalance, respectively; is the operating cost of the i-th gas turbine unit, is the cost of selling electricity to the main grid; ΔP is the active power imbalance.
[0072] S32, initialize Q value function Q θ 、Target Q value function Q θ target, execution strategy function π ω Parameters in, initialize the reply buffer R and size L, and input environment parameters.
[0073] S33, according to the execution strategy function and noise sampling action a T ~π ω (s t )+ε,ε~N(0,σ); interact with the environment, calculate the reward rt, and generate a new state s t+1 , will (s t ,a t ,r t ,s t+1 ) is stored in the reply buffer; step S33 is repeated until the training time exceeds the threshold.
[0074] S34, randomly select a small batch (s t ,a t ,r t ,s t+1 ) samples to calculate the loss function, which is defined as the mean square error value based on the Bellman variance, and the calculation formula is as follows:
[0075]
[0076] Where θ is the function Q θ is the parameter in ; |B| is the number of samples.
[0077] S35. Back-propagate the loss through the gradient of the neural network to update the Q-value network parameters.
[0078] S36. Update the parameter ω in the execution strategy function. The update formula is as follows:
[0079]
[0080] S37, update target Q value network parameter θ target , the update formula is as follows:
[0081] θ target ←τθ+(1-τ)θ target
[0082] Where τ is the soft update coefficient.
[0083] S38. If the Q value function Q θ If the parameters converge, proceed to the next step; otherwise, repeat steps S33-S37.
[0084] S4. Convert the Q-value network into a mixed integer programming model:
[0085] Fixed Q value network parameters; binary constraints restrict variables to only take one of two possible values, usually 0 or 1. The present invention uses binary variables to represent decisions in the DQN network. An example is as follows: The Q value of each action in the DQN network is determined by parameters. In order to represent these decisions in the mixed integer programming model; first define the binary variable x i,j , where i represents the state and j represents the action. If you choose to perform action j in state i, then x i,j =1, otherwise 0, to determine whether to connect to various energy sources in the microgrid. Secondly, use Q value and binary variables to define the objective function and constraints, where each power of the microgrid can be represented as a corresponding Q value parameter. This constraint ensures that only one action is selected in each state. The DQN network function is modeled as an effective mixed integer programming model based on the binary constraint to ensure that the Q value function can accurately predict the Q value of a given state and action, expressed as:
[0086]
[0087]
[0088] Among them, x i represents the i-th action variable, i.e., the output power of the gas turbine unit or the output power of the energy storage system, y j represents the jth state variable, i.e., the wind power system output power, load power or energy storage charging state, z ij It is the reward value corresponding to action i in state j. The reward is composed of the sum of the gas turbine unit operating cost, electricity sales and purchase cost, and power imbalance.
[0089] The mixed integer programming model also includes the microgrid operation constraints.
[0090] S5. Input the current environment and use the gurobi solver to solve the mixed integer programming model to obtain the optimal scheduling solution to perform energy scheduling.
[0091] Embodiment 2
[0092] like Figure 3 , Figure 4 as well as Figure 5 As shown, Python is used for simulation analysis, and the annual demand data of electricity, heat, gas consumption and wind power generation in a certain area are used as the original data set, and sampling is performed in hours. Figure 3 The energy environment adopted in this embodiment mainly includes wind turbines, energy storage, cogeneration units and other components. Figure 4 The load and wind turbine output forecast graph is shown. The original dataset is divided into two datasets: training dataset and test dataset. The training dataset contains the first three weeks of each month, and the test dataset contains the rest of the data. This allows the deep reinforcement learning algorithm to learn any seasonal and weekly behavior in the wind power generation and load data. Figure 5 This is the optimal scheduling scheme obtained by the method proposed in the present invention in this embodiment. The comprehensive energy storage system is mainly based on wind power generation. In the time period of 09:00-20:00, the output of wind power generation is relatively large. The system can absorb the wind power without purchasing electricity from the upper power grid, and can convert the power that the system cannot absorb into electricity through boilers, and transfer part of the electricity to the electric energy storage device. During the night period of 01:00-05:00 and 22:00-24:00, the electricity price is at a low point. The system can purchase electricity from the upper power for the electrolyzer to store electricity in the hydrogen fuel cell. When the electricity price is at a peak, the stored electricity is used for the gas unit to heat the system, so that the comprehensive energy system can fully dispatch the energy storage device during operation, which plays a role in shaving peaks and filling valleys and reducing fluctuations.
[0093] It should be noted that the above-mentioned comprehensive energy storage system optimization device based on constraint-aware reinforcement learning is also used to achieve the above-mentioned Figure 1 The method steps corresponding to each embodiment of the comprehensive energy storage system optimization method based on constraint-aware reinforcement learning shown in the figure will not be repeated in this application.
[0094] It should be noted that each functional unit / module in each embodiment of the present invention may be integrated into one processing unit / module, or each unit / module may exist physically separately, or two or more units / modules may be integrated into one unit / module. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of software functional unit / module.
[0095] Through the description of the above implementation mode, it can be clearly understood by those skilled in the art that the embodiments described herein can be implemented in hardware, software, firmware, middleware, code or any appropriate combination thereof. For hardware implementation, the processor can be implemented in one or more of the following units: application specific integrated circuit (ASIC), digital signal processor (DSP), digital signal processing device (DSPD), programmable logic device (PLD), field programmable gate array (FPGA), processor, controller, microcontroller, microprocessor, other electronic units designed to implement the functions described herein or their combination. For software implementation, part or all of the process of the embodiment can be completed by instructing the relevant hardware through a computer program. When implemented, the above program can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication medium includes any medium that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that can be accessed by a computer. Computer-readable media can include, but are not limited to, RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer.
[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, rather than to limit the scope of protection of the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should analyze that the technical solution of the present invention can be modified or replaced by equivalents without departing from the essence and scope of the technical solution of the present invention.
Claims
1. A comprehensive energy storage system optimization method based on constraint-aware reinforcement learning, characterized in that: The following steps are involved: Constructing a Q value network, wherein the Q value network includes a plurality of neural units, and the activation function of the neural unit is a RELU function; The output power of the gas turbine unit and the output power of the energy storage unit are taken as actions, the output power of the wind power system, the load power, and the charge state of the energy storage system are taken as states, and the operating cost of the gas turbine unit, the cost of electricity sales and purchase, and the power imbalance are taken as penalty items to establish a reward function, and the Q-value network is trained to obtain the optimal parameters of the Q-value network; The Q-value network parameters are fixed, and the Q-value network is converted into a mixed integer programming model, wherein the mixed integer programming model is provided with microgrid constraints; Input the current state into the mixed integer programming model, solve the mixed integer programming model through the gurobi solver, and obtain the optimal action, that is, the energy scheduling plan.
2. The method for optimizing a comprehensive energy storage system based on constraint-aware reinforcement learning according to claim 1, characterized in that: The mixed integer programming model is expressed in the formula: In the formula, x i represents the i-th action; y j represents the jth state; z ij is the reward value corresponding to taking action i in state j; Q(·) represents the Q-value function.
3. The method for optimizing a comprehensive energy storage system based on constraint-aware reinforcement learning according to claim 1, characterized in that: The training Q value network comprises the following steps: Initialize the Q value network, target Q value network, parameters in the execution strategy function, initialize the reply buffer, and input environment parameters; According to the execution strategy function and noise sampling action; interact with the environment, calculate the reward, generate the next state, and store the new action, reward, and state in the reply buffer; repeat this step until the training time exceeds the threshold; Randomly draw samples from the reply buffer to calculate the loss function; backpropagate the loss through the gradient of the neural network to update the Q-value network parameters; update the parameters in the execution policy function; Update the target Q value network parameters; if the Q value network parameters converge, the training is completed; otherwise, repeat this step.
4. The method for optimizing a comprehensive energy storage system based on constraint-aware reinforcement learning according to claim 1, characterized in that: The reward function is expressed as: In the formula, σ1 and σ2 are the penalty factors for cost minimization and power imbalance, respectively; is the operating cost of the i-th gas turbine unit, To cover the cost of purchasing electricity for sale to the main grid; ΔP is the active power imbalance.
5. The method for optimizing a comprehensive energy storage system based on constraint-aware reinforcement learning according to claim 1, characterized in that: The microgrid constraint conditions include power balance constraints and uphill constraints and downhill constraints of the gas turbine group.
6. The method for optimizing a comprehensive energy storage system based on constraint-aware reinforcement learning according to claim 1, characterized in that: The power balance constraint is expressed as: In the formula, They are the number of wind power generation systems, the number of energy storage systems, and the number of load groups. Power output / input to the main grid, x G 、x V 、x N 、x B 、x L They are binary variables corresponding to the gas turbine group, wind power generation system group, energy storage system group, and load group, and whether to connect is determined by binary constraints.
7. The method for optimizing a comprehensive energy storage system based on constraint-aware reinforcement learning according to claim 1, characterized in that: The uphill constraint and downhill constraint of the gas turbine group are expressed as follows: In the formula, RU i , RD i are the pressure-raising and pressure-reducing capabilities of the gas turbine unit, respectively, and x t-1 、x t 、x t+1 They are binary variables corresponding to different moments in the start-up and shutdown process of the gas turbine unit, and the start-up and shutdown states of the unit are controlled by binary constraints.
8. A comprehensive energy storage system optimization device based on constraint-aware reinforcement learning, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that: When the processor executes the program, the following steps are implemented: A Q-value network is preset, and the Q-value network includes a number of neural units, and the activation function of the neural unit is a RELU function; the output power of the gas turbine unit and the output power of the energy storage unit are taken as actions, the output power of the wind power system, the load power, and the charge state of the energy storage system are taken as states, and the operating cost of the gas turbine unit, the cost of selling and purchasing electricity, and the power imbalance are taken as penalty items to establish a reward function, and the Q-value network is trained to obtain the optimal parameters of the Q-value network; The Q-value network parameters are fixed, and the Q-value network is converted into a mixed integer programming model, wherein the mixed integer programming model is provided with microgrid constraints; Input the current state into the mixed integer programming model, solve the mixed integer programming model through the gurobi solver, and obtain the optimal action, that is, the energy scheduling plan.
9. The comprehensive energy storage system optimization device based on constraint-aware reinforcement learning according to claim 8, characterized in that: The microgrid constraint conditions include power balance constraints and uphill constraints and downhill constraints of the gas turbine group.
10. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, a comprehensive energy storage system optimization method based on constraint-aware reinforcement learning according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Microgrid energy scheduling method based on double-Q-value network deep reinforcement learning
CN112117760A
Integrated energy system low-carbon optimization scheduling method based on asynchronous deep reinforcement learning
CN117709644A
AUV cluster energy online monitoring and management system and method
CN117748747A
Method and system for event-triggered distributed reinforcement learning for unit commitment optimization and dispatch
US20230297842A1
Cited By
Operation scheduling method of combined energy storage power system and related device
CN120073806A
Operation and dispatch methods and related devices for combined energy storage power systems
CN120073806B
Source network load storage double-layer optimization scheduling method, system and device and medium
CN122801456A
