Optimal Scheduling of Dynamic Pricing Based V2G and G2V Operation in Microgrid Using Improved Elephant Herding Optimization

: The unpredictable nature of the loads and non-linearity of the components of microgrid systems make optimal scheduling more complex. In this paper, a deterministic optimal load-scheduling problem is developed for microgrids operating in both islanding and grid-connected mode under different energy scenarios. Various cases are considered in this research, based on the interaction and dynamic behavior of the microgrid, considering electric vehicles (EVs) in the scenario. The aim of this research is to minimize the overall cost of microgrid operations. The concept of dynamic pricing has also been introduced in order to optimize the energy cost for the consumers. For ensuring the stability of the microgrids, a load variance index has been considered, and the fuzzy-based approach has been used for cost and load variance minimization to reduce the operation cost without compromising the stability of the microgrid. The grid-to-vehicle (G2V) and vehicle-to-grid (V2G) operations of EVs are integrated into the microgrid, which would help in valley ﬁlling and peak shaving of the loads during the off-peak and peak hours, respectively. In order to solve the proposed complex combinatorial optimization problem, elephant herding optimization (EHO) is modiﬁed and implemented. The performance of the proposed improved EHO (IEHO) is ﬁrst tested on the latest CEC test functions. The results obtained by IEHO after 100 different trials are compared with the latest published methods and are found to be better based on the average value and the standard deviation for different CEC test functions. In addition, the simulation results obtained by particle swarm optimization (PSO), EHO, and proposed IEHO on a microgrid test system for different scenarios with all cases reveal that the proposed model with a mix of energy resources in the dynamic load dispatch environment bring the maximum beneﬁts of microgrid systems. Furthermore, the results obtained from the simulation veriﬁes that if free trade of power is allowed between the microgrids and the main grid, the process of power generation can be more economical, and further introduction of dynamic pricing into the scenario proves to be even cheaper. The implementation of the G2V and V2G operations of EVs operations in the proposed scenario not only helped in cost minimization but also helped in stabilizing the grid.


Introduction
The modern power system consists of large-scale interconnections of generators and loads at a national level, which leads to various challenges and issues such as low connectivity in far-fetched areas, optimal scheduling of generation, and controlling voltage and frequency [1]. The intensive deployment of non-conventional electricity generating units, e.g., solar photovoltaics (PV), small-sized wind turbines (WT), diesel engine-based generators (DE), and gas-based micro-turbines (MT), has deeply penetrated existing mediumand low-voltage distribution networks in the past few decades [1]. The inclusion of renewable energy resources led to the problem of uncertainty in the power output since it highly depends on nature and introduces harmonics in the system [1]. The centralized conventional power plants have a high cost of installation, whereas localized installation of small-sized renewable energy resources has proven to be beneficial as it is less cost extensive and provides monetary benefits to the consumer, and reduces the impact on the environment [1,2]. A mix of multiple sources of electricity can be advantageous in ways such as increased energy security, decreasing the dependency on the grid, providing economic benefits to the user in grid-connected mode, and helping in demand-side management by load shedding, load building, sustainability, power quality, lower electricity costs, transmission, and distribution line losses [2]. Despite the enormous benefits, the incorporation of renewable energy sources leads to a number of disadvantages, such as the introduction of harmonics and high uncertainty in the power outputs. In order to reduce some of the issues associated with renewables directly and indirectly affecting the main grid, the concepts of distributed energy generations, local energy systems, and microgrids are proliferating in modern power distribution systems [2].
A microgrid can be visualized as a miniature version of a centralized national power grid that has a small number of interconnected loads and renewable energy generations, along with some control and protection units that allow it to operate independently [3]. This integration has resulted in the creation of a new form of practical framework. The setting up cost of a microgrid can be quite low if the existing distribution system infrastructure is effectively utilized with required retrofitting technologies. The challenge of incorporating uncertainties in renewable generation and load consumption are much higher in microgrids than the main grids because of minimal aggression and smoothing effects [3]. Microgrids have two modes of operation, namely islanding mode or stand-alone mode, and gridconnected mode. The microgrids in stand-alone operations are highly vulnerable to instability when intermittent energy sources are present [4]. In this mode, the microgrid is neither supplying nor demanding power from the main grid of operation; the supply and demand must be balanced for the stability of the system. In practice, this might be very challenging and sometimes not possible in the absence of dispatchable generations since the power output of renewable generators is nondeterministic in nature because of the meteorological conditions of that area [5]. Therefore, dispatchable generators are also deployed for making the system more redundant and reliable, e.g., biomass generators and geothermal. Additionally, energy storage systems, such as battery energy storage, could be incorporated that could flexibly handle these disturbances and help to maintain the microgrid system stability.
In the grid-connected microgrids, the operation cost of a microgrid is significantly reduced when it can exchange electrical energy with the national grid and other sur-rounding microgrids [6]. Since they incorporate several renewable resources, they are relatively more environmentally friendly as compared to existing conventional energy sources. The aim of multiple dispatchable and non-dispatchable energy resources is to minimize the microgrid operation and the pollutant treatment costs while improving system reliability and stability. Additionally, the load variance of the main grid is minimized in order to increase the feasibility of the microgrid and reduce the environmental impact [6]. However, the optimal microgrid scheduling is a large-scale complex combinatorial optimization problem and thus requires adequate, efficient tools and optimization methods to determine optimal solutions aiming to maximize the techno-economic and social benefits of all stakeholders.
A variety of tools have been widely used for solving the optimization problems of microgrids [7], which partially satisfy the desired objectives and conditions. EnergyPLAN [8] and HOMER [9] are among the most popular tools nowadays used to solve the microgrid design and operation problems. The EnergyPLAN tool helps in designing national and regional energy planning strategies with the help of simulation of the concerned energy system and optimizing the results in terms of environmental, economic, and energy-related constraints. HOMER is a software that helps in designing and optimizing stand-alone systems. However, due to the fact that these cannot optimize the economic dispatch with details to technical constraints of the system [7], such as a start-up and shutdown times of the generation system, they are considered to be an important factor for the realistic realization of the microgrid on island mode [10]. Mazidi et al. [11] have incorporated demand response programs in which they modeled detailed households with appliances and their consumptions. The demand response system gives incentives to the consumers, which in turn helps increase consumer participation [11]. Arif et al. [12] have considered a genetic algorithm for combining demand-side management, and their mode collects the cost of production of energy from various sources and preferences of demand data from customers [12]. The Advanced Interactive Multidimensional Modeling System (AIMMS) is proposed by Nwulu and Xia [13] to solve the microgrid model and concludes that the introduction of demand response programs as an energy management technique is helpful and is optimal for the supply side, as well as the demand side of the microgrid that reduces the consumption of power in some of the case studies. They have implemented demand-side management in systems of various sizes. Researchers have included initial investment cost for setting up microgrids [14] and considered the constraint of the utilization rate of energy from renewable energy sources and the probability of loss of supply power. The particle swarm optimization method has been used to attain a daily dispatch strategy. Silvaa et al. [3] aimed at a multitemporal stochastic method that would make use of the Monte Carlo technique to take a spatiotemporal correlation of variables into consideration while ensuring the comfort of the consumers. Moreover, the costs based on comfort penalties are also discussed in this paper in order to prove a suitable alternative for comfort constraints. Trivedi et al. [15] have tried to make microgrids a feasible and practical alternative; new and innovative methods were being tested and were to be employed for overcoming those shortcomings.
There has been growing research on electric vehicles' charging and management in modern distribution networks. Moreover, the battery swapping stations for the electric vehicle (EV) are also becoming popular nowadays. The priority will be given to renewable energies to charge these batteries and EVs. These researches have proposed multi-level optimization models for coordinated charging and discharging of the EVs and batteries for valley filling. The research data for analysis purposes are gathered according to the local wind speed and solar illumination. In addition, the EV charging is managed according to the standards and rules set by the authorities. Borges et al. [16] have chosen a case study in which they considered an evolution scenario of distributed generators for the year 2050, keeping the rapid advancements in mind. It includes various renewable energy resources, energy storage devices, and EVs, all of which are managed by aggregators [16]. Of various algorithms for the purpose of optimization, Albaker and Khodaei [17] have used the NSGA-II algorithm for the optimal configuration of the design and scheduling of the microgrid system. This model is comprised of unit commitment, charging/discharging properties of energy storage, and demand response. Yan et al. [18] considered the investigation of unused capacity for the microgrid during the operation and the dispatch of additional power to other microgrids based on the biding schemes in order to maximize the economic benefits from microgrid operations. Alramlawi et al. [19] proposed an EMPC-based technique for active-reactive load dispatch in a microgrid with a diesel generator, PV, and battery. The authors simulated grid blackout conditions, making the microgrid run on islanding mode. The authors also considered the battery life for the operation and its replacement cost for their model to minimize the operation cost of the microgrid. They concluded that the generation of reactive power locally is more beneficial in terms of cost compared to importing it from the main grid. They have suggested that the use of PV inverter for generating reactive power as compared with battery inverter is more efficient. Liu et al. [20] focused on the economical load dispatch of a microgrid on islanding mode considering multiple aspects. The authors concluded that decentralization could make global optimal Sustainability 2021, 13, 7551 4 of 24 dispatch (GOD) if and only if the optimal solution functions are strictly monotonically increasing in nature. Massagué et al. [21] proposed an optimal formulation for the flow of power for feeder flow controlled microgrid. The authors also took uncertainty into account by using stochastic formulation. Along with this, the authors developed an algorithm in order to obtain an optimum solution, and the authors validated the algorithm on the IEEE 33-Bus distribution test system. Wen et al. [22] made use of a deep recurrent neural network with short-term memory units (DRNN-LSTM) for forecasting the net load of a building and the output power of PV during small intervals of time. The authors considered a load dispatch model that included solar PV, electric vehicles under various scenarios, and their uncertainties have also been considered. The authors found that their technique of load forecast is highly effective for short-term forecasting, which would help in economic load dispatch of the microgrid. Pourghasem et al. [23] have considered a stochastic model for the optimal management of the microgrid integrated with combined heat and power (CHP) while ensuring reliability and economic and environmental factors. The authors considered uncertainties such as an error in loads forecasting and uncertainty of wind power output. They tried to solve this nonconvex, nonlinear complex problem using the exchange market algorithm (EMA). The aim is to minimize the fuel cost and emissions using this algorithm. Fioriti and Poli [24] proposed an optimal load dispatch methodology based on a two-stage formulation that would break down a stochastic problem into several sub-problems, of which all solutions are aggregated with the help of an aggregator by means of simulations and a cost-based rule. It has been found that the model achieved cost savings when implemented for a rural microgrid in Uganda, and the computational requirements were also reduced because of this proposed technique. A bi-layer optimal management strategy is also proposed by Moretti et al. [25] for a microgrid running on islanding mode. Amongst these layers, the upper layer is fulfilling the demand, whereas the second layer regulates real-time operations. The algorithm is implemented on a rural microgrid in Somalia and performed minute-by-minute simulations. The simulation results revealed that the method had reduced fuel consumption, and high renewable penetration made it possible. The literature review shows that some of the optimization techniques found a suboptimal solution when the nature of the constraints is increased.
To solve this nonlinear, complex, multi-constraints optimization problem, the EHO technique is considered and implemented in this paper. This algorithm has been gaining popularity because of its extensive exploration and exploitation abilities for solving real-life engineering optimization problems. The basic elephant herding optimization (EHO) is a powerful method. However, when basic EHO is implemented for solving the proposed problem, it is not able to get a near-optimal solution. Further, a few modifications are also suggested to overcome some of the limitations of the standard variant of EHO observed when applied to solve complex real-life optimization problems.
The main contributions of this paper are summarized as follows: • A deterministic multi-objective optimization problem is considered for optimal scheduling of microgrids by considering a mix of multiple dispatchable and non-dispatchable (renewables) distributed energy resources to exploit the maximum benefits of such resources over different scenarios. This deterministic multi-objective optimization problem is solved using the proposed fuzzy-based improved elephant herding optimization (IEHO) approach.

