Optimal Operation of Distributed Generations Considering Demand Response in a Microgrid Using GWO Algorithm

: The widespread penetration of distributed energy sources and the use of load response programs, especially in a microgrid, have caused many power system issues, such as control and operation of these networks, to be affected. The control and operation of many small-distributed generation units with different performance characteristics create another challenge for the safe and efficient operation of the microgrid. In this paper, the optimum operation of distributed generation resources and heat and power storage in a microgrid, was performed based on real-time pricing through the proposed gray wolf optimization (GWO) algorithm to reduce the energy supply cost with the microgrid. Distributed generation resources such as solar panels, diesel generators with battery storage, and boiler thermal resources with thermal storage were used in the studied microgrid. Also, a combined heat and power (CHP) unit was used to produce thermal and electrical energy simultaneously. In the simulations, in addition to the gray wolf algorithm, some optimization algorithms have also been used. Then the results of 20 runs for each algorithm confirmed the high accuracy of the proposed GWO algorithm. The results of the simulations indicated that the CHP energy resources must be managed to have a minimum cost of energy supply in the microgrid, considering the demand response program.


Introduction
Along with developing thermal and electrical energy resources as distributed generation resources in microgrids, several methods with different purposes have been proposed to integrate these resources. Using energy management leads to consumption reduction over periods, and consequently, in addition to the appropriate load curve, it reduces the operation and planning cost [1,2]. The purpose of the Energy Management System (EMS) is to realize the best use of units to produce electric and heat power in the microgrid, the best program for the scheduling storage system and proper demand management and proper purchase and sale from the electric grid. There are several methods to establish the most suitable demand management program.
It has been shown in [3] that using energy management and reducing energy consumption in different time intervals, in addition to modifying the load curve, has caused a reduction in the cost of operation and planning. The primary purpose of the above reference is to realize the best use of distributed generation resources to generate power and heat in the microgrid. Intelligent algorithms were used in [4], to determine the best storage system schedule, proper demand management and accurate purchase and sale from the power grid. The results indicated that the use of algorithms and energy management of resources had a significant effect on cost reduction. To execute energy management in demand response programs have been used [5]. Demand response programs in the short-term lead to a decrease in peak demand, and are provided for a short period. In [6], demand response programs are based on encouragement and time-based programs, and the effect of each method in reducing the cost of operation is evaluated. In [7], price-based decentralized control is used for EMS. In decentralized control, each microgrid is controlled by a controller. Decentralized control is a possible solution for many controls and energy management problems in microgrids. It has been proved in [8] that, since the price of electricity varies depending on various times and places, receiving the electricity price at a fixed rate from the customers puts the electricity companies at risk, since they face a variable electricity price in the wholesale market. The authors in [9] believe that applying the actual price of electricity to consumers will increase efficiency. Therefore, the initial idea of this dynamic pricing was to apply the actual price of electricity to the consumers. On the hand, applying the time-varying tariffs, whether in the restructured power system or the traditional systems, improves the load consumption curve and reduces the load during periods of high demand. In [10], time-ofuse response programs were used for microgrid energy management. This method encourages the customers to improve their electricity consumption patterns (consumption in periods of low demand, and reducing consumption in periods of high demand) through the change in electricity prices at different times of the day. Most customers do not have enough time and equipment to respond to these instantaneous changes. Therefore, it seems more logical to use several time intervals a day to apply different electricity tariffs to this group of consumers. The electricity tariff is determined in [11], as different prices for different time intervals of a day. The tariff is usually considered as the average cost of power generation and transmission in each time interval.
In this paper, the optimum operation of distributed generation resources in a microgrid has been performed through GWO to reduce operating costs. The algorithm should choose the most suitable capacity for energy generation by the resources according to the amount of electrical and thermal energy requested by subscribers at every hour and the energy price for that hour, so that the cost is minimized in the system.

The Studied System
The studied microgrid consisted of distributed thermal and electrical generation resources as well as storage which was connected to the national electricity network and could exchange electrical energy with it. A scheme of the studied grid is shown in Fig. 1.

Figure 1: The studied microgrid
In the studied microgrid, distributed electrical generation resources such as solar panels and diesel generators with battery storage and boiler thermal resources with thermal storage were used. Also, in this microgrid, the CHP unit is used for the combined generation of thermal and electric energy. Electric energy transmission trajectories are plotted with black lines, and thermal transfer trajectories are plotted with red ones. In addition, the information transfer between the resources and the control center is plotted with a blue dashed line. The amount of solar radiation is shown in Fig. 2.

