# Model Analysis of Environmental and Economic Impacts of a Microgrid Based on the Optimization Method

Authors: Pengxiao Ji
Journal: Advances in Multimedia
 (2022)

---

## Abstract

In order to improve the synergistic effect of a microgrid and its economic impact, this paper applies the optimization method to the improvement of microgrid operation. On the basis of studying the bilevel optimization theory, this paper applies the bilevel optimization theory to the economic dispatch of the microgrid and constructs a bilevel economic dispatch model of the microgrid considering the environmental benefits. Moreover, considering the environmental benefits of the microgrid two-level economic dispatch model, this paper constructs an intelligent analysis model and uses the deep learning algorithm as the system learning algorithm to improve the system data processing capability. The simulation study verifies that the optimal solution model of the microgrid environment and economic impact based on the optimization method has a good effect, and the method in this paper can effectively improve the microgrid operating environment and economic benefits.


---

## Body

## 1. Introduction

The optimal scheduling of the microgrid has become one of the core issues of energy management and integrated control of the microgrid. It mainly means that by coordinating the output power of the distributed generation units and the energy storage in the microgrid, on the premise of meeting the load, the cost of power generation and the emission of pollutants can be reduced, and the utilization rate of energy can be fully improved. Usually, the optimal dispatching objectives of the microgrid mainly include economic benefits, environmental benefits, and reliability. The economic benefit is reflected in the energy supply cost of the microgrid, that is, the economic operation cost, which mainly includes the operation and maintenance cost, start-stop cost, operation depreciation cost, and fuel consumption cost of the unit. The environmental benefit is mainly reflected in the cost of pollutant discharge or the cost of pollutant treatment, and the reliability mainly refers to the cost of load shedding or the reliability of load power supply. In summary, the optimal scheduling of the microgrid is generally a multiobjective optimization problem. Since some distributed power sources in the microgrid are renewable energy sources with random fluctuations, such as solar energy and wind energy, the optimal scheduling problem of the microgrid has become a nonlinear, multiconstraint, and multivariable combinatorial optimization problem. For traditional algorithms, it is usually difficult to find feasible solutions or optimal solutions [1]. In recent years, inspired by bionics, intelligent optimization algorithms, such as fish swarm algorithm, ant colony algorithm, particle swarm algorithm, and genetic algorithm, have been further developed and applied. These algorithms have good global optimization ability and robustness, and play an important role in solving the optimal scheduling problem of the microgrid [2].Through microgrid technology, the energy utilization efficiency of distributed generation has been greatly improved. Usually, the microgrid has two operation modes: grid-connected and islanded. In the grid-connected mode, after distributed units are connected to the large grid in the form of the microgrid and connected to the grid, the original unconnected distributed power can be connected to the grid. Coordinate and integrate, and then improve the absorption and absorption capacity of the traditional large power grid for unstable wind and other renewable energy sources, and realize the access of a large number of distributed power sources, thereby reducing the consumption of fossil resources and greenhouse gas emissions [3]. When a catastrophic event causes a major failure or even collapse of the large power grid, the microgrid can be disconnected from the large grid and operated in an island mode to ensure continuous power supply reliability to important loads [4]. Microgrids usually contain uncontrollable and controllable distributed generation units, as well as energy storage systems and loads. Among them, uncontrollable distributed power generation units mainly include renewable energy, such as photovoltaic power generation, wind power generation, and small hydropower. These energy sources are greatly affected by environmental and climate changes, so power generation will fluctuate with changes in meteorological conditions [5]. During grid-connected operation, the power of renewable energy generation units fluctuates due to meteorological factors, so how to coordinate the output between each controllable distributed generation unit and energy storage to maximize economic operation and energy utilization [6] ]; when the island is running, the distributed power supply may fluctuate greatly, making it difficult to achieve power balance, causing the system frequency to oscillate, unable to meet the load power supply demand, and worrying about safety issues [7]. By dispatching the output of distributed generation units and energy storage in the microgrid, the economic operation efficiency and load power supply reliability can be effectively improved. Therefore, effective microgrid scheduling plays a very important role in economy and reliability [8].In order to solve the grid connection problem of renewable distributed energy, microgrid technology has attracted the attention of scholars. In the following, a brief introduction to the research status of single-microgrid control and optimization methods will be given, which will lay the foundation for the detailed introduction of the research status of multimicrogrid energy management methods [9]. In order to realize voltage and frequency control, the literature [10] proposed a new method for secondary frequency modulation voltage control of islanded microgrid based on distributed cooperative control. This method utilizes a sparse communication network, and each DG unit only needs the information of its locality and its neighbors to perform control actions. The frequency controller restores the system frequency to the rated value while keeping the incremental value of the generation cost of each DG unit equal. The voltage controller also realizes critical bus voltage recovery and realizes reactive power sharing. Further, considering the factors of the transmission line, the literature [11] designed a distributed voltage regulator with an observer, which can make different distributed power sources obtain different voltage set points, which reduces the error compared to ignoring the line impedance, making the results more accurate. More comprehensively, the literature [12] proposes a distributed secondary control method, which includes three modules: voltage regulator, reactive power regulator, and active power/frequency regulator. The voltage regulator module is responsible for maintaining the average voltage of the microgrid at the rated value; the reactive power regulator compares the local reactive power of the node with the reactive power of neighbors on the communication graph and fine-tunes the droop coefficient according to the error value; the active power/frequency regulator regulates all inverter frequencies according to their ratings while sharing the active power demand among them. It is worth noting that proposed controllers are fully distributed, i.e., each controller only needs to exchange information with neighboring controllers directly connected on the communication graph. Through the coordinated control of three regulators, global voltage regulation, frequency synchronization, and active/reactive power output proportional to the capacity of the distributed power supply are finally achieved. Microgrid optimization methods. The uncertainty of the environment and load requirements, to a certain extent, affects the operation of the system. Reference [13] introduces uncertainty adjustment parameters, aims at the economy, builds a two-stage robust optimization model, and gives a dual algorithm to solve the model; finally, it can achieve the minimum operating cost in an extremely harsh operating environment to optimize system operation. Similarly, in order to cope up with the uncertainty of the environment, reference [14] proposed the concept of dispatchability and constructed a multi-time-scale real-time optimal control model of the microgrid. In order to realize the economical and reliable operation of the microgrid, a new security-constrained multiobjective optimal scheduling model was proposed in [15]. The model considers the steady-state and dynamic constraints of the grid, including power balance, voltage magnitude, line flow, power generation frequency, and voltage transients and uses the Pareto concave transformation method to first transform the multiobjective space into an objective space and then use a single-objective optimizer to solve all nondominated solutions in the original multiobjective space. Finally, the method is validated in grid-connected and islanded operating modes, and the results show that the framework can not only minimize the cost of power generation but also minimize the cost of reliability. Further, considering the cogeneration problem, the literature [16] proposes a mathematical model to optimize the management of power generation, heating, and demand in microgrids. The model considers the task progress, power generation and the calorific value, the behavior of buying and selling electricity to the main grid, and the energy storage system and takes the minimization of the operating cost of the microgrid as the objective function. And short-term optimization is carried out through mixed-integer linear programming, so as to adjust the use of renewable energy and nonrenewable energy to meet the thermal load and electric load demand. In order to reduce the operating cost of the biomass cogeneration microgrid, the literature [17] constructed a linear programming model based on predictive control. The model manages the supply and demand of electric and thermal energy as decision variables at the same time and proposes a load transfer optimization algorithm based on renewable energy generation and time-use electricity prices. The algorithm uses a Monte Carlo method to simulate renewable energy, demand-side uncertainty, and optimizes load switching patterns to improve microgrid performance and reduce operating costs. Reference [18] uses the consensus algorithm to optimize the output of distributed power through iterative communication and calculation between distributed power agents. Ultimately, DGs can be made to meet the equal increment rate criterion, and the cost of power generation can be minimized.In order to improve the operation effect of the microgrid, this paper applies the optimization method to the improvement of microgrid operation and builds an intelligent optimization model to promote the improvement of microgrid operation.