•
The impacts of vehicle-to-grid (V2G) and grid-to-vehicle (G2V) with the load variance of the main grid have been included and investigated for the microgrid system. • A dynamic pricing environment is considered with the impacts of vehicle-to-grid (V2G), and grid-to-vehicle (G2V) with the load variance of the main grid has also been proposed to facilitate fair competition for all microgrid stakeholders over multiple scenarios and different benchmark test system.

•
For solving real-life stochastic, complex, multi constraints engineering optimization problems, an improved variant of elephant herding optimization is proposed to The proposed fuzzy-based improved EHO method is implemented to solve a multiobjective microgrid-scheduling problem and validated on a microgrid test system in three different scenarios with six different cases. The proposed fuzzy-based improved EHO method obtained better results in proposed Scenario 3 than Scenario 1 and Scenario 2. Proposed Scenario 3 not only helped in cost minimization but also in stabilizing the grid.

•
The validation of the proposed IEHO is carried out by comparing the simulation results with the same obtained by standard EHO and PSO methods on the microgrid test system with three different scenarios with six different cases. The proposed IEHO outperformed these methods in terms of searching and convergence.
The rest of the paper is structured as follows: Section 2 presents the modeling of different distributed generations; the problem formulations and constraints are given in Section 3; Section 4 describes the proposed optimization method; the testing of the IEHO on CEC test functions is shown in Section 5; Section 6 analyzes the test system, scenarios, data of DGs and EV; the results analysis and discussion for all the scenarios are given in Section 7; and finally, the main conclusions are summarized in Section 8.

Modeling of Different Distributed Generations
In this section, the deterministic modeling of different dispatchable and non-dispatchable distributed generations considered for microgrid systems is presented, such as Diesel Engines (DE), Fuel Cells (FC), Micro Turbines (MT), Solar PVs (PV), Wind Turbines (WT), and Electric Vehicles (EV). EV charging and discharging models are considered for V2G and G2V applications in the proposed microgrid. A detailed description of each is presented in the following sections.

Generation Characteristics of DGs
The proposed microgrid system consists of multiple DEs, WTs, and solar PVs. The data on the power output of renewable energy resources are taken from reference [26], and the data on the output power of the diesel generators are generated randomly, satisfying all the constraints set on the diesel generators.

Diesel Engines (DE) Model
The diesel engine model is expressed by Equation (1) [27]: where C DE is the fuel cost of diesel engine; P DE is the output power of the diesel engine; ∆t is the length of a period in which the total duration is divided; and α, β, and γ are the coefficients of the diesel engine.

Fuel Cells (FC) Model
The equation for the fuel cell model can be written by Equation (2) [28]: where C FC is the gas consumption cost of the fuel cell; C nl is the price of the gas; P DE is the output power of the fuel cell during time ∆t; η J is the efficiency of the fuel cell; and L is the net thermal value of gas.