Figure 2:
Intensity of solar radiation [12] The amount of electrical and thermal energy demanded by subscribers in the 24-hour study is shown in Fig. 3.
The energy price in the market in the 24-h study is shown in Fig. 4. The maximum and minimum energy price in this microgrid are about 13 cents/kWh and 6 cents/kWh, respectively. In periods of high demand, the energy price is increased in periods of low demand, the energy price has a minimum price, so subscribers are encouraged to reduce consumption in periods of high demand and postpone their consumption to periods of low demand.

Objective Function and Restrictions
The proposed function to have an optimum operation is expressed in Eq. (1). The objective function indicates the operating costs that should be minimized during the planning process. Based on this equation, the operating costs are equal to the total cost of generation (including total variable cost and startup cost) and the cost of implementing demand response programs [13].
where t is the time operator, C i,t LDG and SC i,t LDG are the cost of electric energy generation and the cost of turning off/on the distributed generation, respectively and P i,t L is the amount of contributed electric power of demands in the demand response program, and ρ t L is the reward paid due to consumption reduction. C j,t CHP , and C t SPL are the cost of electric energy generation of combined heat and power (CHP) and the cost of energy generation of solar parking lots (SPL), respectively. The restrictions of the problem are: Power balance restriction: the total power of generation units must meet the demand.
In a grid-connected state, the amount of purchased and sold power is added to the generation units to supply the demand [13].
P Demand Minimum and maximum generation restriction: The generation unit in the microgrid has its operating limitations.

GWO Algorithm
Gray wolves are usually social animals, living and hunting in packs of 5-12. The pack leaders, also known as alpha, are an alpha male and an alpha female. Alpha is mainly responsible for deciding about how to hunt, where to sleep, when to wake up, etc. Decisions of alpha are ordered to the pack. The second in command in the gray wolf pack hierarchy is beta. Beta is an obedient wolf who helps the alpha in decision-making or other pack tasks. The beta wolf must respect the alpha, but it gives orders to the lower-ranking wolves. The lowest ranking is related to the gray wolf or omega. The main hunting phase of the gray wolf is divided into three parts: searching, running, and approaching the prey, chasing, encircling, exhausting the prey until it stops moving, and finally attacking the prey.
To mathematically model the encircling behavior, the following equations are proposed [14]: where t is the current iteration, C are calculated as follows: where components . The hunt is guided by the alpha. The beta and delta might also participate in hunting occasionally. Therefore, we save the first three best solutions obtained so far and oblige the other search agents (including the omegas) to update their positions according to the position of the best search agent. The following formulas are proposed in this regard [14][15][16][17][18]: To

Simulation Results and Analysis
A suitable program for the optimal operation of distributed generation resources and electrical and thermal storage in the microgrid, based on real-time pricing, has been presented. Energy management of resources and electrical and thermal storage was performed using a cost-reduction approach. The GWO algorithm was used for energy management in the microgrid. The algorithm found the optimal variables in such a way that the cost was minimized in the microgrid. The parameters of the proposed GWO are given in Table 1. Simulations have been performed in two scenarios. In the first one, the energy management was just performed on resources and electrical storage. In contrast, the second scenario, energy management of resources and the combined electrical and thermal storages was simultaneously performed in the microgrid. To verify the results obtained from the simulation, a comparison has been made between the GWO results, and the results obtained from Particle Swarm Optimization (PSO) algorithm, Genetic Algorithm (GA), harmony search (HS), and Artificial Bee Colony (ABC).