## 2. Bilevel Economic Dispatch of Microgrid considering Environmental Benefits

The bilevel programming problem (BLPP), also known as bilevel optimization, is the idea of dividing the problem into upper and lower levels, and the goals of the upper and lower levels play against each other. It not only reflects the connection between goals but also reflects the independence between goals. Therefore, it is very necessary to introduce the bilevel optimization theory into the economic dispatch of the microgrid, so as to establish the double-level economic dispatch model of the microgrid.In this paper, a bilevel economic dispatch model of microgrid considering environmental benefits is constructed, and an example is built to simulate and verify the model in this chapter.


### 2.1. Theoretical Outline of the Bilevel Programming Method

The bilevel optimization problem refers to the optimization problem including the upper and lower levels. The bilevel optimization model takes into account the roles and performance of different decision makers in the decision-making process. Usually, the bilevel optimization model takes the following form:(1)minx,yFx,y,s.t.Gx,y≤0,(2)Hx,y=0.Among them,y is the upper-level decision variable, F(x, y) is the upper-level objective function, and equations (1) and (2) are the upper-level constraints in the decision-making process. x is the optimal solution of the lower level under the conditions given by the upper decision variable y.(3)min,fx,y,s.t,gx,y≤0,(4)hx,y=0.Among them,f (x, y) is the objective function of the lower level, and inequality (3) and equation (4) are the constraints of the lower level.


### 2.2. The Selection of the Upper and Lower Targets of the Model

This paper divides the microgrid economic dispatch model into two levels: the upper and lower levels. The upper level aims to optimize the operating cost of the microgrid and optimizes whether the output of each DG in the microgrid is optimized according to the load prediction curve of the microgrid. Under the premise of upper-level decision-making, the lower level aims to optimize environmental benefits and determines the output of each DG through optimization. The lower level is affected by the decision of the upper level, but is not completely controlled by the upper level. At the same time, the lower level affects the upper level through its own decision-making, so that the decision of the upper level develops in the direction that is beneficial to the target of the lower level, as shown in Figure1.Figure 1
The relationship between the two main bodies of double-level economic dispatch in the microgrid.


### 2.3. Upper-Level Scheduling Model

The upper-layer objective function is to minimize the operating cost of the microgrid under various constraints. Among them, it is mainly composed of fuel cost, maintenance cost, microgrid transaction cost, and default cost (in the island state, the exchange cost and default cost of the main network plan are not considered).


#### 2.3.1. Fuel Cost

Power Generation Costs of Microturbine Units (MT). Because distributed generation is intermittent, in order to ensure the basic load of the system, it is necessary to set MT as the base load unit. The power generation cost function Fi of the micro gas turbine unit is(5)Fi=ai×Pi2+bi×Pi+ci.In the formula,ai,bi, and ci are the fuel cost coefficients and Pi is the output power of the gas turbine unit i.Valve Point Effect Cost. When the intake valve of the gas turbine unit is opened, the wire drawing phenomenon will superimpose a pulsation effect on the unit consumption curve, resulting in a valve point effect. Ei is the energy cost caused by the valve point effect of the unit, and its expression is(6)Ei=eisinfiPimin−Pi.In the formula,Pimin is the output lower limit of the micro gas turbine unit and ei,fi is the valve point effect coefficient.The fuel cost of a single micro gas turbine unit in the microgrid consists of the above two parts, so the fuel cost functionCgi of a single gas turbine unit is(7)Cgi=Fi+Ei.


#### 2.3.2. Maintenance Cost