Micro Turbines (MT) Model
The microturbine model is expressed by Equation (3) [28]: where efficiency of MT can be expressed as where C MT is the fuel cost of the micro turbine; P R is the rated output power of the microturbine; P MT is the actual power output of the microturbine; C GAS is the cost of natural gas; LHV is the low calorific value of the fuel; η MT is the efficiency of the microturbine in the period t; and x, y, z, and c are the coefficients.

Solar PVs (PV) Model
The output power model of PV can be expressed by Equation (5) [27]: where P PV is the actual output power of the solar PV; P STC is the maximum power output from the solar PV at standard test condition (STC); G ING is the intensity of light which is falling on the solar PV; G STC is the intensity of light falling on the solar PV at standard test condition; k is the power generation temperature of the PV; T C is the temperature of the PV cells; and T STC is the temperature of the PV cells at standard test condition.

Wind Turbines (WT) Model
The output power model [29] of WT is expressed by Equation (6): where P WT is the actual output power of the wind turbine; V is the velocity of the wind flowing; and P r is the rated power of the wind turbine, being, ci V r , V co , and V ci are rated wind speed, cut-out wind speed, and cut-in wind speed, respectively. The log-normal distribution, i.e., s~Log-N (µ s , σ s 2 ), best defines the daily driving distance of an EV [30,31]. The probability density function for the given distribution can be expressed by Equation (7): where µ s = 3.2 and σ s = 0.88. The probability distribution of daily driving distance is taken from [26].
The daily driving distance of the majority of vehicles is concentrated between 0-100 km. Only a few vehicles travel beyond a distance of 100 km. This driving distance is used to determine the state of charge (SOC) of an EV, as expressed by Equation (8).
where d is the daily driving distance and R is the maximum driving distance of the EV when its battery is fully charged. These EVs, after traveling throughout the day, are connected to the grid during the peak-load hours and discharge power into the grid. Equation (8) gives the percentage of SOC available to discharge power into the grid. The percentage of SOC that can be used for discharging power into the grid is bounded. To ensure the longevity of the battery, the SOC must not drop below the safe limits, which is SOC EV min , taken from [32].
The same daily driving distance formula is used to calculate the SOC of the battery just before charging. Therefore, the amount of SOC that must be recharged is expressed by Equation (10) [32]:

The Charging and Discharging Powers of EV
The charging and discharging of an EV can be divided into three different modes [33] such as slow, conventional and fast respectively. In addition, the rated voltage and rated current values of these different modes are also considered from [33] for the study.

Starting Charging and Discharging Time of EVs
The charging and discharging situation of an EV can vary depending on the owner. Practically, it is ideal for charging the EVs when the load on the grid is minimum and discharge power to the grid when the demand is at its peak. Therefore, it is proposed that starting the charging and discharging time of an EV follows a normal distribution t_start~N(µ s ,σ s 2 ), where µ s = 240, σ s = 100 for starting charging time and µ s = 1020, σ s = 100 for starting discharging time. Equation (11) is an expression for the probability density function of starting charging time of the EV, as in [32,33].
It can be seen from Figure 1 that the EVs charge post-midnight when the demand is usually minimum and discharge during the evening time when demands are at their peak. This time frame for charging and discharging can be adjusted according to the load curve.
It can be seen from Figure 1 that the EVs charge post-midnight when the demand is usually minimum and discharge during the evening time when demands are at their peak. This time frame for charging and discharging can be adjusted according to the load curve.

Calculation of Charging and Discharging Time
The total time required to charge mth EV, as suggested in [32], can be expressed by Equation (12): where, t charge,m is the time required for charging the battery and SOC charge,m is taken from Equation (10). S is the capacity of the battery and P charge,m is the power required to charge the EV depending on the charging mode. The total time for which the EV will be discharged, as in [32], is determined by Equation (13): It is assumed the EVs do not discharge power after midnight as the demand is not that high. No matter how long the discharging duration is, EVs will stop discharging power to the grid post-midnight. t discharge,m is the time period for which the battery of mth EV is discharged. SOC discharge,m is taken from Equation (9). S is the capacity of the battery. P discharge,m is the power required to charge the mth EV depending on the discharging mode.

Calculation of EV Charging and Discharging Loads in the Microgrid
A day is divided into 1440 min [32]. The total charging load at the ith minute is the sum of charging power by all the EVs at this minute. Similarly, the total discharging load at the ith minute is the sum of power being discharged by all the EVs at this minute. For M EVs connected to the grid, the charging and discharging load profile as in Figure 2 is given by Equation (14): where L i is the total charging demand at the ith minute. i ranges from 1 to 1440; P charge,m,i and P dicharge,m,i are the charging power demand and discharging power of mth EV during the ith minute, respectively. The flowchart of the charging and discharging load profile of EV is shown in Figure 2.

Problem Formulations and Constraints
The objective of this work is to minimize the objective functions, i.e., the cost of microgrid operations, as described in the following sub-sections. The aim is to achieve the optimized model with minimal environmental impact and the lowest cost of operation of the microgrid while ensuring its stability and safe operation. The microgrid modeling, used for the multi-objective optimization problem of optimal scheduling of microgrids, has been realized by taking care of all the objective functions, which include fuel costs, operation and maintenance costs, pollution treatment costs, and load variance, while satisfying all the constraints of the system.

Operating Cost of Microgrids
The operating cost of a microgrid includes the fuel cost of various DGs and its maintenance cost. Other than fuel costs and maintenance costs, the cost of the transaction of power between the main grid and the microgrid has been included. Hence, the operating cost of the microgrid of DGs, as in [26] can be expressed by Equation (15):

Problem Formulations and Constraints
The objective of this work is to minimize the objective functions, i.e., the cost of microgrid operations, as described in the following sub-sections. The aim is to achieve the optimized model with minimal environmental impact and the lowest cost of operation of the microgrid while ensuring its stability and safe operation. The microgrid modeling, used for the multi-objective optimization problem of optimal scheduling of microgrids, has been realized by taking care of all the objective functions, which include fuel costs, operation and maintenance costs, pollution treatment costs, and load variance, while satisfying all the constraints of the system.

Operating Cost of Microgrids
The operating cost of a microgrid includes the fuel cost of various DGs and its maintenance cost. Other than fuel costs and maintenance costs, the cost of the transaction of power between the main grid and the microgrid has been included. Hence, the operating cost of the microgrid of DGs, as in [26] can be expressed by Equation (15): (15) where C 1 is the operating cost of the microgrid; F i is the fuel cost coefficient for ith DG; P i,t is the output power of the ith generator at tth hour; OM i is operation and maintenance cost coefficient for ith DG; and C grid is the cost of trading the power between grid and microgrid.

Pollutant Treatment Cost
Pollutants are discharged in the process of electricity generation, which is very hazardous to the environment. In order to minimize the environmental impact of these pollutants, exhaust gases are treated before being discharged into the air. CO 2 , SO 2 , and NO X are the three major pollutants that have been considered in this article. The pollutant treatment cost of the microgrid with N DGs and the grid [26] can be expressed by Equation (17): where C 2 is the pollutant treatment cost of the microgrid; c j is the fuel cost coefficient for ith generator; λ i,j and λ grid,j is the output power of the ith generator at tth hour; P i is the output power of the ith DG. In addition, P grid is the power traded between grid and microgrid.

Load Variance of the Grid
For stability of the power system and to promote the economic operation of the power grid, it is equally important to minimize the peak-valley gap in the load. This will ensure the safe and reliable operations of the power system. The load variance can be described as the difference between peak and valley loads. Equation (18) best reflects the load variance of the grid, as in [26]: where

