A method for optimizing energy control of community household microgrids based on deep reinforcement learning
By constructing a Markov decision-making process and a smart contract strategy processing center node set in the blockchain community home energy management system, the problem of inapplicability of deep reinforcement learning in strategy migration between microgrid systems is solved, and the efficiency of the agent strategy is achieved. Privacy protection of migration and energy usage data reduces training costs.
Patent Information
- Application Number
- CN202410684394.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-05-30
AI Technical Summary
Existing deep reinforcement learning methods have the problems of inapplicability and long training time for agent strategy migration between microgrid systems, and have poor adaptability to new environments.
Based on the blockchain community home energy management system network model, a Markov decision-making process is constructed, using deep reinforcement learning to solve the problem and migrating the agent strategy through the smart contract strategy processing center node set, and using similarity calculation to change the optimal strategy from similar The energy-consuming household microgrid is migrated to the household microgrid to be optimized.
It effectively reduces dependence on current data, improves agent migration capabilities, reduces the training cost of deep reinforcement learning, and provides privacy protection for household microgrid energy usage data.
Smart Images

Figure CN118278705B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of microgrid energy optimization and control, and in particular to a community household microgrid energy optimization and control method based on deep reinforcement learning. Background Art
[0002] The development of deep reinforcement learning provides a solution to the problem that traditional model-driven methods may not be able to achieve accurate optimization and regulation of microgrids. However, in real power systems, there is a problem that the trained network is no longer applicable in other microgrid systems, and deep reinforcement learning takes a lot of time to train an intelligent agent in a new environment. Summary of the invention
[0003] Based on this, it is necessary to provide a community household microgrid energy optimization control method based on deep reinforcement learning, which includes:
[0004] S1: Establish a blockchain community home energy management system network model and collect the first energy consumption of the home microgrid that has been put on the chain;
[0005] S2: Based on the network model of the blockchain community home energy management system, a Markov decision process is constructed; deep reinforcement learning is used to solve the Markov decision process to obtain the optimal agent strategy of the on-chain home microgrid;
[0006] S3: Obtain the second energy consumption of the home microgrid to be optimized and regulated, calculate the similarity between the second energy consumption and all the first energy consumptions, migrate the optimal intelligent agent strategy of the home microgrid corresponding to the first energy consumption with the highest similarity to the home microgrid to be optimized and regulated, and the home microgrid to be optimized and regulated uses the migrated optimal intelligent agent strategy to optimize and regulate the energy of the home microgrid.
[0007] Preferably, in S1, the blockchain community home energy management system network model includes a smart contract strategy processing center node set and a control module;
[0008] The smart contract policy processing center node set includes: a smart contract family policy collection node, a smart contract family policy provision node, and a smart contract policy migration node;
[0009] The smart contract family strategy collection node is used to collect the optimal agent strategy and energy consumption of the family microgrid;
[0010] The smart contract family strategy acquisition node is used to provide the optimal agent strategy of the first energy user corresponding to the family microgrid with the highest similarity;
[0011] The smart contract strategy migration node is used to migrate the optimal intelligent agent strategy of the home microgrid corresponding to the first energy user with the highest similarity to the home microgrid to be optimized and regulated;
[0012] The control module includes: a finite set of community household energy management and a finite set of household intelligent agent strategies;
[0013] The community household energy management finite set includes: the power of power-variable loads in the household microgrid, the power of time-variable loads, the power of rigid loads, the state of charge of the energy storage system, the state of charge of the battery of the electric vehicle, and the power generation power of the photovoltaic power generation system;
[0014] The finite set of family agent strategies includes a control decision module of a family microgrid, and the control decision module of the family microgrid includes a decision network, a first value network, a second value network, a first target value network, and a second target value network;
[0015] The decision network, the first value network, the second value network, the first target value network, and the second target value network all include an input layer, three hidden layers, and an output layer.
[0016] Preferably, the power of the power-variable load in the home microgrid, the power of the time-variable load, the state of charge of the energy storage system, and the state of charge of the battery of the electric vehicle all include corresponding constraints;
[0017] The power constraint of the variable power load in the home microgrid is expressed as:
[0018] ;
[0019] in, Indicates n The first home microgrid j A variable power load t Power at the moment; Indicates n In the household microgrid j The minimum power of a variable power load; Indicates n In the household microgrid j The maximum power of a variable power load;
[0020] The constraint on the operation start time of the power of the time-variable load is expressed as:
[0021] ;
[0022] in, Indicates n In the household microgrid kThe power operation start time of a time-variable load; Indicates n In the household microgrid k The power setting start time of a time-variable load; Indicates n In the household microgrid k The termination time of the power of a time-variable load; Indicates n In the household microgrid k The duration of continuous operation required for a time-variable load to complete the work;
[0023] The constraint of the state of charge of the energy storage system is expressed as:
[0024] ;
[0025] ;
[0026] ;
[0027] in, Indicates n A household microgrid t The state of charge of the energy storage system at the moment; Indicates the minimum state of charge of the energy storage system; Indicates the maximum state of charge of the energy storage system; Indicates n A household microgrid t The power of the energy storage system at the moment; Indicates the maximum discharge power of the energy storage system; Indicates the maximum charging power of the energy storage system; Indicates n A household microgrid t +1 time the state of charge of the energy storage system; Indicates the charging efficiency of the energy storage system; Indicates the discharge efficiency of the energy storage system;
[0028] The battery state of charge constraint of electric vehicles is expressed as:
[0029] ;
[0030] ;
[0031] ;
[0032] in, Indicates n In the household microgrid m Electric vehicles int Battery state of charge at all times; Indicates n In the household microgrid m Minimum state of charge of the battery of an electric vehicle; Indicates n In the household microgrid m The maximum state of charge of the battery of an electric vehicle; Indicates n In the household microgrid m The power of the battery of an electric car at time t; Indicates n In the household microgrid m The maximum discharge power of the battery of an electric vehicle; Indicates n In the household microgrid m The maximum charging power of the battery of an electric vehicle; Indicates n In the household microgrid m Electric vehicles in t +1 The battery state of charge at time; Indicates the charging efficiency of electric vehicles; Indicates the discharge efficiency of electric vehicles.
[0033] Preferably, in S2, constructing a Markov decision process based on the blockchain community home energy management system network model includes:
[0034] The Markov decision process includes a state space, an action space, a Markov state transition, and a reward;
[0035] The state space is constructed based on the community household energy management finite set; the state space is expressed as:
[0036] ;
[0037] in, Indicates n A household microgrid t The state space at the moment; Indicates n A household microgrid t The power of the variable load at the moment is a finite set; Indicates n A household microgrid t A finite set of powers of time-variable loads at time instants; Indicates n A household microgrid t A finite set of powers of rigid loads at time instant; Indicatesn A household microgrid t A finite set of states of charge of the energy storage system at the time instant; Indicates n A household microgrid t A finite set of battery states of charge of electric vehicles at time instant; Indicates n A household microgrid t A finite set of power generation of the photovoltaic power generation system at the time instant; express t The electricity price at the time; T Represents a collection of moments; N represents the total number of household microgrids;
[0038] The action space is constructed based on the power variation of the power variable load, the switch state of the time variable load, the power of the energy storage system, and the power of the battery of the electric vehicle; the action space is expressed as:
[0039] ;
[0040] in, Indicates n A household microgrid t The action space at the moment; Indicates n A household microgrid t The set of power changes of variable power loads at each moment; Indicates n The set of switch states of the time-variable loads of each household microgrid; Indicates n A household microgrid t The power aggregate of the energy storage system at the moment; Indicates n A household microgrid t The power aggregate of the electric vehicle’s battery at the moment;
[0041] The Markov state transfer includes transferring the state space and the action space at the previous moment to the state space at the next moment in the home microgrid; the Markov state transfer is expressed as: ; Indicates n A household microgrid t +1 state space at time;
[0042] Based on the state space and the action space, a reward function is designed with reducing electricity cost as the optimization goal; the reward is expressed as:
[0043] ;
[0044] ;
[0045] ;
[0046] ;
[0047] ;
[0048] ;
[0049] in, Indicates n A household microgrid t Rewards of the moment; Indicates n The first home microgrid j A variable power load t Power at the moment; Indicates n The first home microgrid k Time variable load t Power at the moment; Indicates n The first home microgrid l A rigid load t Power at the moment; Indicates n In the household microgrid m The power of the battery of an electric car at time t; represents the bonus factor for power variable loads; Reward factor representing time-variable load; represents the bonus factor for rigid load; J Indicates n The number of variable power loads in a household microgrid; K Indicates n The number of time-variable loads in a household microgrid; L Indicates n The number of rigid loads in a household microgrid; M Indicates n The number of electric vehicles in a household microgrid; Indicates n The first home microgrid j A variable power load t The electricity cost at each time; Indicates n The first home microgrid k The time variable load t The electricity cost at each time; Indicates nThe first home microgrid l A rigid load t The electricity cost at each time; Indicates n Energy storage equipment in household microgrids t The cost of charging and discharging at each moment; Indicates n Electric vehicles in household microgrids t The cost of charging and discharging at each moment.
[0050] Preferably, in S2, before using deep reinforcement learning to solve the Markov decision process, a preprocessing process is also included, and the preprocessing process includes:
[0051] The dimension of the input layer of the decision network is consistent with the dimension of the state space, and the dimension of the output layer of the decision network is consistent with the dimension of the action space;
[0052] The dimensions of the input layers of the first value network, the second value network, the first target value network, and the second target value network are all the sum of the dimensions of the state space and the dimensions of the action space; the dimensions of the input layers of the first value network, the second value network, the first target value network, and the second target value network are all the dimensions of the values of the state-action pair;
[0053] The overall optimization goal of the agent strategy is constructed based on the reward; the overall optimization goal includes:
[0054] ;
[0055] ;
[0056] ;
[0057] in, Indicates that the parameter is The loss function of the decision network; Represents the state space in the experience replay pool D to have expectations; Represents the value function in any value network; Indicates n A household microgrid t Rewards of the moment; represents the entropy regularization coefficient; represents action entropy; represents the decision network; Indicates i The action-value function of a value network; i ∈{1,2}; Indicates that the parameter is The loss function of the value network; Represents the experience in the experience replay pool D to have expectations; represents the discount factor, which is used to balance the importance of current rewards and future rewards; Represents the action value function of the first target value network; Represents the action value function of the second target value network; Indicates n A household microgrid t+ State space at time 1; Indicates n A household microgrid t+ Action space at moment 1; Indicates n A household microgrid t The state space at the moment; Indicates n A household microgrid t Action space at any moment.
[0058] Preferably, the process of obtaining the optimal agent strategy of the on-chain home microgrid includes:
[0059] Step 1: Initialize the parameters of the experience replay pool, the decision network, and the network parameters of all value networks; and copy the network parameters of the first value network to the second value network, the first target value network, and the second target value network;
[0060] Step 2: Use the decision network to interact with the home microgrid energy environment, take the state space, action space, reward of each time step and the state space of the next time step as experience, and store the experience in the experience replay pool;
[0061] Step 3: Randomly sample a batch of experience data from the experience replay pool, and obtain the output of the first value network and the second value network through the action value function of each value network. The output form of the first value network or the second value network is state-action value;
[0062] Step 4: Use the time difference error to calculate the difference between the value network and the corresponding target value network, and update the network parameters of the value network according to the difference; the calculation formula is:
[0063] ;
[0064] Among them, TDE represents the difference; Indicates n A household microgrid t Rewards of the moment; represents the discount factor; Represents the action value function of the first target value network; Represents the action value function of the second target value network; Indicates n A household microgrid t+ State space at time 1; Indicates n A household microgrid t+ Action space at moment 1; Indicates i The action-value function of a value network; Indicates n A household microgrid t The state space at the moment; Indicates n A household microgrid t The action space at each moment;
[0065] The network parameters of the decision network are updated according to the network parameters updated by the value network, and the entropy regularization coefficient is updated;
[0066] Update the network parameters of the target value network;
[0067] Step 5: Repeat steps 2-4 until the reward becomes stable and the optimal agent strategy is obtained.
[0068] Preferably, the update formula includes:
[0069] ;
[0070] ;
[0071] ;
[0072] ;
[0073] ;
[0074] ;
[0075] in, Indicates i Parameters of the value network The gradient of i ∈{1,2}; Indicates the parameters The gradient of Represents the learning rate when the policy network is updated; Indicates the soft update rate, which is used to control the update amplitude; Indicates iThe parameters of the target value network; Indicates that the parameter is The loss function of the decision network; Represents the state space in the experience replay pool D to have expectations; Represents the value function in any value network; represents action entropy; represents the decision network; Indicates that the parameter is The loss function of the value network; represents the entropy regularization coefficient; Represents the minimum value of the entropy regularization coefficient; represents the maximum value of the entropy regularization coefficient; clip(·) represents the truncation function; Represents the learning rate when the entropy regularization coefficient is updated; represents the gradient of the entropy regularization coefficient; represents the loss function with entropy regularization coefficient; is the constant term in the loss function of the entropy regularization coefficient.
[0076] Preferably, the optimal agent strategy includes network parameters of the decision network, network parameters of the first value network, network parameters of the second value network, network parameters of the first target value network, and network parameters of the second target value network.
[0077] Preferably, in S1, the first energy consumption of the home microgrid on the chain is collected, including: dividing a plurality of time periods, each time period is divided into T time periods on average, and in each time period, the power consumption of the power variable load, the power consumption of the time variable load, the power consumption of the rigid load, the power consumption of the energy storage system, and the power consumption of the electric vehicle in the home microgrid are collected once through the smart contract home strategy collection node, and recorded in the community home energy management finite set;
[0078] Whenever a complete time cycle has passed, the collected energy usage of the home microgrid is uploaded to the smart contract home strategy collection node for data update through the blockchain smart contract.
[0079] Preferably, the similarity calculation formula between the energy usage is:
[0080] ;
[0081] ;
[0082] ;
[0083] in, Indicatesn The first household microgrid and the u The energy usage similarity of each household microgrid; Indicates n The first household microgrid and the u Energy consumption difference of each household microgrid; represents the energy similarity benchmark value; T represents the set of time; Indicates u The power consumption of all variable power loads in a household microgrid; Indicates n The power consumption of all variable power loads in a household microgrid; Indicates u The power consumption of all time-variable loads in the household microgrid; Indicates n The power consumption of all time-variable loads in the household microgrid; Indicates u The power consumption of all rigid loads in a household microgrid; Indicates n The power consumption of all rigid loads in a household microgrid; Indicates u The power consumption of all energy storage systems in a household microgrid; Indicates n The power consumption of all energy storage systems in a household microgrid; Indicates u The electricity consumption of all electric vehicles in a household microgrid; Indicates n The electricity consumption of all electric vehicles in a household microgrid.
[0084] Beneficial effect: This method calculates the similarity between the second energy consumption and all the first energy consumptions, and migrates the optimal intelligent agent strategy of the home microgrid corresponding to the first energy consumption with the highest similarity to the home microgrid to be optimized and regulated, thereby effectively reducing the dependence on current data and accelerating the learning process, providing the possibility of reducing the training cost of deep reinforcement learning and improving the intelligent agent migration capability; and the energy consumption of the home microgrid is collected, recorded, and uploaded to the chain, providing effective protection for the privacy data of each home microgrid in the community. BRIEF DESCRIPTION OF THE DRAWINGS
[0085] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0086] Figure 1 This is a flow chart of a community household microgrid energy optimization and control method based on deep reinforcement learning according to an embodiment of the present application. DETAILED DESCRIPTION
[0087] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present application, so the present application is not limited by the specific embodiments disclosed below.
[0088] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0089] like Figure 1 As shown, this embodiment provides a community household microgrid energy optimization control method based on deep reinforcement learning, the method comprising:
[0090] S1: Establish a blockchain community home energy management system network model and collect the first energy consumption of the home microgrid that has been put on the chain.
[0091] Specifically, the network model of the blockchain community home energy management system is recorded as: BCHM { PT , CM}; PT Represents the smart contract policy processing center node set, CM Indicates the control module;
[0092] The smart contract strategy processing center node set is recorded as: ; Represents the smart contract family policy collection node; Represents the smart contract family policy providing node; Represents the smart contract strategy migration node;
[0093] The smart contract family strategy collection node is used to collect the optimal agent strategy and energy consumption of the family microgrid;
[0094] The smart contract family strategy providing node is used to provide the optimal agent strategy of the first energy user corresponding to the family microgrid with the highest similarity;
[0095] The smart contract strategy migration node is used to migrate the optimal intelligent agent strategy of the home microgrid corresponding to the first energy user with the highest similarity to the home microgrid to be optimized and regulated;
[0096] The control module is recorded as: CM { HMG , HAT}; HMG represents a finite set of household energy management in a community; HAT represents a finite set of strategies for household agents;
[0097] The community household energy management finite set is recorded as: ; The blockchain home energy management model is represented as:
[0098] ;
[0099] in, Indicates n The first home microgrid j A variable power load t Power at the moment; Indicates n The first home microgrid k The time variable load t Power at the moment; Indicates n The first home microgrid l A rigid load t Power at the moment; Indicates n A household microgrid t A finite set of states of charge of the energy storage system at the time instant; Indicates n In the household microgrid m Electric vehicles in t Battery state of charge at all times; Indicates n A household microgrid t A finite set of power generation of the photovoltaic power generation system at the time instant; T Represents a collection of moments; N represents the total number of household microgrids; J Indicates n The number of variable power loads in a household microgrid; K Indicates n The number of time-variable loads in a household microgrid; L Indicates n The number of rigid loads in a household microgrid; M Indicates nThe number of electric vehicles in a household microgrid;
[0100] Furthermore, the power of the power-variable load in the home microgrid, the power of the time-variable load, the state of charge of the energy storage system, and the state of charge of the battery of the electric vehicle all include corresponding constraints;
[0101] The power constraint of the variable power load in the home microgrid is expressed as:
[0102] ;
[0103] in, Indicates n The first home microgrid j A variable power load t Power at the moment; Indicates n In the household microgrid j The minimum power of a variable power load; Indicates n In the household microgrid j The maximum power of a variable power load;
[0104] The constraint on the operation start time of the power of the time-variable load is expressed as:
[0105] ;
[0106] in, Indicates n In the household microgrid k The power operation start time of a time-variable load; Indicates n In the household microgrid k The power setting start time of a time-variable load; Indicates n In the household microgrid k The termination time of the power of a time-variable load; Indicates n In the household microgrid k The duration of continuous operation required for a time-variable load to complete the work;
[0107] The constraint of the state of charge of the energy storage system is expressed as:
[0108] ;
[0109] ;
[0110] ;
[0111] in, Indicates n A household microgrid t The state of charge of the energy storage system at the moment; Indicates the minimum state of charge of the energy storage system; Indicates the maximum state of charge of the energy storage system; Indicates n A household microgrid t The power of the energy storage system at the moment; Indicates the maximum discharge power of the energy storage system; Indicates the maximum charging power of the energy storage system; Indicates n A household microgrid t +1 time the state of charge of the energy storage system; Indicates the charging efficiency of the energy storage system; Indicates the discharge efficiency of the energy storage system;
[0112] The battery state of charge constraint of electric vehicles is expressed as:
[0113] ;
[0114] ;
[0115] ;
[0116] in, Indicates n In the household microgrid m Electric vehicles in t Battery state of charge at all times; Indicates n In the household microgrid m Minimum state of charge of the battery of an electric vehicle; Indicates n In the household microgrid m The maximum state of charge of the battery of an electric vehicle; Indicates n In the household microgrid m The power of the battery of an electric car at time t; Indicates n In the household microgrid m The maximum discharge power of the battery of an electric vehicle; Indicates n In the household microgrid m The maximum charging power of the battery of an electric vehicle; Indicates n In the household microgrid m Electric vehicles int +1 The battery state of charge at time; Indicates the charging efficiency of electric vehicles; Indicates the discharge efficiency of electric vehicles.
[0117] The finite set of family agent strategies is recorded as: ; Indicates n The control decision module of the home microgrid is recorded as: ; represents the decision network, Represents the first value network, Represents the second value network, represents the first target value network, represents the second target value network;
[0118] The decision network, the first value network, the second value network, the first target value network, and the second target value network all include an input layer, three hidden layers, and an output layer.
[0119] Furthermore, the first energy consumption of the home microgrid on the chain is collected, including: dividing a plurality of time periods, each time period being divided into T time periods on average, and in each time period, the power consumption of the power variable load, the power consumption of the time variable load, the power consumption of the rigid load, the power consumption of the energy storage system, and the power consumption of the electric vehicle in the home microgrid are collected once through the smart contract home strategy collection node, and recorded in the community home energy management finite set;
[0120] Whenever a complete time cycle has passed, the collected energy usage of the home microgrid is uploaded to the smart contract home strategy collection node for data update through the blockchain smart contract.
[0121] S2: Based on the blockchain community home energy management system network model, a Markov decision process is constructed; deep reinforcement learning is used to solve the Markov decision process to obtain the optimal intelligent agent strategy for the on-chain home microgrid.
[0122] Specifically, the Markov decision process based on the blockchain community home energy management system network model includes:
[0123] The Markov decision process includes a state space, an action space, a Markov state transition, and a reward;
[0124] The state space is constructed based on the community household energy management finite set; the state space is expressed as:
[0125] ;
[0126] in, Indicates n A household microgrid t The state space at the moment; Indicates n A household microgrid t The power of the variable load at the moment is a finite set; Indicates n A household microgrid t A finite set of powers of time-variable loads at time instants; Indicates n A household microgrid t A finite set of powers of rigid loads at time instant; Indicates n A household microgrid t A finite set of states of charge of the energy storage system at the time instant; Indicates n A household microgrid t A finite set of battery states of charge of electric vehicles at time instant; Indicates n A household microgrid t A finite set of power generation of the photovoltaic power generation system at the time instant; express t The electricity price at the time; T Represents a collection of moments; N represents the total number of household microgrids;
[0127] The action space is constructed based on the power variation of the power variable load, the switch state of the time variable load, the power of the energy storage system, and the power of the battery of the electric vehicle; the action space is expressed as:
[0128] ;
[0129] in, Indicates n A household microgrid t The action space at the moment; Indicates n A household microgrid t The set of power changes of variable power loads at each moment; Indicates n The set of switch states of the time-variable loads of each household microgrid; Indicates n A household microgrid t The power aggregate of the energy storage system at the moment; Indicates n A household microgrid tThe power aggregate of the electric vehicle’s battery at the moment;
[0130] The Markov state transfer includes transferring the state space and the action space at the previous moment to the state space at the next moment in the home microgrid; the Markov state transfer is expressed as: ; Indicates n A household microgrid t +1 state space at time;
[0131] Based on the state space and the action space, a reward function is designed with reducing electricity cost as the optimization goal; the reward is expressed as:
[0132] ;
[0133] ;
[0134] ;
[0135] ;
[0136] ;
[0137] ;
[0138] in, Indicates n A household microgrid t Rewards of the moment; Indicates n The first home microgrid j A variable power load t Power at the moment; Indicates n The first home microgrid k The time variable load t Power at the moment; Indicates n The first home microgrid l A rigid load t Power at the moment; Indicates n In the household microgrid m The power of the battery of an electric car at time t; represents the bonus factor for power variable loads; Reward factor representing time-variable load; represents the bonus factor for rigid load; J Indicates n The number of variable power loads in a household microgrid; K Indicatesn The number of time-variable loads in a household microgrid; L Indicates n The number of rigid loads in a household microgrid; M Indicates n The number of electric vehicles in a household microgrid; Indicates n The first home microgrid j A variable power load t The electricity cost at each time; Indicates n The first home microgrid k The time variable load t The electricity cost at each time; Indicates n The first home microgrid l A rigid load t The electricity cost at each time; Indicates n Energy storage equipment in household microgrids t The cost of charging and discharging at each moment; Indicates n Electric vehicles in household microgrids t The cost of charging and discharging at each moment.
[0139] Furthermore, before using deep reinforcement learning to solve the Markov decision process, a preprocessing process is also included, and the preprocessing process includes:
[0140] The dimension of the input layer of the decision network is consistent with the dimension of the state space, and the dimension of the output layer of the decision network is consistent with the dimension of the action space;
[0141] The dimensions of the input layers of the first value network, the second value network, the first target value network, and the second target value network are all the sum of the dimensions of the state space and the dimensions of the action space; the dimensions of the input layers of the first value network, the second value network, the first target value network, and the second target value network are all the dimensions of the values of the state-action pair;
[0142] The overall optimization goal of the agent strategy is constructed based on the reward; the overall optimization goal includes:
[0143] ;
[0144] ;
[0145] ;
[0146] in, Indicates that the parameter is The loss function of the decision network; Represents the state space in the experience replay pool D to carry out expectations; Represents the value function in any value network; Indicates n A household microgrid t Rewards of the moment; represents the entropy regularization coefficient; represents action entropy; represents the decision network; Indicates i The action value function of a value network; i ∈{1,2}; Indicates that the parameter is The loss function of the value network; Represents the experience in the experience replay pool D to carry out expectations; represents the discount factor, which is used to balance the importance of current rewards and future rewards; Represents the action value function of the first target value network; Represents the action value function of the second target value network; Indicates n A household microgrid t+ State space at time 1; Indicates n A household microgrid t+ Action space at moment 1; Indicates n A household microgrid t The state space at the moment; Indicates n A household microgrid t Action space at any moment.
[0147] Furthermore, the process of obtaining the optimal agent strategy for the on-chain home microgrid includes:
[0148] Step 1: Initialize the parameters of the experience replay pool, the decision network, and the network parameters of all value networks; and copy the network parameters of the first value network to the second value network, the first target value network, and the second target value network;
[0149] Step 2: Use the decision network to interact with the home microgrid energy environment, take the state space, action space, reward of each time step and the state space of the next time step as experience, and store the experience in the experience replay pool;
[0150] Step 3: Randomly sample a batch of experience data from the experience replay pool, and obtain the output of the first value network and the second value network through the action value function of each value network. The output form of the first value network or the second value network is state-action value;
[0151] Step 4: Use the time difference error to calculate the difference between the value network and the corresponding target value network, and update the network parameters of the value network according to the difference; the calculation formula is:
[0152] ;
[0153] Among them, TDE represents the difference; Indicates n A household microgrid t Rewards of the moment; represents the discount factor; Represents the action value function of the first target value network; Represents the action value function of the second target value network; Indicates n A household microgrid t+ State space at time 1; Indicates n A household microgrid t+ Action space at moment 1; Indicates i The action value function of a value network; Indicates n A household microgrid t The state space at the moment; Indicates n A household microgrid t The action space at the moment;
[0154] The network parameters of the decision network are updated according to the network parameters updated by the value network, and the entropy regularization coefficient is updated;
[0155] Update the network parameters of the target value network;
[0156] The above update formula includes:
[0157] ;
[0158] ;
[0159] ;
[0160] ;
[0161] ;
[0162] ;
[0163] in, Indicates i Parameters of the value network The gradient of i ∈{1,2}; Indicates the parameters The gradient of Represents the learning rate when the policy network is updated; Indicates the soft update rate, which is used to control the update amplitude; Indicates i The parameters of the target value network; Indicates that the parameter is The loss function of the decision network; Represents the state space in the experience replay pool D to carry out expectations; Represents the value function in any value network; represents action entropy; represents the decision network; Indicates that the parameter is The loss function of the value network; represents the entropy regularization coefficient; Represents the minimum value of the entropy regularization coefficient; represents the maximum value of the entropy regularization coefficient; clip(·) represents the truncation function; Represents the learning rate when the entropy regularization coefficient is updated; represents the gradient of the entropy regularization coefficient; represents the loss function with entropy regularization coefficient; is the constant term in the loss function of the entropy regularization coefficient.
[0164] Step 5: Repeat steps 2-4 until the reward becomes stable and the optimal agent strategy is obtained.
[0165] In this embodiment, the optimal agent strategy includes network parameters of the decision network, network parameters of the first value network, network parameters of the second value network, network parameters of the first target value network, and network parameters of the second target value network.
[0166] S3: Obtain the second energy consumption of the home microgrid to be optimized and regulated, calculate the similarity between the second energy consumption and all the first energy consumptions, migrate the optimal intelligent agent strategy of the home microgrid corresponding to the first energy consumption with the highest similarity to the home microgrid to be optimized and regulated, and the home microgrid to be optimized and regulated uses the migrated optimal intelligent agent strategy to optimize and regulate the energy of the home microgrid.
[0167] Specifically, the similarity calculation formula between energy usage is:
[0168] ;
[0169] ;
[0170] ;
[0171] in, Indicates n The first household microgrid and the u The energy usage similarity of each household microgrid; Indicates n The first household microgrid and the u Energy consumption difference of each household microgrid; represents the energy similarity benchmark value; T represents the set of time; Indicates u The power consumption of all variable power loads in a household microgrid; Indicates n The power consumption of all variable power loads in a household microgrid; Indicates u The power consumption of all time-variable loads in the household microgrid; Indicates n The power consumption of all time-variable loads in the household microgrid; Indicates u The power consumption of all rigid loads in a household microgrid; Indicates n The power consumption of all rigid loads in a household microgrid; Indicates u The power consumption of all energy storage systems in a household microgrid; Indicates n The power consumption of all energy storage systems in a household microgrid; Indicates u The electricity consumption of all electric vehicles in a household microgrid; Indicates n The electricity consumption of all electric vehicles in a household microgrid.
[0172] The community household microgrid energy optimization and control method based on deep reinforcement learning provided in this embodiment calculates the similarity between the second energy use and all the first energy uses, and migrates the optimal intelligent agent strategy of the household microgrid corresponding to the first energy use with the highest similarity to the household microgrid to be optimized and controlled, thereby effectively reducing the dependence on current data and accelerating the learning process, providing the possibility of reducing the training cost of deep reinforcement learning and improving the intelligent agent migration capability; and the energy use of the household microgrid is collected, recorded, and chained, providing effective protection for the privacy data of each household microgrid in the community.
[0173] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0174] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the patent application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent application shall be subject to the attached claims.
Claims
1. A method for optimizing energy control of community household microgrids based on deep reinforcement learning. It is characterized in that include: S1: Establish a blockchain community home energy management system network model and collect the first energy consumption of the home microgrid that has been put on the chain; The blockchain community home energy management system network model includes a smart contract strategy processing center node set and a control module; The smart contract policy processing center node set includes: a smart contract family policy collection node, a smart contract family policy provision node, and a smart contract policy migration node; The smart contract family strategy collection node is used to collect the optimal agent strategy and energy consumption of the family microgrid; The smart contract family strategy acquisition node is used to provide the optimal agent strategy of the first energy user corresponding to the family microgrid with the highest similarity; The smart contract strategy migration node is used to migrate the optimal intelligent agent strategy of the home microgrid corresponding to the first energy user with the highest similarity to the home microgrid to be optimized and regulated; The control module includes: a finite set of community household energy management and a finite set of household intelligent agent strategies; The community household energy management finite set includes: the power of power-variable loads in the household microgrid, the power of time-variable loads, the power of rigid loads, the state of charge of the energy storage system, the state of charge of the battery of the electric vehicle, and the power generation power of the photovoltaic power generation system; The power of the power variable load in the home microgrid, the power of the time variable load, the state of charge of the energy storage system, and the state of charge of the battery of the electric vehicle all include corresponding constraints; The power constraint of the variable power load in the home microgrid is expressed as: ; in, Indicates n The first home microgrid j A variable power load t Power at the moment; Indicates n In the household microgrid j The minimum power of a variable power load; Indicates n In the household microgrid j The maximum power of a variable power load; The constraint on the operation start time of the power of the time-variable load is expressed as: ; in, Indicates n In the household microgrid k The power operation start time of a time-variable load; Indicates n In the household microgrid k The power setting start time of a time-variable load; Indicates n In the household microgrid k The termination time of the power of a time-variable load; Indicates n In the household microgrid k The duration of continuous operation required for a time-variable load to complete the work; The constraint of the state of charge of the energy storage system is expressed as: ; ; ; in, Indicates n A household microgrid t The state of charge of the energy storage system at the moment; Indicates the minimum state of charge of the energy storage system; Indicates the maximum state of charge of the energy storage system; Indicates n A household microgrid t The power of the energy storage system at the moment; Indicates the maximum discharge power of the energy storage system; Indicates the maximum charging power of the energy storage system; Indicates n A household microgrid t +1 time the state of charge of the energy storage system; Indicates the charging efficiency of the energy storage system; Indicates the discharge efficiency of the energy storage system; The battery state of charge constraint of electric vehicles is expressed as: ; ; ; in, Indicates n In the household microgrid m Electric vehicles in t Battery state of charge at all times; Indicates n In the household microgrid m Minimum state of charge of the battery of an electric vehicle; Indicates n In the household microgrid m The maximum state of charge of the battery of an electric vehicle; Indicates n In the household microgrid m The power of the battery of an electric car at time t; Indicates n In the household microgrid m The maximum discharge power of the battery of an electric vehicle; Indicates n In the household microgrid m The maximum charging power of the battery of an electric vehicle; Indicates n In the household microgrid m Electric vehicles in t +1 The battery state of charge at time; Indicates the charging efficiency of electric vehicles; Indicates the discharge efficiency of electric vehicles; The finite set of family agent strategies includes a control decision module of a family microgrid, and the control decision module of the family microgrid includes a decision network, a first value network, a second value network, a first target value network, and a second target value network; The decision network, the first value network, the second value network, the first target value network, and the second target value network all include an input layer, three hidden layers, and an output layer; S2: Based on the network model of the blockchain community home energy management system, a Markov decision process is constructed; deep reinforcement learning is used to solve the Markov decision process to obtain the optimal agent strategy of the on-chain home microgrid; The Markov decision process based on the blockchain community home energy management system network model includes: The Markov decision process includes a state space, an action space, a Markov state transition, and a reward; The state space is constructed based on the community household energy management finite set; the state space is expressed as: ; in, Indicates n A household microgrid t The state space at the moment; Indicates n A household microgrid t The power of the variable load at the moment is a finite set; Indicates n A household microgrid t A finite set of powers of time-variable loads at time instants; Indicates n A household microgrid t A finite set of powers of rigid loads at time instant; Indicates n A household microgrid t A finite set of states of charge of the energy storage system at the time instant; Indicates n A household microgrid t A finite set of battery states of charge of electric vehicles at time instant; Indicates n A household microgrid t A finite set of power generation of the photovoltaic power generation system at the time instant; express t The electricity price at the time; T Represents a collection of moments; N represents the total number of household microgrids; The action space is constructed based on the power variation of the power variable load, the switch state of the time variable load, the power of the energy storage system, and the power of the battery of the electric vehicle; the action space is expressed as: ; in, Indicates n A household microgrid t The action space at each moment; Indicates n A household microgrid t The set of power changes of variable power loads at each moment; Indicates n The set of switch states of the time-variable loads of each household microgrid; Indicates n A household microgrid t The power aggregate of the energy storage system at the moment; Indicates n A household microgrid t The power aggregate of the electric vehicle’s battery at the moment; The Markov state transfer includes transferring the state space and the action space at the previous moment to the state space at the next moment in the home microgrid; the Markov state transfer is expressed as: ; Indicates n A household microgrid t +1 state space at time; Based on the state space and the action space, a reward function is designed with reducing electricity cost as the optimization goal; the reward is expressed as: ; ; ; ; ; ; in, Indicates n A household microgrid t Rewards of the moment; Indicates n The first home microgrid j A variable power load t Power at the moment; Indicates n The first home microgrid k Time variable load t Power at the moment; Indicates n The first home microgrid l A rigid load t Power at the moment; Indicates n In the household microgrid m The power of the battery of an electric car at time t; represents the bonus factor for power variable loads; Reward factor representing time-variable load; represents the bonus factor for rigid load; J Indicates n The number of variable power loads in a household microgrid; K Indicates n The number of time-variable loads in a household microgrid; L Indicates n The number of rigid loads in a household microgrid; M Indicates n The number of electric vehicles in a household microgrid; Indicates n The first home microgrid j A variable power load t The electricity cost at each time; Indicates n The first home microgrid k Time variable load t The electricity cost at each time; Indicates n The first home microgrid l A rigid load t The electricity cost at each time; Indicates n Energy storage equipment in household microgrids t The cost of charging and discharging at each moment; Indicates n Electric vehicles in household microgrids t The cost of charging and discharging at each moment; S3: Obtain the second energy consumption of the home microgrid to be optimized and regulated, calculate the similarity between the second energy consumption and all the first energy consumptions, migrate the optimal intelligent agent strategy of the home microgrid corresponding to the first energy consumption with the highest similarity to the home microgrid to be optimized and regulated, and the home microgrid to be optimized and regulated uses the migrated optimal intelligent agent strategy to optimize and regulate the energy of the home microgrid.
2. According to the method for optimizing and controlling energy of community household microgrid based on deep reinforcement learning in claim 1, It is characterized in that In S2, before using deep reinforcement learning to solve the Markov decision process, a preprocessing process is also included, and the preprocessing process includes: The dimension of the input layer of the decision network is consistent with the dimension of the state space, and the dimension of the output layer of the decision network is consistent with the dimension of the action space; The dimensions of the input layers of the first value network, the second value network, the first target value network, and the second target value network are all the sum of the dimensions of the state space and the dimensions of the action space; the dimensions of the input layers of the first value network, the second value network, the first target value network, and the second target value network are all the dimensions of the values of the state-action pair; The overall optimization goal of the agent strategy is constructed based on the reward; the overall optimization goal includes: ; ; ; in, Indicates that the parameter is The loss function of the decision network; Represents the state space in the experience replay pool D to carry out expectations; Represents the value function in any value network; Indicates n A household microgrid t Rewards of the moment; represents the entropy regularization coefficient; represents action entropy; represents the decision network; Indicates i The action value function of a value network; i ∈{1,2}; Indicates that the parameter is The loss function of the value network; Represents the experience in the experience replay pool D to carry out expectations; represents the discount factor, which is used to balance the importance of current rewards and future rewards; Represents the action value function of the first target value network; Represents the action value function of the second target value network; Indicates n A household microgrid t+ State space at time 1; Indicates n A household microgrid t+ Action space at moment 1; Indicates n A household microgrid t The state space at the moment; Indicates n A household microgrid t Action space at any moment.
3. According to the method for optimizing and controlling energy of community household microgrid based on deep reinforcement learning in claim 2, It is characterized in that The process of obtaining the optimal agent strategy for the on-chain home microgrid includes: Step 1: Initialize the parameters of the experience replay pool, the decision network, and the network parameters of all value networks; and copy the network parameters of the first value network to the second value network, the first target value network, and the second target value network; Step 2: Use the decision network to interact with the home microgrid energy environment, take the state space, action space, reward of each time step and the state space of the next time step as experience, and store the experience in the experience replay pool; Step 3: Randomly sample a batch of experience data from the experience replay pool, and obtain the output of the first value network and the second value network through the action value function of each value network. The output form of the first value network or the second value network is state-action value; Step 4: Use the time difference error to calculate the difference between the value network and the corresponding target value network, and update the network parameters of the value network according to the difference; the calculation formula is: ; Among them, TDE represents the difference; Indicates n A household microgrid t Rewards of the moment; represents the discount factor; Represents the action value function of the first target value network; Represents the action value function of the second target value network; Indicates n A household microgrid t+ State space at time 1; Indicates n A household microgrid t+ Action space at moment 1; Indicates i The action value function of a value network; Indicates n A household microgrid t The state space at the moment; Indicates n A household microgrid t The action space at each moment; The network parameters of the decision network are updated according to the network parameters updated by the value network, and the entropy regularization coefficient is updated; Update the network parameters of the target value network; Step 5: Repeat steps 2-4 until the reward becomes stable and the optimal agent strategy is obtained.
4. According to claim 3, the community household microgrid energy optimization and control method based on deep reinforcement learning, It is characterized in that The update formula includes: ; ; ; ; ; ; in, Expressing the i Parameters of the value network The gradient of i ∈{1,2}; Indicates the parameters The gradient of Represents the learning rate when the policy network is updated; Indicates the soft update rate, which is used to control the update amplitude; Indicates i The parameters of the target value network; Indicates that the parameter is The loss function of the decision network; Represents the state space in the experience replay pool D to carry out expectations; Represents the value function in any value network; represents action entropy; represents the decision network; Indicates that the parameter is The loss function of the value network; represents the entropy regularization coefficient; Represents the minimum value of the entropy regularization coefficient; represents the maximum value of the entropy regularization coefficient; clip(·) represents the truncation function; Represents the learning rate when the entropy regularization coefficient is updated; represents the gradient of the entropy regularization coefficient; represents the loss function with entropy regularization coefficient; is the constant term in the loss function of the entropy regularization coefficient.
5. According to the method for optimizing and controlling energy of community household microgrid based on deep reinforcement learning in claim 1, It is characterized in that The optimal agent strategy includes network parameters of the decision network, network parameters of the first value network, network parameters of the second value network, network parameters of the first target value network, and network parameters of the second target value network.
6. According to the method for optimizing and controlling energy of community household microgrid based on deep reinforcement learning in claim 1, It is characterized in that In S1, the first energy consumption of the home microgrid on the chain is collected, including: dividing a plurality of time periods, each time period is divided into T time periods on average, and in each time period, the power consumption of the power variable load, the power consumption of the time variable load, the power consumption of the rigid load, the power consumption of the energy storage system, and the power consumption of the electric vehicle in the home microgrid are collected once through the smart contract home strategy collection node, and recorded in the community home energy management finite set; Whenever a complete time cycle has passed, the collected energy usage of the home microgrid is uploaded to the smart contract home strategy collection node for data update through the blockchain smart contract.
7. According to claim 6, the community household microgrid energy optimization and control method based on deep reinforcement learning, It is characterized in that The formula for calculating the similarity between energy consumption is: ; ; ; in, Indicates n The first household microgrid and the u The energy usage similarity of each household microgrid; Indicates n The first household microgrid and the u Energy consumption difference of each household microgrid; represents the energy similarity benchmark value; T represents the set of time; Indicates u The power consumption of all variable power loads in a household microgrid; Indicates n The power consumption of all variable power loads in a household microgrid; Indicates u The power consumption of all time-variable loads in the household microgrid; Indicates n The power consumption of all time-variable loads in the household microgrid; Indicates u The power consumption of all rigid loads in a household microgrid; Indicates n The power consumption of all rigid loads in a household microgrid; Indicates u The power consumption of all energy storage systems in a household microgrid; Indicates n The power consumption of all energy storage systems in a household microgrid; Indicates u The electricity consumption of all electric vehicles in a household microgrid; Indicates n The electricity consumption of all electric vehicles in a household microgrid.