Wind Turbines and Photovoltaic Cells. Since wind turbines and photovoltaic cells do not consume fuel, their power generation cost functions Wi and Si can be approximated as(8)Wi=QwPwi,(9)Si=QsPsi.In the formula,Pwi and Qw are the output and operation and maintenance cost coefficients of wind turbines, respectively, and Psi and Qs are the output and operation and maintenance cost coefficients of photovoltaic cells, respectively.Battery. The battery life is related to the charging and discharging time and charging and discharging power. The depreciation cost function Bi of the battery can be approximately expressed as(10)Bi=QbPbi.In the formula,Pbi is the charging and discharging power of the battery and Qb is the depreciation cost coefficient of the battery.Micro gas turbine unit:(11)Gi=QgPi.In the formula,GiandQg are the depreciation expense function and depreciation expense coefficient of the micro gas turbine unit, respectively.


#### 2.3.3. Microgrid Transaction Costs and Default Costs

In the electricity market environment, there are bilateral transactions between the microgrid and the large grid, and the purchase and sale of electricityHBT and HST within the contract period and their settlement methods are agreed.In order to facilitate analysis, the contract period is divided intoT periods, and it is considered that the purchase and sale price of electricity remains unchanged in each period Δt. The microgrid transaction cost CGt in the t-th period is(12)CGt=HBtZBtQBt−HStZstQSt.(13)HBt=PdtΔt,Pdt≥0HBt=0,Pdt<0;HSt=0,Pdt≥0,HSt=−PdtΔt,Pdt<0.When transaction power does not exceed contract power,QBt<1,QSt>1; otherwise, QBt=1,QSt=1.In the formula,HBt,HSt,ZBt,ZSt,QBt,QSt,Pdt are the actual power purchase, power sales, power purchase price, power sales price, power purchase, power sales discount coefficient, and distribution network power in the t period, respectively.If the total electricity purchased during the contract period does not reachHBT at the end, or the total electricity sold reaches HST at the end, the microgrid needs to pay the power distribution company a penalty CF.(14)CF=QBFgHBT−∑t−1THBt+QSFgHST−∑t−1THSt.In the formula,QBF,QSF are the power purchase default penalty coefficient and the power sale default penalty coefficient, respectively, where g is a threshold function g(x). If x > 0, then g(x) = x; otherwise, g(x) = 0.In summary, the total cost of the microgrid in the dispatch period, that is, the upper-level objective functionCgrid is(15)minCgrid=∑t=1T∑i=1nugiCgiPi+GiPi+∑inuwiWiPwi+∑i=1nusiSiPsi+∑i=1nubiBiPbiΔt+∑tTCGt+CF.In the formula,ugi,uwi,usi,ubi are the upper-level decision variables, representing gas turbines, fans, photovoltaic cells, and storage batteries, respectively. udi is an upper-level decision variable, representing the distribution network i included in the exchange cost of the main network. The following sections describe the coding design and fitness function in detail. The upper decision variable indicates that when the represented DG is turned on, the value is 1; otherwise, it is 0.


### 2.4. Lower-Level Scheduling Model

In this paper, the environmental benefit degreeR of each DG and the energy storage is quantified according to the amount of pollutants discharged. The maximum value is 100. The calculation standard of the R value of DG and energy storage is as follows:(16)R=100−CO210−10000SO2−100NOx.According to the above formula, theR values of MT, PV, WT, and Batt are -18, 100, 100, and 96.9, respectively. When the microgrid sells electricity to the distribution network, the environmental benefit value of the electricity sold has been calculated once when the microgrid generates electricity. If the environmental benefit value is calculated again, it is a double calculation, so the environmental benefit value is no longer calculated when the microgrid sells electricity to the distribution network. It can be described as the following mathematical model:(17)maxY=∑tT∑inRgPit+RwPwit+RsPsit+gPbitRb+gPditRd.In the formula, Y is the total environmental benefit,Rg,Rw,Rs,Rb,Rd are the environmental benefit degree of the microturbine, wind turbine, photovoltaic battery, and distribution network, respectively, Pit,Pwit,Psit,Pbit,Pdit are the lower-level decision variables, and g(x) is the threshold function. When x > 0, g(x) = x; otherwise, g(x) = 0.


### 2.5. Constraints of Model

The constraints of the two-layer economic dispatch model mainly include active power balance constraints, upper and lower limits of active power output of various power sources, micro gas turbine unit ramp rate constraints, energy storage device constraints, transmission line transmission power constraints, and PCC point transmission power constraints.


#### 2.5.1. Power Balance Constraints Ignoring Network Losses

(18)∑inPit+Pwit+Psit+Pbit+Pdit=PD.In the formula,PD is the predicted load in the t-th period.


#### 2.5.2. Upper and Lower Limits of Active Power Output of Various Power Sources

The output of microturbines, wind turbines, photovoltaic cells, and batteries in the microgrid must be within their upper and lower limits at each time period.(19)Pimin≤Pit≤Pimax,(20)0≤Pwit≤Pwimax,(21)0≤Psit≤Psimax,(22)0≤Pbit≤Pbimax.In the formula,Pimin is the lower output limit of the micro gas turbine unit i and Pimax,Pwimax,Psimax,Pbimax are the upper output limits of the micro gas turbine unit i, the fan i, the photovoltaic cell i, and the battery i, respectively.


#### 2.5.3. Constraints on the Ramp Rate of Micro Gas Turbine Units

(23)DRit≤Pit−Pit−1≤URit.In the formula,DRit,URit are the decreasing and rising rate of the active power output of the unit i in the period t, respectively, and Pit,Pit−1 are the output of the unit in the period t and t−1, respectively.


#### 2.5.4. Energy Storage Device Constraints

In actual operation, the battery can only be in one of the states of charging or discharging at each time period, and it must be between the upper and lower limits of its charge.(24)SOCminx≤SOCit≤SOCmaxx.In the formula,SOCit represents the charge amount of battery i in t period and SOCminx and SOCmaxx represent the lower limit and the upper limit of the battery i charge amount.


#### 2.5.5. Transmission Line Transmission Power Constraints