Multi-Objective Optimization
For all the cases considered in this work, the focus is on the minimization of cost as well as load variance. Both operating cost (C 1 ) and pollutant treatment cost (C 2 ) of the DGs are directly related to the cost of the microgrid. Therefore, both C 1 and C 2 have been consolidated into one objective. On the other hand, the load variance of the grid is representing the standard deviation of the load demand over a time period of T from Equation (18), which cannot be represented in terms of cost. Hence, a fuzzy-based approach has been considered in this paper for solving the multi-objective optimization problem. In the fuzzy domain approach, the individual objects are associated with a membership function. Each membership function indicates the degree of satisfaction of the objective [34]. The objective function for the optimal load dispatch model of the proposed microgrid can be defined by Equation (20):

Constraints
The system contains a number of electrical and mechanical equipment that have their own related constraints. In order to carry out the simulations in the closest to the actual operating conditions, these constraints have been considered. Thus, the simulations replicate the actual running of the microgrid. The details about all these constraints are explained in the following subsections.

Power Balance of the Microgrid System
The microgrid must keep the balance between demand and supply. This equality constraint, as in [32], can be expressed by Equation (12):

Output Power Limits of the DGs
All the DGs in the proposed microgrid must satisfy the upper and lower generation limits. This boundary constraint, as in [26], can be defined by Equation (22):

Ramp Rate Limits
The rate of increase or decrease in the output power per unit time is defined as the ramp rate. The ramp rates for various DGs, as in [26], can be defined by Equation (23):

Charging/Discharging Power of EV
To eliminate the risk of damaging the battery due to high charging and discharging power and to increase the effective service life of the battery, the following constraint is satisfied, as suggested in [23]: 3.3.5. Capacity Constraints of the EV Batteries SOC can be defined as the ratio of residual energy to rated energy. For longer battery life, this SOC must remain within a certain range, which can be expressed by Equation (25) [33]:

Transmission Power Constraints
As suggested by Lu et al. [26], the transaction of power between grid and microgrid must not exceed the safety limits in order to ensure smooth operation of the power system, expressed by Equation (26):

Proposed Optimization Method
The optimization problem developed in the previous section is a complex combinatorial multi-objective optimization problem and therefore requires an efficient method to determine a global solution. For optimization, a swarm-based optimization technique, known as elephant herding optimization (EHO), has been used. Further, a few improvements are also suggested to overcome some of the limitations observed in its standard variant. The technique is inspired by the animal behavior and replicates it for finding the optimal solution based on the criteria and parameters set and the initialization provided.
The basic steps of standard EHO are presented in the following sections, followed by suggested modifications.

Elephant Herd Optimization (EHO)
The EHO method is a swarm-based bio-inspired search method [35,36] that aims to solve optimization problems. This optimization technique is inspired by the evolutionary behavior of elephants for food searching. The elephants divide themselves into two groups, representing two methods of finding food. The male elephants search for food in different dimensions of the search space. At the same time, the female elephants [36] perform a localized search in the region of close proximity. EHO has outperformed existing metaheuristic genetic algorithms such as biogeography-based optimization (BBO), differential evolution (DE), and genetic algorithm (GA). The performance of elephant herding optimization has shown more stability as compared to the metaheuristic algorithms described above.
The following ideal situations are considered for solving a multi-objective optimization problem by using EHO [35]:

•
There are clans into which the elephants are segregated, with each clan having the same number of elephants. • All the clans will have the same number of male elephants that would leave the clan in search of an optimal solution. • The elephants of the clan live under the leadership of a matriarch.
There are two factors that can control the performance of the EHO method: • The first factor is the clan updating operator. In the above discussions, it has been already mentioned that each clan is headed by a matriarch, and thus the next positions of the elephants in the clan are governed by the position of the matriarch. The clan updating operator is the factor that takes into account this phenomenon, and thus the updated position of the jth elephant of the clan is given in Equation (27), as suggested in [35].
where qi is the matriarch of the ith clan; x mod,ci,j and x qi,j are the updated and the previous position of the jth elephant; α is a factor that determines the influence of the female head of the clan on the clan and ranges between zero and one; and x best,qi is the fittest individual elephant. The position of the fittest elephant in the group is updated by Equation (28): where β shows the influence of x mid,qi on x mid,qi,j .

•
The second factor is the separating operator. As previously mentioned, the male elephants leave their respective clans and perform the wider searches on their own. The separating operator replicates this phenomenon for the particles. For the sake of research, it is assumed that the particle having the worst fitness [35] separates from the clan, and the particle with the worst fitness is given by Equation (29): where x maxm and x minm are the upper bound and lower bound of each individual elephant.

Improved Elephant Herd Optimization (IEHO)
The EHO technique is a powerful tool to solve the real-life optimization problems in various fields-see, e.g., reference [37], where the authors researched the problem of flight route optimization of unmanned aerial vehicles (UAV) in a battlefield situation. For solving this problem, various constraints must be handled. The authors mentioned the constraints as determining the optimal route, escaping traps, and threats, including safety performance. The authors compared the results obtained by EHO with other genetic algo-rithms but found that the results obtained by EHO outperformed all the other approaches. Sambariya and Fagna [38] used EHO to search for the parameters of the Proportional Integral Derivative (PID) controller for a localized power system. The PID controllers that used conventional methods, e.g., the Zeigler-Nichols method and Cohen-Coon method, were not efficient in huge and complicated power system networks; therefore, the authors selected EHO for this optimization problem and found that the results obtained by simulations show the effectiveness of the controller, with lower settling time as compared to other controllers. The third optimization technique used for this paper is an improved version of EHO, which makes the process of exploration and exploitation extensive and faster, thus making the convergence rate faster. Based on the literature, it can be observed that for better exploration and exploitation and an even faster convergence rate, the conventional EHO has been modified while satisfying all the constraints, thereby improving the performance of the algorithm for solving complex problems with multiple constraints and large dimensions. Therefore, in this paper, some modifications in basic EHO are proposed that would improve the performance of this algorithm for optimal scheduling problems. The following modifications are proposed in the standard EHO technique: 1.
The elephant (particle) with better fitness replaces the elephant with worse fitness among the two generations. This modification has been incorporated so that the time taken by the particle of worse fitness to converge to the optimal solution is saved because the particle with better fitness would converge to the optimal solution faster as compared to the particle with the worse fitness. 2.
The number of male elephants is more than one in each clan. By increasing the number of male elephants, the process of exploration and exploitation becomes rapid as there are more male elephants, therefore decreasing the time required to converge to the optimum solution.

3.
If the new fitness of the male elephant of the clan is worse than the previous fitness, this set of particles is discarded, and the previous set of particles is used. This further reduces the number of iterations required to come to the optimum solution, as the algorithm keeps on comparing the fitness value of the particles on the current generation and the previous generations. Thus, the time for convergence is again reduced.
The impact of these three modifications can be visualized in the results section by comparing the optimal solutions obtained by its standard and modified variants. The flow chart for implementing the improved elephant herding optimization method is given in Figure 3.