First Scenario
In the first part of the simulations, the energy management of the resources and electrical storage in the microgrid was done by considering the demand response program to reduce the operating cost through the proposed GWO algorithm. Therefore, it was assumed that there was no control over the thermal resources, the required thermal energy of the subscribers was supplied by the boiler without any restrictions, and CHP only produced electrical energy. Also, there was no thermal energy storage in the system. The convergence process of the GWO algorithm in the optimization process is shown in Fig. 5. The energy supply cost without considering the demand response program was $2673, while after optimization through the proposed GWO algorithm, the amount of $1862 was obtained. The GWO algorithm converged to its final value after 25 iterations. In Table 2, the values of the best, the worst, and the average response, as well as the standard deviation for 20 iterations of running the PSO, GA, HS, (ABC) as well as the proposed GWO, are given.
The best responses for the PSO, GA, HS, ABC, and GWO algorithms were obtained as $1908, $1921, $1874, $1893, and $1862, respectively. On the other hand, the low value of standard deviation for the proposed GWO algorithm indicated its higher efficiency, and because if the optimization algorithm has immediate responses to each other in different iterations, then the standard deviation would be at its minimum value. The power generated by the diesel generator, CHP, solar panel, and battery storage in the 24-hour study is shown in Fig. 6 after optimization.  According to Fig. 6, most of the battery storage has been performed from 1:00 a.m. through 6:00 a.m., and most battery discharges occurred from 7:00 p.m. to 9:00 p.m. Batteries play a vital role in supply shifting and reducing costs in demand response programs. The amount of electrical energy transmitted to the nationwide electric network at the time of study is shown in Fig. 7. As illustrated in Fig. 7, the presence of the distributed generation of electrical resources has caused the received electrical energy from the grid to be negative in periods of high demand meaning that the electricity is being sold to the network. Selling electrical energy in periods of high demand, has made a sufficient profit for the microgrid operator, through which the energy supply costs in the microgrid become minimum. For instance, at 10:00 a.m., a profit of about $48.3 was made due to selling electrical energy.  It is worth mentioning that, due to a lack of thermal resources management, the produced thermal energy profile by the boiler is precisely similar to the thermal energy needed by the consumers.

Second Scenario
To minimize the energy supply cost in the microgrids, it is required that the demand response program (DRP) be performed considering thermal and electrical resources at the same time because both terms are almost equally effective in the total cost of the microgrid. In the third scenario, thermal and electrical energy management in the microgrid is simultaneously performed using the GWO algorithm. Energy management of diesel generators, solar panels and battery storage as the electrical resources, and boiler with thermal storage has been performed as the thermal distributed generation resources. Finally, CHP has been carried out as the combined heat and power resources in the microgrid. The convergence process of the GWO algorithm in the problem of optimum energy management of thermal and electrical resources in the microgrid is shown in Fig. 9. The cost of the microgrid after optimum management of the combined heat and power through the GWO algorithm was determined as $1637. The GWO algorithm converged to its minimum value after 31 iterations. Like the two previous scenarios, optimization algorithms were performed for 20 runs, the results of which are given in Table 3. The optimization results in the third scenario indicated that the best response in the case of optimization through algorithms of PSO, GA, HS, ABC, and GWO had been calculated as $1672, $1684, $1652, $1662, and $1637, respectively. The slight difference between the obtained responses after 20 iterations of the GWO algorithm led to a standard deviation of 6.6, which is less than the value obtained through other algorithms. In the continuation of the procedure of the performed simulations, the amount of power generated by the electrical resources, and the amount of power generated by the thermal resources during a day in the case of optimization through GWO are shown in Figs. 10 and 11, respectively.  Like the previous scenarios, to minimize the energy supply cost in the microgrid, energy storage depends on the low price of electricity and the periods of low demand in the microgrid. During these periods, the storage units store thermal and electrical energy at their maximum capacity, so that they can respond to the demand during periods of high demand. Other electrical and thermal resources also contribute to the energy required by the consumers, depending on the costs and price of the electricity in each period of demand. The amount of electrical energy transmitted with the nationwide electric network for the 24-hour study is shown in Fig. 12. Like the first scenario, electrical energy purchased in the early hours of the day is just for charging the batteries, so that it can make a profit through selling the stored electrical energy in the periods of high demand. In this paper, based on real-time pricing and to reduce the energy supply cost in the microgrid through the GWO algorithm, the optimal operation of distributed generation resources and combined electrical and thermal storages in the microgrid was carried out. The studies were separately conducted in two scenarios. In the first part of the simulations, the energy management of resources and electric storage in the microgrid was done by considering the demand response program through the GWO algorithm, and there was no control of the heat resources. The total energy cost, after performing optimal energy management through the proposed GWO algorithm, in the first scenario, was decreased by about 30% compared to the primary conditions. In the second part of the simulations, to minimize the energy supply costs in the interested microgrids, the demand response program was carried out considering thermal and electrical sources at the same time. The total energy cost, after performing optimal energy management through the proposed GWO algorithm, in the second scenario, was decreased by about 30% compared to the primary conditions. Therefore, to have the minimum cost of energy supply in the microgrid, it is suitable to perform simultaneous management. On the other hand, comparing the results of the proposed GWO algorithm with some other optimization algorithms showed the high efficiency and accuracy of the GWO algorithm.