Line transmission power constraint is the basic constraint in microgrid planning, and line transmission capacity is mainly related to transmission distance and the voltage level. Due to the short transmission lines of the microgrid, bidirectional power transmission and the in situ compensation of reactive power. The transmission power constraints of the microgrid can be expressed as(25)Plinet≤Pline.max.In the formula,Plinet,Pline.max are the actual transmission power and the upper limit of transmission power of the line in the t-th period, respectively.


#### 2.5.6. PCC Point Transmission Power Constraints

Since power transmission between the microgrid and the main grid is bidirectional, in order to protect the security of the large grid, the transmission power of the PCC node is constrained, which can be expressed as(26)PPCG≤PPCC.max.In the formula,PPCCt,PPCC⋅max are the actual transmission power and the upper limit of transmission power constrained by the contract capacity in the t-th period of the distribution network, respectively.


### 2.6. Algorithms and Algorithms Flow

The simulated annealing algorithm (SAA) is a heuristic algorithm that simulates the principle of solid annealing: heat a solid sufficiently and then allow it to cool naturally. During heating, the particles inside the solid become disordered with the increase of temperature, and the internal energy increases, while during natural cooling, the particles gradually become ordered and reach equilibrium at each temperature. Finally, the ground state is reached at room temperature and the internal energy is reduced to a minimum. According to the Metropolis criterion, the probability of equilibrium of particle internal energy at temperatureT is as follows:(27)p=e−ΔE/kT.In the formula,E,ΔE, and k are the internal energy of the particle, the change in internal energy, and the Boltzmann constant, respectively. The internal energy E is mapped to the objective function value f, and the temperature T is mapped to the control parameter t, and the simulated annealing algorithm for solving the combinatorial optimization problem is obtained.The basic idea of particle swarm optimization is as follows: it first randomly initializes a group of particles (birds) in the solution space, and then these particles move in the solution space (region) with a certain law and finally find the optimal solution through a large number of iterations. During iteration, particles update themselves by tracking “individual extremumAi” and “global extremum Ag.” The particle updates the velocity and position using the following formula according to the two optimal values:(28)vidt+1=wvidt+c1rAidt−xidt+c2rAgdt−xidtxidt+1=xidt+vidt+1.In the formula,vidt and xidt are the velocity and position of the dth dimension of the ith particle at the t-th iteration, respectively, and w is the weight, which controls the search speed of the particle, and r() is a random number uniformly distributed in (0, 1). c1 is the individual learning factor, c2 is the population learning factor, Ai is the individual optimal solution of the particle, and Ag is the current optimal solution of population, that is, the one with the best position among all particles. When the speed exceeds the maximum vmax during iteration, that is, vid>yam, we set vid=vmax to ensure that the particle does not exceed the range of the optimal solution.Genetic algorithm (GA) is an efficient global optimization algorithm that combines the “natural selection, survival of the fittest” rule in the theory of biological evolution with the law of separation and free combination in the law of genetics. In the upper-layer model optimization problem in this paper, when the number of DGs isN, the DG configuration scheme of the system can be represented by an N-bit binary code. Among them, 1 means that DG contributes, and 0 means that DG does not contribute. This forms a chromosome (Chromosome), as shown in Figure 2.Figure 2
Chromosome coding of the upper-level model of the microgrid double-layer economic dispatch.In the genetic operator, the chromosomes with high fitness of previous generation are genetically selected to be inherited to the children (whether the better DG is retained or not). After that, it cross selects different chromosomes for hybridization and combines the individual characteristics of the parents to form children (combined with whether different DGs contribute to the scheme). The mutation operation changes the value of a gene in the parent chromosome with a certain probability (modify whether a DG contributes to the configuration). The genetic algorithm coding optimization process is shown in Figure3.Figure 3
Genetic algorithm coding optimization process.The upper-level decision variables take the values of 0 and 1 integers, and use a sequence of integers to encode them with a vector. The element sequence of the vector corresponds to each DG sequence, and the value of the vector element represents whether to enable the corresponding DG. Among them, 1 means open and 0 means not open, as follows:(29)U=ug1,…,ugn,uw1,…,uwn,us1,…,usn,ub1,…,ubn,ud.In the formula,ud represents whether to purchase or sell electricity from the large power grid.As a criterion for evaluating individual strengths and weaknesses in genetic algorithms, fitness is usually designed by users according to the objective function and constraints. The fitness function fit (x) in this paper is designed as follows:(30)fitx=1Cgrid+Z∗St+M.Among them,Cgrid is the upper-level objective function and St is the measure of violation of constraints. St=1 if the chromosome violates the constraint; otherwise, 0. Z is the penalty coefficient, which is a large positive integer (such as Z=107), and M is a small enough number (such as M=10−6) to prevent division by 0. The entire algorithm flow is shown in Figure 4.Figure 4
Flowchart of the microgrid bilevel economic dispatch algorithm.The optimization process of building a model in this paper is shown in the flow chart. After the upper layer determines the population, the lower layer optimizes each individual and eliminates some inferior individuals. The upper layer solves the upper layer objective function according to the optimization results of the lower layer. After calculating the fitness of each individual, the individual is sorted from good to bad according to the fitness. At this time, if the current optimal individual reaches the lower-level expectation, it will be retained; otherwise, it will be eliminated and a new round of superior and inferior sorting will be carried out, and so on.


## 2.1. Theoretical Outline of the Bilevel Programming Method

The bilevel optimization problem refers to the optimization problem including the upper and lower levels. The bilevel optimization model takes into account the roles and performance of different decision makers in the decision-making process. Usually, the bilevel optimization model takes the following form:(1)minx,yFx,y,s.t.Gx,y≤0,(2)Hx,y=0.Among them,y is the upper-level decision variable, F(x, y) is the upper-level objective function, and equations (1) and (2) are the upper-level constraints in the decision-making process. x is the optimal solution of the lower level under the conditions given by the upper decision variable y.(3)min,fx,y,s.t,gx,y≤0,(4)hx,y=0.Among them,f (x, y) is the objective function of the lower level, and inequality (3) and equation (4) are the constraints of the lower level.