Testing of the Proposed Improved EHO (IEHO) on CEC Test Functions
The proposed improved EHO is tested on 10 IEEE Congress on Evolutionary Computation (CEC) Test Functions [39] to determine its performance. These functions are known as CEC-C06 2019 Benchmarks "The 100-Digit Challenge", which are to be used in the annual optimization competition. Of the 10 functions mentioned in Ref. [39], CEC01 to CEC03 are non-rotated functions, while the rest are rotated functions. A point to be noted is that all the functions are scalable. From Ref. [39], note that apart from CEC01 to CEC03, all the other functions are 10-dimensional minimization problems in the range of [−100, 100]. The proposed improved EHO is compared with Fitness Dependent Optimizer (FDO) [39], Dragonfly Algorithm (DA) [39], standard WOA [39], and Salp Swarm Optimization (SSA) [39] to validate the results. These four algorithms are chosen because they are well cited and popular, have a well-established performance on standard benchmark functions and in solving actual problems, and the codes for implementation are provided freely by the authors.
The parameters for improved EHO are: number of clans = 5, number of elephants = 8, and maximum number of iterations (itrmax) = 100. MATLAB ver. 2018b is used to simulate these benchmark functions. The computer specifications are Processor-Intel i5 7th Generation @ 2.50 GHz, RAM-16 GB, and Storage Capacity-1 TB.
The optimization results obtained using the proposed IEHO and the other four algorithms are compared in Table 1 based on the average value and the standard deviation.

Testing of the Proposed Improved EHO (IEHO) on CEC Test Functions
The proposed improved EHO is tested on 10 IEEE Congress on Evolutionary Computation (CEC) Test Functions [39] to determine its performance. These functions are known as CEC-C06 2019 Benchmarks "The 100-Digit Challenge", which are to be used in the annual optimization competition. Of the 10 functions mentioned in Ref. [39], CEC01 to CEC03 are non-rotated functions, while the rest are rotated functions. A point to be noted is that all the functions are scalable. From Ref. [39], note that apart from CEC01 to CEC03, all the other functions are 10-dimensional minimization problems in the range of [−100, 100]. The proposed improved EHO is compared with Fitness Dependent Optimizer (FDO) [39], Dragonfly Algorithm (DA) [39], standard WOA [39], and Salp Swarm Optimization (SSA) [39] to validate the results. These four algorithms are chosen because they are well cited and popular, have a well-established performance on standard benchmark functions and in solving actual problems, and the codes for implementation are provided freely by the authors.
The parameters for improved EHO are: number of clans = 5, number of elephants = 8, and maximum number of iterations (itrmax) = 100. MATLAB ver. 2018b is used to simulate these benchmark functions. The computer specifications are Processor-Intel i5 7th Generation @ 2.50 GHz, RAM-16 GB, and Storage Capacity-1 TB.
The optimization results obtained using the proposed IEHO and the other four algorithms are compared in Table 1 based on the average value and the standard deviation.  Table 1 shows the proposed IEHO performs better than all the mentioned algorithms for all the functions except for CEC06, where it just outperforms FDO, while DA, WOA, and SSA perform better than IEHO. However, for all test functions, STD obtained by IEHO is much better than other reported methods. A point to note is that for all 10 functions, the results of IEHO are better or almost equal. Another point to note is that CEC02, CEC03, CEC09, and CEC10 have a 0 standard deviation when solved using IEHO, which implies that in all the trials, it has the same result and does not have any chance of further developments or improvement.

Test System, Scenarios, Data of DGs and Electric Vehicles
This section consists of details of the test system, EVs, DGs, and a discussion about the different scenarios and cases presented here.

Test System and DG Parameters
As discussed in the problem section, the proposed microgrid consists of multiple DGs, which include DEs, WTs, PVs, and FCs. One microgrid test system has been considered in this article to validate the effectiveness of the load dispatch model. The test system is a six DG microgrid, which comprises three DEs, one FC, one solar PV system, and one WT [40]. The generator parameters of these six DGs are referred to from [40]. The hourly power output from solar PV and WT considered in the proposed microgrid are taken from [26]. These renewables DGs have zero-emission, together with low operation and maintenance costs.

EV Parameters
In this test system, EVs are also considered, which would act as both load and generation during V2G and G2V operations, respectively. A minimum of 25 EVs are considered in both microgrid systems, and they can go up to 100. In practice, all EVs are not connected to the grid concurrently. The number of vehicles connected to the grid is a randomly generated integer between 25 and 100 for this study. The maximum daily driving distance (R) of electric vehicles, when fully charged, is up to 300 km [7]. Other EV parameters are taken from references [26,32].
As discussed earlier, the number of EVs connected to the microgrid is not the same each day. The impact of the increasing number of EVs can be seen on the daily load curve. Figure 4 shows the impact of 25%, 50%, 75%, and 100% EVs on the daily load curve for a test system. The total number of EVs is considered as 100. It can be inferred that increasing the number of EVs increases the difference between peak-load and valley-load. The battery capacity of all the EVs is assumed to be the same, and 47 EVs are involved in this optimal load dispatch problem.

Scenarios and Cases
This test system is subjected to three different scenarios: Scenario 1 is the minimization of cost as in reference [26], Scenario 2 has been taken to see the effect of load variance on the optimal load dispatch referred from [40], and Scenario 3 has been proposed in this work to show the advantages and impact of EVs. Each scenario consists of six different cases, where Cases 1 and 3 are from reference [40]. Cases 2 and 4 have been modified by incorporating renewable energy sources. Cases 5 and 6 incorporate pricing frameworks in grid-connected microgrid. Advantages of dynamic pricing have been proposed in Case 6 over the fixed pricing scheme in Case 5.
In order to demonstrate the suggested modifications in EHO, the simulation results of the proposed IEHO and standard EHO are compared for all cases of the test system. Furthermore, to demonstrate the promising solution searching abilities of proposed IEHO over the existing meta-heuristic method, the proposed scheduling problem is also solved by using PSO and simulation results obtained by EHO, improved EHO, and PSO are compared for all cases of the test system. The scenarios and corresponding cases considered for both the test systems are presented here: The details of all six cases considered for each scenario are given below: • Case 1: The microgrid is operating in islanding mode and does not deliver power to the main grid; however, the renewable DGs have not been considered. The grid will supply power to the microgrid only if demand is more than the power generated by all the DGs, operating at full capacity. • Case 2: The microgrid is operating in islanding mode and does not deliver power to the grid; however, the renewable DGs have been considered. The grid will supply power to the microgrid only if demand is more than the power generated by all the DGs, operating at full capacity. • Case 3: The microgrid is operating in islanding mode and does not deliver power to the main grid. The grid is participating in the optimal load scheduling in this case. If the cost of trading power from the grid is cheaper than generating the cost of any DG, the former will be preferred. Renewable DGs have not been considered in this case. • Case 4: The microgrid is operating in islanding mode and does not deliver power to the main grid. The grid is participating in optimal load scheduling in this case. If the cost of trading power from the grid is cheaper than generating the cost of any DG, the former will be preferred. Renewable DGs have been considered in this case.

Scenarios and Cases
This test system is subjected to three different scenarios: Scenario 1 is the minimization of cost as in reference [26], Scenario 2 has been taken to see the effect of load variance on the optimal load dispatch referred from [40], and Scenario 3 has been proposed in this work to show the advantages and impact of EVs. Each scenario consists of six different cases, where Cases 1 and 3 are from reference [40]. Cases 2 and 4 have been modified by incorporating renewable energy sources. Cases 5 and 6 incorporate pricing frameworks in grid-connected microgrid. Advantages of dynamic pricing have been proposed in Case 6 over the fixed pricing scheme in Case 5.
In order to demonstrate the suggested modifications in EHO, the simulation results of the proposed IEHO and standard EHO are compared for all cases of the test system. Furthermore, to demonstrate the promising solution searching abilities of proposed IEHO over the existing meta-heuristic method, the proposed scheduling problem is also solved by using PSO and simulation results obtained by EHO, improved EHO, and PSO are compared for all cases of the test system. The scenarios and corresponding cases considered for both the test systems are presented here: The details of all six cases considered for each scenario are given below: • Case 1: The microgrid is operating in islanding mode and does not deliver power to the main grid; however, the renewable DGs have not been considered. The grid will supply power to the microgrid only if demand is more than the power generated by all the DGs, operating at full capacity. • Case 2: The microgrid is operating in islanding mode and does not deliver power to the grid; however, the renewable DGs have been considered. The grid will supply power to the microgrid only if demand is more than the power generated by all the DGs, operating at full capacity. • Case 3: The microgrid is operating in islanding mode and does not deliver power to the main grid. The grid is participating in the optimal load scheduling in this case. If the cost of trading power from the grid is cheaper than generating the cost of any DG, the former will be preferred. Renewable DGs have not been considered in this case. • Case 4: The microgrid is operating in islanding mode and does not deliver power to the main grid. The grid is participating in optimal load scheduling in this case. If the cost of trading power from the grid is cheaper than generating the cost of any DG, the former will be preferred. Renewable DGs have been considered in this case.
• Case 5: The microgrid is in grid-connected mode and exchanges power with the main grid in the presence of renewable DGs. This case considers the fixed pricing model. • Case 6: This case considers both-way trade of power between the microgrid and the main grid. The power is exchanged between the two considering dynamic pricing, thus giving maximum benefit to both the systems.
The value of C grid , as mentioned in Equation (15), is assumed to be 1.15 if the grid is purchasing power, and C grid = 1.0 if the grid is selling power for a test system. These assumed values of C grid are considered for all the cases except Case 6. In Case 6, dynamic pricing is applied. Figure 5 shows the hourly prices (C grid ) for purchasing power from the grid and selling power to the grid for a test system. The PSO parameters values are taken from reference [41]. EHO and IEHO parameters are the number of clans = 5, number of elephants = 8, and number of iterations = 100 according to reference [40]. The proposed microgrid model and optimization are implemented and simulated in a Matlab environment on an intel i7 processor with 16GB RAM. The value of Cgrid, as mentioned in Equation (15), is assumed to be 1.15 if the grid is purchasing power, and Cgrid = 1.0 if the grid is selling power for a test system. These assumed values of Cgrid are considered for all the cases except Case 6. In Case 6, dynamic pricing is applied. Figure 5 shows the hourly prices (Cgrid) for purchasing power from the grid and selling power to the grid for a test system. The PSO parameters values are taken from reference [41]. EHO and IEHO parameters are the number of clans = 5, number of elephants = 8, and number of iterations = 100 according to reference [40]. The proposed microgrid model and optimization are implemented and simulated in a Matlab environment on an intel i7 processor with 16GB RAM.

Result Analysis and Discussions
To obtain and analyze the simulation results of optimal scheduling of microgrids by using PSO, EHO, and proposed IEHO, three different scenarios with six different cases are solved in this section. The PSO, EHO, and proposed IEHO have been used for the optimal scheduling on the microgrid system, i.e., six DG microgrids. Later, both objective functions, i.e., minimization of total cost by taking "Load Variance" into consideration, are compared. At last, the impact of EVs on the load dispatch results is analyzed. Both objective functions are handled in a fuzzy environment.

Result Analysis for Scenario 1
In Scenario 1, the objective function is to minimize the total cost of the power generation, which includes fuel, operation, and maintenance costs as well as pollution treatment costs. Further, in this section, optimal load dispatch results obtained using PSO, EHO and proposed IEHO are shown for the six DG test systems.
Optimal load dispatch performed on this six DG test systems using proposed IEHO inferred that no power had been delivered to the grid (-ve values for the "grid" profile denotes power being delivered to the grid) in Cases 1 through 4 (because of islanding mode). In Case 1, FCs are contributing the maximum power among all the DGs as it is the cheapest. Furthermore, the grid only supplies power when DGs are not able to match the load demand, although operating at full capacity. In Case 2, the effect of renewable DGs can be seen by comparing the power output of dispatchable DGs with the previous case. The grid also participates in optimal scheduling and supplies power. Because of the constraints of conventional DGs, sometimes it is more economical to draw power from the grid. That is the reason the grid supplies power for a few instants in Case 3. In Case 4, the impact of renewables can be clearly seen as the dependency on convention DGs has

Result Analysis and Discussions
To obtain and analyze the simulation results of optimal scheduling of microgrids by using PSO, EHO, and proposed IEHO, three different scenarios with six different cases are solved in this section. The PSO, EHO, and proposed IEHO have been used for the optimal scheduling on the microgrid system, i.e., six DG microgrids. Later, both objective functions, i.e., minimization of total cost by taking "Load Variance" into consideration, are compared. At last, the impact of EVs on the load dispatch results is analyzed. Both objective functions are handled in a fuzzy environment.

Result Analysis for Scenario 1
In Scenario 1, the objective function is to minimize the total cost of the power generation, which includes fuel, operation, and maintenance costs as well as pollution treatment costs. Further, in this section, optimal load dispatch results obtained using PSO, EHO and proposed IEHO are shown for the six DG test systems.
Optimal load dispatch performed on this six DG test systems using proposed IEHO inferred that no power had been delivered to the grid (-ve values for the "grid" profile denotes power being delivered to the grid) in Cases 1 through 4 (because of islanding mode). In Case 1, FCs are contributing the maximum power among all the DGs as it is the cheapest. Furthermore, the grid only supplies power when DGs are not able to match the load demand, although operating at full capacity. In Case 2, the effect of renewable DGs can be seen by comparing the power output of dispatchable DGs with the previous case. The grid also participates in optimal scheduling and supplies power. Because of the constraints of conventional DGs, sometimes it is more economical to draw power from the grid. That is the reason the grid supplies power for a few instants in Case 3. In Case 4, the impact of renewables can be clearly seen as the dependency on convention DGs has been reduced, and that is why the cost of generation is comparatively much less. Again, Cases 2 and 4 are cheaper due to renewables. In this microgrid, FCs are the most economical among the dispatchable DGs as it is contributing the most power throughout the day. On the other hand, the power generating cost for DG3 is the highest. During the peak-load hours, the DGs are not able to match the load demand, which is the reason that the grid is supplying power during these hours. The daily cost of generation is more in Cases 3 and 4 because drawing power from the grid might be cheaper for a few hours, but overall, it is expensive. Meanwhile, when the microgrid is in grid-connected mode, i.e., in Cases 5 and 6, all the DGs are operating at full capacity and are delivering power to the grid. This is the reason that the cost of power generation significantly dropped in Case 5. In Case 6, again, dynamic pricing proved to be the most economical alternative for our problem. Figure 6 shows the cost comparison of different cases for this test system, obtained by PSO, EHO, and proposed IEHO. It can be observed from this figure that the total production costs for the given load profile for Cases 2 and 4 are cheaper than Cases 1 and 3, respectively, because of the inclusion of solar PV and WT. When the microgrid is in grid-connected mode, i.e., Cases 5 and 6, the cost of generation is more economical. Moreover, dynamic pricing applied in Case 6 is the cheapest among all test cases. Again, the proposed IEHO produces a minimum cost than that of PSO and EHO for all cases. been reduced, and that is why the cost of generation is comparatively much less. Again, Cases 2 and 4 are cheaper due to renewables. In this microgrid, FCs are the most economical among the dispatchable DGs as it is contributing the most power throughout the day. On the other hand, the power generating cost for DG3 is the highest. During the peak-load hours, the DGs are not able to match the load demand, which is the reason that the grid is supplying power during these hours. The daily cost of generation is more in Cases 3 and 4 because drawing power from the grid might be cheaper for a few hours, but overall, it is expensive. Meanwhile, when the microgrid is in grid-connected mode, i.e., in Cases 5 and 6, all the DGs are operating at full capacity and are delivering power to the grid. This is the reason that the cost of power generation significantly dropped in Case 5. In Case 6, again, dynamic pricing proved to be the most economical alternative for our problem. Figure 6 shows the cost comparison of different cases for this test system, obtained by PSO, EHO, and proposed IEHO. It can be observed from this figure that the total production costs for the given load profile for Cases 2 and 4 are cheaper than Cases 1 and 3, respectively, because of the inclusion of solar PV and WT. When the microgrid is in grid-connected mode, i.e., Cases 5 and 6, the cost of generation is more economical. Moreover, dynamic pricing applied in Case 6 is the cheapest among all test cases. Again, the proposed IEHO produces a minimum cost than that of PSO and EHO for all cases.