## 2.2. The Selection of the Upper and Lower Targets of the Model

This paper divides the microgrid economic dispatch model into two levels: the upper and lower levels. The upper level aims to optimize the operating cost of the microgrid and optimizes whether the output of each DG in the microgrid is optimized according to the load prediction curve of the microgrid. Under the premise of upper-level decision-making, the lower level aims to optimize environmental benefits and determines the output of each DG through optimization. The lower level is affected by the decision of the upper level, but is not completely controlled by the upper level. At the same time, the lower level affects the upper level through its own decision-making, so that the decision of the upper level develops in the direction that is beneficial to the target of the lower level, as shown in Figure1.Figure 1
The relationship between the two main bodies of double-level economic dispatch in the microgrid.


## 2.3. Upper-Level Scheduling Model

The upper-layer objective function is to minimize the operating cost of the microgrid under various constraints. Among them, it is mainly composed of fuel cost, maintenance cost, microgrid transaction cost, and default cost (in the island state, the exchange cost and default cost of the main network plan are not considered).


### 2.3.1. Fuel Cost

Power Generation Costs of Microturbine Units (MT). Because distributed generation is intermittent, in order to ensure the basic load of the system, it is necessary to set MT as the base load unit. The power generation cost function Fi of the micro gas turbine unit is(5)Fi=ai×Pi2+bi×Pi+ci.In the formula,ai,bi, and ci are the fuel cost coefficients and Pi is the output power of the gas turbine unit i.Valve Point Effect Cost. When the intake valve of the gas turbine unit is opened, the wire drawing phenomenon will superimpose a pulsation effect on the unit consumption curve, resulting in a valve point effect. Ei is the energy cost caused by the valve point effect of the unit, and its expression is(6)Ei=eisinfiPimin−Pi.In the formula,Pimin is the output lower limit of the micro gas turbine unit and ei,fi is the valve point effect coefficient.The fuel cost of a single micro gas turbine unit in the microgrid consists of the above two parts, so the fuel cost functionCgi of a single gas turbine unit is(7)Cgi=Fi+Ei.


### 2.3.2. Maintenance Cost

Wind Turbines and Photovoltaic Cells. Since wind turbines and photovoltaic cells do not consume fuel, their power generation cost functions Wi and Si can be approximated as(8)Wi=QwPwi,(9)Si=QsPsi.In the formula,Pwi and Qw are the output and operation and maintenance cost coefficients of wind turbines, respectively, and Psi and Qs are the output and operation and maintenance cost coefficients of photovoltaic cells, respectively.Battery. The battery life is related to the charging and discharging time and charging and discharging power. The depreciation cost function Bi of the battery can be approximately expressed as(10)Bi=QbPbi.In the formula,Pbi is the charging and discharging power of the battery and Qb is the depreciation cost coefficient of the battery.Micro gas turbine unit:(11)Gi=QgPi.In the formula,GiandQg are the depreciation expense function and depreciation expense coefficient of the micro gas turbine unit, respectively.


### 2.3.3. Microgrid Transaction Costs and Default Costs

In the electricity market environment, there are bilateral transactions between the microgrid and the large grid, and the purchase and sale of electricityHBT and HST within the contract period and their settlement methods are agreed.In order to facilitate analysis, the contract period is divided intoT periods, and it is considered that the purchase and sale price of electricity remains unchanged in each period Δt. The microgrid transaction cost CGt in the t-th period is(12)CGt=HBtZBtQBt−HStZstQSt.(13)HBt=PdtΔt,Pdt≥0HBt=0,Pdt<0;HSt=0,Pdt≥0,HSt=−PdtΔt,Pdt<0.When transaction power does not exceed contract power,QBt<1,QSt>1; otherwise, QBt=1,QSt=1.In the formula,HBt,HSt,ZBt,ZSt,QBt,QSt,Pdt are the actual power purchase, power sales, power purchase price, power sales price, power purchase, power sales discount coefficient, and distribution network power in the t period, respectively.If the total electricity purchased during the contract period does not reachHBT at the end, or the total electricity sold reaches HST at the end, the microgrid needs to pay the power distribution company a penalty CF.(14)CF=QBFgHBT−∑t−1THBt+QSFgHST−∑t−1THSt.In the formula,QBF,QSF are the power purchase default penalty coefficient and the power sale default penalty coefficient, respectively, where g is a threshold function g(x). If x > 0, then g(x) = x; otherwise, g(x) = 0.In summary, the total cost of the microgrid in the dispatch period, that is, the upper-level objective functionCgrid is(15)minCgrid=∑t=1T∑i=1nugiCgiPi+GiPi+∑inuwiWiPwi+∑i=1nusiSiPsi+∑i=1nubiBiPbiΔt+∑tTCGt+CF.In the formula,ugi,uwi,usi,ubi are the upper-level decision variables, representing gas turbines, fans, photovoltaic cells, and storage batteries, respectively. udi is an upper-level decision variable, representing the distribution network i included in the exchange cost of the main network. The following sections describe the coding design and fitness function in detail. The upper decision variable indicates that when the represented DG is turned on, the value is 1; otherwise, it is 0.


## 2.3.1. Fuel Cost

Power Generation Costs of Microturbine Units (MT). Because distributed generation is intermittent, in order to ensure the basic load of the system, it is necessary to set MT as the base load unit. The power generation cost function Fi of the micro gas turbine unit is(5)Fi=ai×Pi2+bi×Pi+ci.In the formula,ai,bi, and ci are the fuel cost coefficients and Pi is the output power of the gas turbine unit i.Valve Point Effect Cost. When the intake valve of the gas turbine unit is opened, the wire drawing phenomenon will superimpose a pulsation effect on the unit consumption curve, resulting in a valve point effect. Ei is the energy cost caused by the valve point effect of the unit, and its expression is(6)Ei=eisinfiPimin−Pi.In the formula,Pimin is the output lower limit of the micro gas turbine unit and ei,fi is the valve point effect coefficient.The fuel cost of a single micro gas turbine unit in the microgrid consists of the above two parts, so the fuel cost functionCgi of a single gas turbine unit is(7)Cgi=Fi+Ei.