Result Analysis for Scenario 2
In Scenario 2, the objective is not only the minimization of the cost function but also the minimization of the load variance. It is important for the microgrid and the main grid to operate under stable conditions. This is the reason that the minimization of load variance is equally important for this scheduling problem. Therefore, this can be solved by minimizing Equation (20) in a fuzzy environment.
The cost remains almost the same as the grid and is not participating in optimal scheduling. This is because the effect of the load variance is negligible in Case 1. The cost of generation and grid-dependency reduces when renewable DGs are added to the microgrid in Case 2. The grid is participating in optimal scheduling and thus the effect of load variance can be seen on the cost of generation in Figure 7. To ensure the stability of the grid, load variance is an important concern for the power system, and it cannot be averted in Case 3. Again, in Case 4, incorporating renewable DGs reduced the overall cost of generation and reduced grid-dependency. In Cases 5 and 6, the grid profile is flat compared to the previous scenario. The flatter the curve, the load variance will be less. Therefore, the cost of generation increased in these two cases compared to the previous scenario.
The same trend for the production cost can be seen in Figure 7 in this scenario for the different cases obtained by PSO, EHO, and proposed IEHO. Since the grid does not participate in the optimal scheduling in Cases 1 and 2, the impact of load variance is negligible. Therefore, the cost of production remains almost the same. The effect of load variance can be seen in Cases 3 to 6; the peak-valley difference in the grid is less in this

Result Analysis for Scenario 2
In Scenario 2, the objective is not only the minimization of the cost function but also the minimization of the load variance. It is important for the microgrid and the main grid to operate under stable conditions. This is the reason that the minimization of load variance is equally important for this scheduling problem. Therefore, this can be solved by minimizing Equation (20) in a fuzzy environment.
The cost remains almost the same as the grid and is not participating in optimal scheduling. This is because the effect of the load variance is negligible in Case 1. The cost of generation and grid-dependency reduces when renewable DGs are added to the microgrid in Case 2. The grid is participating in optimal scheduling and thus the effect of load variance can be seen on the cost of generation in Figure 7. To ensure the stability of the grid, load variance is an important concern for the power system, and it cannot be averted in Case 3. Again, in Case 4, incorporating renewable DGs reduced the overall cost of generation and reduced grid-dependency. In Cases 5 and 6, the grid profile is flat compared to the previous scenario. The flatter the curve, the load variance will be less. Therefore, the cost of generation increased in these two cases compared to the previous scenario.
scenario, and thus the generation cost has increased slightly. Cases 2 and 4 are cheaper compared to Cases 1 and 3 because of renewables. A grid-connected microgrid is cheaper than an isolated microgrid, and furthermore, dynamic pricing is more feasible than fixed pricing. Again, FC is the cheapest convention DG, and DE3 is cheaper than the other two DEs. It can also be observed that the proposed IEHO obtained better results in all the cases than PSO and EHO.

Result Analysis for Scenario 3
There is no doubt that EV sales will be very important in the coming years, which will impose a huge challenge for the energy scenario of the nation. Therefore, in Scenario 3, a proper EV charging and discharging plan is implemented, which gives a 24-h EV charging/discharging load profile for this test system. The following results section shows the impact of the EV module on our problem and how it is going to affect the total cost of generation.
The load profiles of the DGs for all the six cases obtained by the proposed IEHO can be inferred that the power being discharged by EVs during peak-load hours does not only meet the load demands but also discharges the power to the grid. Despite delivering the surplus power to the grid for these cases, the EVs can stop discharging as well, but sometimes, in the real-world scenario, power demand increases suddenly, and one cannot risk fulfillment of this demand by the grid because this might make the power system unstable. Therefore, it is better to let EVs discharge power to the grid during peak-load hours. The transaction of power from the grid is almost negligible, which is the reason behind the huge price drop. The grid dependency is negligible, and as a result, load variance is minimum. The price drop in the generation is significant in Cases 2 and 4 because renewables and FC are the cheapest among conventional DGs.
Again, the grid is supplying power during off-peak hours and, it can be clearly seen that in Case 1, EVs have reduced dependency on the grid. In addition, power discharged from the EVs during peak hours is more than the peak demand, which reduces the burden on the DGs and helps in the reduction in cost. Case 2 incorporates renewable DGs and their economic benefits. The grid also participates in optimal scheduling in Case 3. The grid profile is not as flat as Case 1. This increases load variance and thus results in an increment of cost of generation. Case 4 incorporates renewables and their economic benefits. The drop in the cost of generation is significant when renewables are added into the scenario; furthermore, the drop in cost can be observed when the microgrid is in a grid-connected mode in Case 5, and the cost of generation is cheapest when dynamic pricing is incorporated in Case 6.
The cost comparison of different cases for Scenario 3 obtained by PSO, EHO, and proposed IEHO is shown in Figure 8. It can be inferred that the cost is reduced in Cases 2 and 4 because of the incorporation of renewable energy sources. In this test system, the grid profile remains very flat throughout the day because of consideration of EVs, and The same trend for the production cost can be seen in Figure 7 in this scenario for the different cases obtained by PSO, EHO, and proposed IEHO. Since the grid does not participate in the optimal scheduling in Cases 1 and 2, the impact of load variance is negligible. Therefore, the cost of production remains almost the same. The effect of load variance can be seen in Cases 3 to 6; the peak-valley difference in the grid is less in this scenario, and thus the generation cost has increased slightly. Cases 2 and 4 are cheaper compared to Cases 1 and 3 because of renewables. A grid-connected microgrid is cheaper than an isolated microgrid, and furthermore, dynamic pricing is more feasible than fixed pricing. Again, FC is the cheapest convention DG, and DE3 is cheaper than the other two DEs. It can also be observed that the proposed IEHO obtained better results in all the cases than PSO and EHO.