## 2.3.2. Maintenance Cost

Wind Turbines and Photovoltaic Cells. Since wind turbines and photovoltaic cells do not consume fuel, their power generation cost functions Wi and Si can be approximated as(8)Wi=QwPwi,(9)Si=QsPsi.In the formula,Pwi and Qw are the output and operation and maintenance cost coefficients of wind turbines, respectively, and Psi and Qs are the output and operation and maintenance cost coefficients of photovoltaic cells, respectively.Battery. The battery life is related to the charging and discharging time and charging and discharging power. The depreciation cost function Bi of the battery can be approximately expressed as(10)Bi=QbPbi.In the formula,Pbi is the charging and discharging power of the battery and Qb is the depreciation cost coefficient of the battery.Micro gas turbine unit:(11)Gi=QgPi.In the formula,GiandQg are the depreciation expense function and depreciation expense coefficient of the micro gas turbine unit, respectively.


## 2.3.3. Microgrid Transaction Costs and Default Costs

In the electricity market environment, there are bilateral transactions between the microgrid and the large grid, and the purchase and sale of electricityHBT and HST within the contract period and their settlement methods are agreed.In order to facilitate analysis, the contract period is divided intoT periods, and it is considered that the purchase and sale price of electricity remains unchanged in each period Δt. The microgrid transaction cost CGt in the t-th period is(12)CGt=HBtZBtQBt−HStZstQSt.(13)HBt=PdtΔt,Pdt≥0HBt=0,Pdt<0;HSt=0,Pdt≥0,HSt=−PdtΔt,Pdt<0.When transaction power does not exceed contract power,QBt<1,QSt>1; otherwise, QBt=1,QSt=1.In the formula,HBt,HSt,ZBt,ZSt,QBt,QSt,Pdt are the actual power purchase, power sales, power purchase price, power sales price, power purchase, power sales discount coefficient, and distribution network power in the t period, respectively.If the total electricity purchased during the contract period does not reachHBT at the end, or the total electricity sold reaches HST at the end, the microgrid needs to pay the power distribution company a penalty CF.(14)CF=QBFgHBT−∑t−1THBt+QSFgHST−∑t−1THSt.In the formula,QBF,QSF are the power purchase default penalty coefficient and the power sale default penalty coefficient, respectively, where g is a threshold function g(x). If x > 0, then g(x) = x; otherwise, g(x) = 0.In summary, the total cost of the microgrid in the dispatch period, that is, the upper-level objective functionCgrid is(15)minCgrid=∑t=1T∑i=1nugiCgiPi+GiPi+∑inuwiWiPwi+∑i=1nusiSiPsi+∑i=1nubiBiPbiΔt+∑tTCGt+CF.In the formula,ugi,uwi,usi,ubi are the upper-level decision variables, representing gas turbines, fans, photovoltaic cells, and storage batteries, respectively. udi is an upper-level decision variable, representing the distribution network i included in the exchange cost of the main network. The following sections describe the coding design and fitness function in detail. The upper decision variable indicates that when the represented DG is turned on, the value is 1; otherwise, it is 0.


## 2.4. Lower-Level Scheduling Model

In this paper, the environmental benefit degreeR of each DG and the energy storage is quantified according to the amount of pollutants discharged. The maximum value is 100. The calculation standard of the R value of DG and energy storage is as follows:(16)R=100−CO210−10000SO2−100NOx.According to the above formula, theR values of MT, PV, WT, and Batt are -18, 100, 100, and 96.9, respectively. When the microgrid sells electricity to the distribution network, the environmental benefit value of the electricity sold has been calculated once when the microgrid generates electricity. If the environmental benefit value is calculated again, it is a double calculation, so the environmental benefit value is no longer calculated when the microgrid sells electricity to the distribution network. It can be described as the following mathematical model:(17)maxY=∑tT∑inRgPit+RwPwit+RsPsit+gPbitRb+gPditRd.In the formula, Y is the total environmental benefit,Rg,Rw,Rs,Rb,Rd are the environmental benefit degree of the microturbine, wind turbine, photovoltaic battery, and distribution network, respectively, Pit,Pwit,Psit,Pbit,Pdit are the lower-level decision variables, and g(x) is the threshold function. When x > 0, g(x) = x; otherwise, g(x) = 0.


## 2.5. Constraints of Model

The constraints of the two-layer economic dispatch model mainly include active power balance constraints, upper and lower limits of active power output of various power sources, micro gas turbine unit ramp rate constraints, energy storage device constraints, transmission line transmission power constraints, and PCC point transmission power constraints.


### 2.5.1. Power Balance Constraints Ignoring Network Losses

(18)∑inPit+Pwit+Psit+Pbit+Pdit=PD.In the formula,PD is the predicted load in the t-th period.


### 2.5.2. Upper and Lower Limits of Active Power Output of Various Power Sources

The output of microturbines, wind turbines, photovoltaic cells, and batteries in the microgrid must be within their upper and lower limits at each time period.(19)Pimin≤Pit≤Pimax,(20)0≤Pwit≤Pwimax,(21)0≤Psit≤Psimax,(22)0≤Pbit≤Pbimax.In the formula,Pimin is the lower output limit of the micro gas turbine unit i and Pimax,Pwimax,Psimax,Pbimax are the upper output limits of the micro gas turbine unit i, the fan i, the photovoltaic cell i, and the battery i, respectively.


### 2.5.3. Constraints on the Ramp Rate of Micro Gas Turbine Units