Result Analysis for Scenario 3
There is no doubt that EV sales will be very important in the coming years, which will impose a huge challenge for the energy scenario of the nation. Therefore, in Scenario 3, a proper EV charging and discharging plan is implemented, which gives a 24-h EV charging/discharging load profile for this test system. The following results section shows the impact of the EV module on our problem and how it is going to affect the total cost of generation.
The load profiles of the DGs for all the six cases obtained by the proposed IEHO can be inferred that the power being discharged by EVs during peak-load hours does not only meet the load demands but also discharges the power to the grid. Despite delivering the surplus power to the grid for these cases, the EVs can stop discharging as well, but sometimes, in the real-world scenario, power demand increases suddenly, and one cannot risk fulfillment of this demand by the grid because this might make the power system unstable. Therefore, it is better to let EVs discharge power to the grid during peak-load hours. The transaction of power from the grid is almost negligible, which is the reason behind the huge price drop. The grid dependency is negligible, and as a result, load variance is minimum. The price drop in the generation is significant in Cases 2 and 4 because renewables and FC are the cheapest among conventional DGs.
Again, the grid is supplying power during off-peak hours and, it can be clearly seen that in Case 1, EVs have reduced dependency on the grid. In addition, power discharged from the EVs during peak hours is more than the peak demand, which reduces the burden on the DGs and helps in the reduction in cost. Case 2 incorporates renewable DGs and their economic benefits. The grid also participates in optimal scheduling in Case 3. The grid profile is not as flat as Case 1. This increases load variance and thus results in an increment of cost of generation. Case 4 incorporates renewables and their economic benefits. The drop in the cost of generation is significant when renewables are added into the scenario; furthermore, the drop in cost can be observed when the microgrid is in a grid-connected mode in Case 5, and the cost of generation is cheapest when dynamic pricing is incorporated in Case 6.
The cost comparison of different cases for Scenario 3 obtained by PSO, EHO, and proposed IEHO is shown in Figure 8. It can be inferred that the cost is reduced in Cases 2 and 4 because of the incorporation of renewable energy sources. In this test system, the grid profile remains very flat throughout the day because of consideration of EVs, and this significantly brings down the cost, and the load variance is low, as well. Therefore, the cost of generation is reduced significantly. When the microgrid is in grid-connected mode, the reduction in the cost of generation is huge, and when dynamic pricing is incorporated in the scenario, prices drop even more. It can also be determined that again the proposed IEHO outperforms the PSO and EHO methods. This shows that the proposed IEHO generates a minimum cost for all the cases in different scenarios of varieties of test systems. this significantly brings down the cost, and the load variance is low, as well. Therefore, the cost of generation is reduced significantly. When the microgrid is in grid-connected mode, the reduction in the cost of generation is huge, and when dynamic pricing is incorporated in the scenario, prices drop even more. It can also be determined that again the proposed IEHO outperforms the PSO and EHO methods. This shows that the proposed IEHO generates a minimum cost for all the cases in different scenarios of varieties of test systems.  Figure 9 shows the cost comparison of the three scenarios obtained by the proposed IEHO with respect to all the different cases of the six DG test systems. The cost of generation in Scenario 2 increases in every case because of the load variance. This is necessary because grid stability is important for the proper functioning of the power system. To compensate for this increased cost, EVs are incorporated in Scenario 3.

Comparison of Scenarios
When EVs are connected to the microgrid, the cost of generation drops significantly, and it becomes cheaper than Scenario 1 and Scenario 2. The results verify the economic advantages of connecting EV to the microgrid. Apart from the cost-reduction in the generation process, EVs help in reducing the peak-valley difference of the daily-load profile. The results prove that connecting EVs to the microgrid can be beneficial for the energy scenario of a nation.   Figure 9 shows the cost comparison of the three scenarios obtained by the proposed IEHO with respect to all the different cases of the six DG test systems. The cost of generation in Scenario 2 increases in every case because of the load variance. This is necessary because grid stability is important for the proper functioning of the power system. To compensate for this increased cost, EVs are incorporated in Scenario 3. this significantly brings down the cost, and the load variance is low, as well. Therefore, the cost of generation is reduced significantly. When the microgrid is in grid-connected mode, the reduction in the cost of generation is huge, and when dynamic pricing is incorporated in the scenario, prices drop even more. It can also be determined that again the proposed IEHO outperforms the PSO and EHO methods. This shows that the proposed IEHO generates a minimum cost for all the cases in different scenarios of varieties of test systems.  Figure 9 shows the cost comparison of the three scenarios obtained by the proposed IEHO with respect to all the different cases of the six DG test systems. The cost of generation in Scenario 2 increases in every case because of the load variance. This is necessary because grid stability is important for the proper functioning of the power system. To compensate for this increased cost, EVs are incorporated in Scenario 3.

Comparison of Scenarios
When EVs are connected to the microgrid, the cost of generation drops significantly, and it becomes cheaper than Scenario 1 and Scenario 2. The results verify the economic advantages of connecting EV to the microgrid. Apart from the cost-reduction in the generation process, EVs help in reducing the peak-valley difference of the daily-load profile. The results prove that connecting EVs to the microgrid can be beneficial for the energy scenario of a nation.  When EVs are connected to the microgrid, the cost of generation drops significantly, and it becomes cheaper than Scenario 1 and Scenario 2. The results verify the economic advantages of connecting EV to the microgrid. Apart from the cost-reduction in the generation process, EVs help in reducing the peak-valley difference of the daily-load profile. The results prove that connecting EVs to the microgrid can be beneficial for the energy scenario of a nation.

Conclusions
In this paper, both conventional and renewable DGs are considered for optimal load dispatch of microgrids in a deterministic environment. Due to the low cost of production and zero emissions, renewable sources such as PV and WT always generate power at full capacity. Among the other conventional DGs, FCs are the cheapest. As it can be verified from the results that FCs are delivering power throughout the day. The objective is to achieve the lowest cost of generation after fulfilling all the constraints, and the results obtained from the simulation verifies that if free trade of power is allowed between the microgrids and the main grid, the process of power generation can be more economical, and further introduction of dynamic pricing into the scenario proves to be even cheaper. The impact of EV in the scenario is significant as G2V operations during off-peak hours and V2G operations during peak-load hours support the microgrid to operate in the islanding mode. In addition, the power production cost of the microgrid is cheapest for all the cases in this scenario, i.e., V2G and G2V. The implementation of these EV operations in this scenario not only helped in cost minimization but also helped in stabilizing the grid. The days are not far when EVs will be running on the road, thus warranting the implementation of papers of this sort, where EVs can be used to improve the energy scenario of a nation and reduce grid dependency.
The above-mentioned proposed microgrid problem is a very complex combinatorial optimization problem. For solving this problem, elephant herding optimization (EHO) was modified and implemented. To test the performance of the proposed IEHO method, it was applied to the latest CEC test functions. The results obtained by the proposed IEHO after 100 different trials in terms of mean and standard deviations are compared with recently published methods and found to obtain much better results.
Next, this proposed IEHO method was tested on the proposed microgrid problem along with other swarm-based optimization algorithms, such as PSO and EHO. It can be concluded that the proposed IEHO outperforms PSO and EHO, providing the best results with the minimized cost of optimal scheduling because of its extensive and improved exploration and exploitation properties with fewer "particles" required and, as mentioned, faster convergence. In future work, this method can be implemented to solve real-time optimal scheduling problems of microgrid with V2G and G2V penetration.   Emission coefficient of the hth pollutant of the ith diesel generator P load,t Total load ignoring the charging load in period t (kW) α, β, λ Coefficients of the diesel engine C MT Fuel cost of micro turbine P R Rated output power of the micro turbine P MT Actual power output of the micro turbine C GAS Cost of natural gas L HV Lower heating value of the fuel η MT Efficiency of micro turbine in period t x, y, z, c Coefficients of microturbine T STC Temperature of the PV cells at standard test condition P WT Actual output power of the wind turbine V Velocity of the wind flowing P r Rated power of the wind turbine a, b Parameters of wind turbine t charge,m Time required for charging the battery P i,t Output power of the ith generator at tth hour C grid Cost of trading the power between grid and microgrid C 2 Pollutant treatment cost of microgrid c j Fuel cost coefficient for ith generator γ i,j and γ grid,j Power generated by ith generator at tth hour P i Output power of the ith DG V co Cut-out wind speed m Electric vehicle L Total number of random simulations