(23)DRit≤Pit−Pit−1≤URit.In the formula,DRit,URit are the decreasing and rising rate of the active power output of the unit i in the period t, respectively, and Pit,Pit−1 are the output of the unit in the period t and t−1, respectively.


### 2.5.4. Energy Storage Device Constraints

In actual operation, the battery can only be in one of the states of charging or discharging at each time period, and it must be between the upper and lower limits of its charge.(24)SOCminx≤SOCit≤SOCmaxx.In the formula,SOCit represents the charge amount of battery i in t period and SOCminx and SOCmaxx represent the lower limit and the upper limit of the battery i charge amount.


### 2.5.5. Transmission Line Transmission Power Constraints

Line transmission power constraint is the basic constraint in microgrid planning, and line transmission capacity is mainly related to transmission distance and the voltage level. Due to the short transmission lines of the microgrid, bidirectional power transmission and the in situ compensation of reactive power. The transmission power constraints of the microgrid can be expressed as(25)Plinet≤Pline.max.In the formula,Plinet,Pline.max are the actual transmission power and the upper limit of transmission power of the line in the t-th period, respectively.


### 2.5.6. PCC Point Transmission Power Constraints

Since power transmission between the microgrid and the main grid is bidirectional, in order to protect the security of the large grid, the transmission power of the PCC node is constrained, which can be expressed as(26)PPCG≤PPCC.max.In the formula,PPCCt,PPCC⋅max are the actual transmission power and the upper limit of transmission power constrained by the contract capacity in the t-th period of the distribution network, respectively.


## 2.5.1. Power Balance Constraints Ignoring Network Losses

(18)∑inPit+Pwit+Psit+Pbit+Pdit=PD.In the formula,PD is the predicted load in the t-th period.


## 2.5.2. Upper and Lower Limits of Active Power Output of Various Power Sources

The output of microturbines, wind turbines, photovoltaic cells, and batteries in the microgrid must be within their upper and lower limits at each time period.(19)Pimin≤Pit≤Pimax,(20)0≤Pwit≤Pwimax,(21)0≤Psit≤Psimax,(22)0≤Pbit≤Pbimax.In the formula,Pimin is the lower output limit of the micro gas turbine unit i and Pimax,Pwimax,Psimax,Pbimax are the upper output limits of the micro gas turbine unit i, the fan i, the photovoltaic cell i, and the battery i, respectively.


## 2.5.3. Constraints on the Ramp Rate of Micro Gas Turbine Units

(23)DRit≤Pit−Pit−1≤URit.In the formula,DRit,URit are the decreasing and rising rate of the active power output of the unit i in the period t, respectively, and Pit,Pit−1 are the output of the unit in the period t and t−1, respectively.


## 2.5.4. Energy Storage Device Constraints

In actual operation, the battery can only be in one of the states of charging or discharging at each time period, and it must be between the upper and lower limits of its charge.(24)SOCminx≤SOCit≤SOCmaxx.In the formula,SOCit represents the charge amount of battery i in t period and SOCminx and SOCmaxx represent the lower limit and the upper limit of the battery i charge amount.


## 2.5.5. Transmission Line Transmission Power Constraints

Line transmission power constraint is the basic constraint in microgrid planning, and line transmission capacity is mainly related to transmission distance and the voltage level. Due to the short transmission lines of the microgrid, bidirectional power transmission and the in situ compensation of reactive power. The transmission power constraints of the microgrid can be expressed as(25)Plinet≤Pline.max.In the formula,Plinet,Pline.max are the actual transmission power and the upper limit of transmission power of the line in the t-th period, respectively.


## 2.5.6. PCC Point Transmission Power Constraints

Since power transmission between the microgrid and the main grid is bidirectional, in order to protect the security of the large grid, the transmission power of the PCC node is constrained, which can be expressed as(26)PPCG≤PPCC.max.In the formula,PPCCt,PPCC⋅max are the actual transmission power and the upper limit of transmission power constrained by the contract capacity in the t-th period of the distribution network, respectively.


## 2.6. Algorithms and Algorithms Flow

The simulated annealing algorithm (SAA) is a heuristic algorithm that simulates the principle of solid annealing: heat a solid sufficiently and then allow it to cool naturally. During heating, the particles inside the solid become disordered with the increase of temperature, and the internal energy increases, while during natural cooling, the particles gradually become ordered and reach equilibrium at each temperature. Finally, the ground state is reached at room temperature and the internal energy is reduced to a minimum. According to the Metropolis criterion, the probability of equilibrium of particle internal energy at temperatureT is as follows:(27)p=e−ΔE/kT.In the formula,E,ΔE, and k are the internal energy of the particle, the change in internal energy, and the Boltzmann constant, respectively. The internal energy E is mapped to the objective function value f, and the temperature T is mapped to the control parameter t, and the simulated annealing algorithm for solving the combinatorial optimization problem is obtained.The basic idea of particle swarm optimization is as follows: it first randomly initializes a group of particles (birds) in the solution space, and then these particles move in the solution space (region) with a certain law and finally find the optimal solution through a large number of iterations. During iteration, particles update themselves by tracking “individual extremumAi” and “global extremum Ag.” The particle updates the velocity and position using the following formula according to the two optimal values:(28)vidt+1=wvidt+c1rAidt−xidt+c2rAgdt−xidtxidt+1=xidt+vidt+1.In the formula,vidt and xidt are the velocity and position of the dth dimension of the ith particle at the t-th iteration, respectively, and w is the weight, which controls the search speed of the particle, and r() is a random number uniformly distributed in (0, 1). c1 is the individual learning factor, c2 is the population learning factor, Ai is the individual optimal solution of the particle, and Ag is the current optimal solution of population, that is, the one with the best position among all particles. When the speed exceeds the maximum vmax during iteration, that is, vid>yam, we set vid=vmax to ensure that the particle does not exceed the range of the optimal solution.Genetic algorithm (GA) is an efficient global optimization algorithm that combines the “natural selection, survival of the fittest” rule in the theory of biological evolution with the law of separation and free combination in the law of genetics. In the upper-layer model optimization problem in this paper, when the number of DGs isN, the DG configuration scheme of the system can be represented by an N-bit binary code. Among them, 1 means that DG contributes, and 0 means that DG does not contribute. This forms a chromosome (Chromosome), as shown in Figure 2.Figure 2
Chromosome coding of the upper-level model of the microgrid double-layer economic dispatch.In the genetic operator, the chromosomes with high fitness of previous generation are genetically selected to be inherited to the children (whether the better DG is retained or not). After that, it cross selects different chromosomes for hybridization and combines the individual characteristics of the parents to form children (combined with whether different DGs contribute to the scheme). The mutation operation changes the value of a gene in the parent chromosome with a certain probability (modify whether a DG contributes to the configuration). The genetic algorithm coding optimization process is shown in Figure3.Figure 3
Genetic algorithm coding optimization process.The upper-level decision variables take the values of 0 and 1 integers, and use a sequence of integers to encode them with a vector. The element sequence of the vector corresponds to each DG sequence, and the value of the vector element represents whether to enable the corresponding DG. Among them, 1 means open and 0 means not open, as follows:(29)U=ug1,…,ugn,uw1,…,uwn,us1,…,usn,ub1,…,ubn,ud.In the formula,ud represents whether to purchase or sell electricity from the large power grid.As a criterion for evaluating individual strengths and weaknesses in genetic algorithms, fitness is usually designed by users according to the objective function and constraints. The fitness function fit (x) in this paper is designed as follows:(30)fitx=1Cgrid+Z∗St+M.Among them,Cgrid is the upper-level objective function and St is the measure of violation of constraints. St=1 if the chromosome violates the constraint; otherwise, 0. Z is the penalty coefficient, which is a large positive integer (such as Z=107), and M is a small enough number (such as M=10−6) to prevent division by 0. The entire algorithm flow is shown in Figure 4.Figure 4
Flowchart of the microgrid bilevel economic dispatch algorithm.The optimization process of building a model in this paper is shown in the flow chart. After the upper layer determines the population, the lower layer optimizes each individual and eliminates some inferior individuals. The upper layer solves the upper layer objective function according to the optimization results of the lower layer. After calculating the fitness of each individual, the individual is sorted from good to bad according to the fitness. At this time, if the current optimal individual reaches the lower-level expectation, it will be retained; otherwise, it will be eliminated and a new round of superior and inferior sorting will be carried out, and so on.


## 3. Analysis of the Optimization Model Effect of Microgrid Environment and Economic Impact Based on the Optimization Method

In this paper, the islanding situation of the microgrid is simulated and analyzed. The microgrid has a micro gas turbine unit. The daily load PMCL of the microgrid, the maximum output PWL of a single wind turbine, and the maximum output PSL of a single group of photovoltaic cells are shown in Figure5.Figure 5
Wind and solar output and electrical load in one day.Wind lights are often considered unscheduled due to their intermittent and unpredictable nature, but they can be appropriately scheduled under certain ideal conditions. This paper assumes the ideal conditions as follows:(1)
The output of the scenery is stable in the minimum time period divided(2)
The wind and solar output can be any value between the minimum power and the maximum power in the current periodThe calculation example is shown in Figure5, Δt = 0.5 h, and the method of this paper is simulated and verified in the 20th and 39th time periods, respectively. The results are shown in Figure 6, 7, 8, and 9. Figure 6 is the optimization curve of the operating cost of the island microgrid in the 20th period, where the abscissa is the number of iterations and the ordinate is the operating cost of the microgrid in this period.Figure 6
Optimization curve of the island microgrid operating cost in the 20th period.Figure 7
Optimization curve of the environmental benefit of the island microgrid in the 20th period.Figure 8
Optimization curve of the island microgrid operating cost in the 39th period.Figure 9
The optimization curve of the environmental benefit of the island microgrid in the 39th period.Figure7 shows the optimization curve of the environmental benefit degree of the microgrid in the 20th period. As shown in the figure, as the number of iterations increases, the environmental benefit of the microgrid also increases accordingly. The increase in the total environmental benefit in the figure is not very obvious. The main reason is that the wind and solar output is in a saturated state during this period, the total environmental benefit of the microgrid at the beginning of the optimization is basically close to the optimal, and the optimization margin is limited.Figure8 shows the optimization curve of the operating cost of the microgrid in the 39th period. During this period, the load is heavy and the supply of wind and solar power is insufficient, so the operating cost of the microgrid in this period is very high.Figure9 shows the optimization curve of the environmental benefit degree of the microgrid in the 39th period, and the optimization effect is remarkable.Through the above simulation studies, it is verified that the optimal solution model of the microgrid environment and economic impact based on the optimization method has a good effect, and the method in this paper can effectively improve the microgrid operating environment and economic benefits.


## 4. Conclusion

The key issue of optimal dispatching of the microgrid is the optimization of the operating cost. Its main research purpose is to reduce the overall cost of the system as much as possible on the premise of meeting the load demand and fully reflect the economic benefits of the microgrid. The research on economic dispatch of the microgrid can not only achieve higher reliability and environmental protection benefits but also effectively improve the utilization rate of energy, which is conducive to realizing energy saving and emission reduction and alleviating the pressure on the distribution network. At present, the research mainly focuses on the establishment of the microgrid economic dispatch model and the improvement of the optimal dispatch algorithm. In order to improve the operation effect of the microgrid and improve the economy of microgrid operation, this paper applies the optimization method to the improvement of microgrid operation. The simulation study verifies that the optimal solution model of the microgrid environment and economic impact based on the optimization method has a good effect, and the method in this paper can effectively improve the microgrid operating environment and economic benefits.



---

*Source: 8934330-2022-06-24.xml*