Distributed Generation Management in Smart Grid with the Participation of Electric Vehicles with Respect to the Vehicle Owners’ Opinion by Using the Imperialist Competitive Algorithm

: In this paper, a modiﬁed version of Imperialist Competitive Algorithm (ICA) is proposed for the optimal energy management of a Microgrid (MG) with Parking Lots (PL) and Distributed Generation (DG) units. A 24-h scheduling for participation in DG units and electric vehicles PLs in two scenarios is done. The PLs are divided into seven group that each group has different trip behavior. Therefore, energy management should be done in such a way as to minimize operating costs according to the charging status of electric vehicles as well as the production capacity of distributed generation sources. Finally, the results of the two scenarios are reviewed separately and compared. The simulation results proved the effectiveness of the proposed method. The MG operation cost is decreased about 63%. Also, the optimization results. The optimization results by the proposed ICA algorithm are compared with the results of genetic algorithm (GA) and particle swarming optimization (PSO) algorithms. The optimization results conﬁrm better performance of the proposed algorithm compared to GA and PSO algorithms.


Introduction
The presence of distributed generation (DG) resources in a distribution network needs 24-h scheduling. The scheduling of the DGs in the microgrid has several benefits such as loss reduction, improve power quality and reliability and also reduce operation cost [1]. On the one hand, the transportation sector is the main consumer sector of petroleum products and, therefore, will be one of the most important environmental contamination factors. So that according to the energy and environmental crisis in the future, especially in industrialized countries, the issue of replacing existing vehicles with electric vehicles has been considered seriously [2,3].
An EV can be operated as a controllable load. When a vehicle is not used for moving, it can be connected to the grid at peak time in order to feed the grid and increase the reliability of the smart grid [4,5]. In this way, the vehicle owners can earn profit by selling extra electricity to the network by using the Vehicle 2 Grid (V2G) technology. In addition, the ability to inject electric power into the grid can provide some valuable services, such as spinning reserve, power supply at peak load and frequency setting [6]. On the other hand, the huge number of vehicles in the grid due to demand for power can challenge grid control and exploitation [7,8]. Following this challenge, a promising horizon in the name of the smart grid is presented to address these concerns in the energy distribution network [9]. In [10], a new demand response-based model is proposed for a microgrid energy management. The microgrid consist of renewable energy sources and EV parking lots. In the proposed model, EV owners can participate in the demand response program by changing their driving schedule. The simulation results prove the good performance of the proposed method in reducing the operating costs in the microgrid. In [11], a control method has been introduced based on minimizing energy generation and energy losses. Planning of units in the distribution network in the presence of EVs can be connected to the grid in a variety of ways. In [12], the authors have introduced a collaborative model of units in the presence of networkable electric vehicles by using a particle swarm optimization (PSO) algorithm to reduce the operation cost and the environmental emission in a MG. Also, in [13], scheduling DGs and scheduling charging and discharging EVs in a smart grid using the GAMS software was designed to reduce the cost of operating and emission rates. In [14] an energy management system (EMS) is proposed for residential microgrid (MG) with home parking lot based on the mixed integer linear program (MILP) method and for balancing power transactions in MG. The radial basis neural network (NN) method has been used to predict electrical demand. In this article, it is claimed that using car batteries parked in residential houses with proper management is an economical way to reduce operating costs. In [15], a model for maximizing the revenue from charging and discharging electric vehicles in the microgrid is proposed. The proposed model has de-peaked with the help of demand response program (DRP). The proposed method is implemented on the 14-bus IEEE system and the MILP optimization model is analyzed with CPLEX software. In [16], an online EMS is proposed for the optimal use of EVs in the parking lot in real time, and a balance between the demand and the state of charge (SOC) of the EV battery is obtained. The results of this paper show the efficiency of this method in supplying the loads with low operating costs.
Ignoring part of the operation cost of parking lots in the objective function to reduce optimization time by the algorithms and on the other hand being trapped in local optimal and low optimization convergence is the main drawbacks of the reviewed articles [17]. To increase the accuracy of the simulation results, a comprehensive objective function as well as the precise meta-heuristic algorithm should be used. The proposed algorithm should not be trapped in local optimum. This paper specifically addresses the planning of the participation of distributed generation units and the scheduling of charging and discharging EV batteries during the 24 h for a day considering the vehicles daily schedule, which is received from the customer, to minimize the cost of the operation in consideration of the owners' opinion. This issue is presented as an optimization problem with some constraints. In a smart grid environment, it is expected that the management of energy resources will be solved at a logical time, in spite of the operating constraints. Also, a modified version of the imperial competition algorithm is proposed to solve the optimization problem. High accuracy and not trapping in local optimal points are the prominent features of the proposed algorithm.

Smart Grid
In the proposed model, the distribution grid operator is responsible for planning the units in the distribution grid. The interaction between the distribution grid with its upstream and downstream portions is shown in Figure 1 [18].  The deployment of a smart grid requires the provision of the necessary infrastructure for the exchange of up-to-date information on the grid. The structure of the smart measurement system is considered to be a real project for the distribution grid arrangement, which can be seen in Figure 2 [19].
An identification chip (IC) is installed on each vehicle, which sends charging and discharging information for measurement by the meters, when the vehicle is connected to the grid. As depicted in the Figure 2, smart meter (SM) and power line carrier communication (PLCC) are installed at the consumer's premises. This equipment can be singlephase or three-phase. Also, medium and large consumer measurements can transmit information through general packet radio system (GPRS). In addition, the electrical parameters of each feeder in the secondary post-distribution substation (63 kV/20 kV) are measured as distribution post (20 kV/0.4 kV) by the meters. By doing this, average pressure loss and low pressure can be calculated. Data concentrators (DCs) are installed at the place of distribution post transformers to manage all the data of the measured values in those sections. DCs send and information for meter data management and repository (MDM/R) for processing and preparation.  Electric vehicles must be integrated with other energy resources in the power grid and there should be a unit for integrating and coordinating vehicles and other sources of energy. This unit is called distribution management system (DMS). Electric vehicle management system (EVMS) is a subdivision of the DMS, which is responsible for managing the charging and discharging of vehicles in the smart grid. This unit receives vehicle information through MDM/R or customer information system (CIS). Magazine information to the graphical information system (GIS) is also transmitted via the CIS to the EVMS. In The deployment of a smart grid requires the provision of the necessary infrastructure for the exchange of up-to-date information on the grid. The structure of the smart measurement system is considered to be a real project for the distribution grid arrangement, which can be seen in Figure 2 [19].
Distribution system operator (DSO)

Consumers
DGs EV owners Offered Schaduled The deployment of a smart grid requires the provision of the necessary infrastructure for the exchange of up-to-date information on the grid. The structure of the smart measurement system is considered to be a real project for the distribution grid arrangement, which can be seen in Figure 2 [19].
An identification chip (IC) is installed on each vehicle, which sends charging and discharging information for measurement by the meters, when the vehicle is connected to the grid. As depicted in the Figure 2, smart meter (SM) and power line carrier communication (PLCC) are installed at the consumer's premises. This equipment can be singlephase or three-phase. Also, medium and large consumer measurements can transmit information through general packet radio system (GPRS). In addition, the electrical parameters of each feeder in the secondary post-distribution substation (63 kV/20 kV) are measured as distribution post (20 kV/0.4 kV) by the meters. By doing this, average pressure loss and low pressure can be calculated. Data concentrators (DCs) are installed at the place of distribution post transformers to manage all the data of the measured values in those sections. DCs send and information for meter data management and repository (MDM/R) for processing and preparation. Electric vehicles must be integrated with other energy resources in the power grid and there should be a unit for integrating and coordinating vehicles and other sources of energy. This unit is called distribution management system (DMS). Electric vehicle management system (EVMS) is a subdivision of the DMS, which is responsible for managing the charging and discharging of vehicles in the smart grid. This unit receives vehicle information through MDM/R or customer information system (CIS). Magazine information to the graphical information system (GIS) is also transmitted via the CIS to the EVMS. In An identification chip (IC) is installed on each vehicle, which sends charging and discharging information for measurement by the meters, when the vehicle is connected to the grid. As depicted in the Figure 2, smart meter (SM) and power line carrier communication (PLCC) are installed at the consumer's premises. This equipment can be single-phase or three-phase. Also, medium and large consumer measurements can transmit information through general packet radio system (GPRS). In addition, the electrical parameters of each feeder in the secondary post-distribution substation (63 kV/20 kV) are measured as distribution post (20 kV/0.4 kV) by the meters. By doing this, average pressure loss and low pressure can be calculated. Data concentrators (DCs) are installed at the place of distribution post transformers to manage all the data of the measured values in those sections. DCs send and information for meter data management and repository (MDM/R) for processing and preparation.
Electric vehicles must be integrated with other energy resources in the power grid and there should be a unit for integrating and coordinating vehicles and other sources of energy. This unit is called distribution management system (DMS). Electric vehicle management system (EVMS) is a subdivision of the DMS, which is responsible for managing the charging and discharging of vehicles in the smart grid. This unit receives vehicle information through MDM/R or customer information system (CIS). Magazine information to the graphical information system (GIS) is also transmitted via the CIS to the EVMS. In fact, the EVMS is responsible for keeping a database of vehicle information about their behavior and pattern before they can be charged or discharged. A vehicle owner can choose whether or not to participate in the charge and discharge plan. This agreement can be made through an internet portal. These connections are illustrated in Figure 3. fact, the EVMS is responsible for keeping a database of vehicle information about their behavior and pattern before they can be charged or discharged. A vehicle owner can choose whether or not to participate in the charge and discharge plan. This agreement can be made through an internet portal. These connections are illustrated in Figure 3.

The Objective Function of the Problem
The formulas of the problem of planning power units and charging and discharging electric vehicles in the power grid are applicable for various purposes. Two objective functions are considered in this paper.

Cost Function without Vehicle Owners' Opinion
The first objective function is the cost of the operator's view, which is written as follows.
In this formula  is electricity price in the market. Also, T OL C is transformer overload cost which is zero when the transformer is not overloaded. The DGs generation cost is derived from the following equation [20].
where i a and, i b and, i c respectively are cost coefficients and ( , )

Cost Function with Vehicle Owners' Opinion
Also, the goal function is related to cost from the viewpoint of vehicle owners, which is written as follows:

The Objective Function of the Problem
The formulas of the problem of planning power units and charging and discharging electric vehicles in the power grid are applicable for various purposes. Two objective functions are considered in this paper.

Cost Function without Vehicle Owners' Opinion
The first objective function is the cost of the operator's view, which is written as follows.
In this formula P grid (t) and P Loss (t) the power exchange with upstream network grid and power loss at time t, P Dch EV (v, t) is the electric power injected by the discharge of the electric vehicle and C Dch (v, t) is the price of electricity purchased by the vehicle's owners, C DG (i, t) is the cost of producing each unit of diesel or fuel cell and SU(i, t) is their starting and shutdown cost, Ω t is electricity price in the market. Also, C T OL is transformer overload cost which is zero when the transformer is not overloaded. The DGs generation cost is derived from the following equation [20].
where a i and, b i and, c i respectively are cost coefficients and P DG (i, t) is the ith DG cost at time t.

Cost Function with Vehicle Owners' Opinion
Also, the goal function is related to cost from the viewpoint of vehicle owners, which is written as follows: In this objective function, the vehicle owners' profit resulted from the sale of electricity to the operator is as follows.

Problem Constraints
Grid and DGs constraints and also constraints related to electric vehicles should be observed at any time of the day [13]. The main constraint for the grid is load balance constraint. It can be formulated as Equation (4). In which the total generation of the grid should be equal to the amount of consumption plus the losses in the grid.
where, P j EV_ch (t) and P j EV_Dch (t) are the power charge and discharge of the jth EV, respectively; D t is the load demand, and Loss(t) is the total power losses of power system during period t. Also, the voltage of all buses should not exceed the lower and upper limitations.
In Equation (6), v max In Equation (7), I max ij is the maximum line flow capacity between buses i and j. DGs generation capacity is the main constraint for these units. DGs have a capacity in rang of the minimum and maximum generation.
where P min i and P max i are the bounds of the minimum and maximum output power ith of DG. If the minimum amount is lowered, that unit will be turned off and will need to pay again to set up [13].
In Equation (9), U i DG (t) is a binary value which is shown the ith DG is on or off. If P i DG (t) is lower than P i DG_Min will be turn off. Electric vehicle (EV) charging and discharging constraints are as follows: where, X(v, t) and Y(v, t) are either zero or one at a time, respectively, to determine the discharge status and the charge of the batteries. This stipulates that every vehicle is charged or charged every time, either discharged or not charged or discharged [13].
where E s (v, t) is the level of battery charge at the time t and E trip v,t is the amount of electric energy demand for having trip at time t. Also, P Dch EV (v, t) and P Ch EV (v, t) are the amount of EVs charging and discharging rate respectively.
Which states the charge and discharge rate of batteries per hour should not be higher than the virtual one.
Which states the remaining battery charge per hour should be within a permissible range [21].
States that maximum amount of available charge per hour, each battery can give power to the grid.
States that maximum amount of available capacity per hour, each battery can take power to the grid.
States that each vehicle can use (move) eventually amount of available capacity on its battery [13].

Modified Imperialist Competitive Algorithm
Imperial competition algorithm (ICA) was proposed by Caro Lucas and Esmael Atashpaz in 2008. This algorithm, similar to other algorithms, begins with a primitive population composed of a number of countries. To create empires, a number of the best countries are selected based on their deserving colonial qualities, and the rest of the countries are considered as their colony [22]. In an optimization problem with N variable, each country is constructed with an array 1 × N that is displayed as follows.
where p 1 , p 2 and p N are the variables of the problem. The value of the objective function is ith for the country is as follows.
To start the optimization process, the N country is created as a primary population. Then N imp from these countries are selected as colonizers based on their worth. N col remaining countries are considered as a colony. Then, to create empires, the colonial colonies are divided by the power of each colonist. To divide them among colonists, first of all, the degree of plurality of colonizers must be normalized, which is done in the following way.
That c n is the value of the objective function for the colonizer and C n is its normalized value. Therefore, any colonialist whose value has a more objective function would have a lower normalized value. With the normalized value of the objective function for each colonizer, the power of each colonizer is calculated by the following equation . And finally, the colonial colony's initial number is obtained from the following equation.
Which NC n is the n number colony of first colonists. For the division of colonies between empires, NC n are randomly selected from colonies and belong to the respective empire. Each empire that has more power will have a greater chance of absorbing the colony. The colonial countries are trying to advance their colonies. This fact is modeled by moving all the colonies towards their colonialist. This movement is modeled by two formulas, x and θ two random variables are distributed uniformly.
In these formulas, x is the vector of the size and θ is the degree of deviation from the direction of movement towards the colonialist. Also, β is a number greater than 1, d is the distance between the colony and colonialist, Y is a parameter that determines the degree of diversion. As each colony moves toward the colonizer, that colony may acquire a lower cost function than its colonialist. Therefore, the role of the two will change together and the algorithm continues with the new colonizer. All other empires, on the strength of their power, are given the chance to seize the colony. So that, the power of each empire must be defined. First, the value of the cost function of each empire is calculated with the formula below [22].
In which, T.C. n , the total function of n empire cost, is a positive number less than 1. can determine the extent to which the colonies of each empire have the same value per ξ capita cost per empire than colonialism. Obviously, the values close to one, the effect of the colonies on the value of the function of the cost of the empire and the values close to zero will increase the colonial influence. After calculating the value of the cost function for each empire, these values are normalized to find the power of each empire as follows.
Which T.C. n and N.T.C. n are the value of the cost function and its normalized value for the nth of empire, respectively. With the normalization of the cost function of each empire, the probability of taking over, which represents the power of each empire, is obtained by Equation (28).
Thus, the following vector is defined that there is the possibility of seizing the colony for all the empire. P = p p 1 , p p 2 , . . . , p p n imp (29) We then construct the vector-sized vector with the P vector called R whose arrays are random numbers with a uniform distribution between zero and one. Then the vector of subtraction of these two vectors is calculated as follows.
Therefore, for each empire there is a vector in which each empire that has a larger value in this vector belongs to that colony. In the process of losing the colonies of weak empires, after all, all the empires will collapse except the empire that is strongest and all countries, as colonies, are under colonial control of this empire, and the absorption process is pursued with an existing empire so that the algorithm approaches the ideal conditions. In the proposed modified version of the ICA algorithm, it is supposed that in the weaker colonies, groups are formed and they try to improve the situation by making internal reforms. Internal reforms in colonies are variable in the form of random changes in the range of 10% of the upper and lower bands, which is expressed as Equation (32).
where UB and LB are upper and lower bounds respectively. The algorithm flowchart is shown in Figure 4.

Case Study
The proposed approach to the modified version of the 33-buses radial distribution system has been implemented with a number of assumptions that changing these defaults could change the whole problem. For example, scheduling is based on a vehicle scheduling program that is fixed and announced in advance by the vehicle owners. In this plan- Step 1: Define input data. These data include: cost of EVs and DGs operation, and also energy price, fuel cell parameters, diesel parameters and load level.
Step 2: Generate initial random population and calculate the objective functions (cost) for each country.
Step 3: Select the best particle from best solutions as the Imperial.
Step 4: Move the colonies to the imperialist country Step 5: If there is a colony in the empire that costs less than the imperialist, replace the colonial and the imperialist together.
Step 6: Update the best position for each particle. To update the best position, the new particle position is compared with its previous position.
Step 7: Calculate the total cost of an empire (cost).
Step 8: Choose a colony from the weakest empire and give it to the empire most likely to be conquered.
Step 9: Internal reforms is performed for weak colonies.
Step 10: If the maximum number of iterations is reached, the optimization process stops, else returns to step 4.
Step 11: Remove the weak empires.
Step 12: If there is only one empire left, stop and go step 4.
Step 13: Provide final results of the Algorithm.

Case Study
The proposed approach to the modified version of the 33-buses radial distribution system has been implemented with a number of assumptions that changing these defaults could change the whole problem. For example, scheduling is based on a vehicle scheduling program that is fixed and announced in advance by the vehicle owners. In this planning, the length of time at home and at work and the duration of the journey for each vehicle are clear, and it is assumed that vehicles can only be recharged at home or at work. Also, for a vehicle battery, a maximum value and a first charge amount are considered. In this research, minimizing the cost from two perspectives has been investigated.

Assumptions and Problem Data
The predicted load profile of the test system for 24 h is shown in Figure 5.

Assumptions and Problem Data
The predicted load profile of the test system for 24 h is shown in Figure 5. The price of electricity in the free market is depicted in Table 1 [13]. It is also assumed that the electricity supplier purchases electricity at a constant price of 0.03 per 24 h from subscribers. Also, two fuel cells and two diesel generators are installed in the buss (8,19) and (27 and 13) respectively. The diesel generator and fuel cell are assumed to have a single power factor. Fuel price and fuel cell pollution rate and diesel generator are shown in Table 2 [13].  The price of electricity in the free market is depicted in Table 1 [13]. It is also assumed that the electricity supplier purchases electricity at a constant price of 0.03 per 24 h from subscribers. Also, two fuel cells and two diesel generators are installed in the buss (8,19) and (27 and 13) respectively. The diesel generator and fuel cell are assumed to have a single power factor. Fuel price and fuel cell pollution rate and diesel generator are shown in Table 2 [13]. The electricity generated in the main network is supplied by fossil fuel-based power plants. The main network infiltration rate is 24 h (due to the switching and power offs of the above power plants) and is as shown in the Table 3 given below. A radial test system for a village is assumed to include industrial and commercial areas. The pattern is considered in accordance with reference [13]. This information includes the duration of travel for each type of vehicle, the start time and the end of travel, the average distance traveled.

The Behavioral Pattern of Vehicles Owners
The behavior of vehicles owners is grouped as follows: -Vehicle's owners where their place of residence and work is in the village (types 1 and 2) -Vehicle's owners where their place of residence is in the village and at work outside the village (types 3 and 4) -Vehicle's owners where live in the village and use electric vehicles only to go shopping and party (type 5) -Planning to travel outside the city within certain timeframes (type 6) -They live out of town and they work in the city (Type 7).
Types 2 and 4 vehicles refer to vehicles that use their vehicles at dusk and at night for other jobs. In this research, two charging locations for vehicles are considered: (1) Charging at home (2) Charging at work. Pattern data for vehicles is shown in Tables 3 and 4. The vehicle number and hours of start and end of their connection to the network are shown in Table 3 [13]. It's assumed that the vehicles are moving at a constant rate and 3 kwh per hour consumes energy on average. The average travel period for each type of vehicle and the type of travel is given in Table 4 [13]. It should be noted that each type of vehicle stores enough energy in its battery to store the desired distance at an hour later. The data presented in Tables 3 and 4 are standard data of test system parking lots. In order to evaluate the optimization results, in addition to the proposed modified ICA algorithm, genetic algorithm (GA) and particle swarm optimization (PSO) algorithm are used for optimization and the results were compared with each other. The algorithms parameters are given in Table 5.

Vehicle Types in Terms of Battery Capacity
In this research, four different types of vehicles are considered, with a capacity of 10, 16, 24 and 40. Each vehicle owner chooses a particular type of vehicle according to their drive pattern. In addition, the initial charge rates for each battery are selected according to the running hours of each type, as shown in Table 6 [13]. Table 6. The amount of battery capacity of each vehicle type.

Vehicle Type Battery Capacity (KWh) Initial Battery Charge
Type of 1-3-6 10 4 Type of 5 16 8 Type of 2-4 24 12 Type of 7 40 25 Simulations are based on the fact that vehicles are only capable of charging at the home and workplace, and charging is not done outside of these two places and at parking lots. Battery chargers and converters have some losses, and thus, the amount of power received from the network is greater than the battery power. The battery charging and discharging efficiency is 90% and 95% respectively. In order to increase the battery life of electric vehicles, the maximum capacity can be up to 85% of the nominal capacity of the batteries. According to the standard equipment for charging and discharging vehicles, the charging and discharging rate of vehicles per hour is not more than 4 kilowatts per hour.

Types of Studied Scenarios
To analyze the effects of EV planning on cost reduction, the model proposed in this paper has been tested in two scenarios.

Scenario 1: Minimizing the Cost of Exploitation without Consideration of the Vehicle Owners' Opinion
In this scenario, the cost of operation is considered as the objective function. The convergence diagram of the GA, PSO and the proposed ICA algorithms are shown in Figure 6. electric vehicles, the maximum capacity can be up to 85% of the nominal capacity of the batteries. According to the standard equipment for charging and discharging vehicles, the charging and discharging rate of vehicles per hour is not more than 4 kilowatts per hour.

Types of Studied Scenarios
To analyze the effects of EV planning on cost reduction, the model proposed in this paper has been tested in two scenarios.

Scenario 1: Minimizing the Cost of Exploitation without Consideration of the Vehicle Owners' Opinion
In this scenario, the cost of operation is considered as the objective function. The convergence diagram of the GA, PSO and the proposed ICA algorithms are shown in Figure  6. The black solid line, blue dash-line and red dot-line are convergence curves of the ICA, PSO and GA algorithms respectively. As shown in Figure 6, the proposed ICA algorithm converges to a lower final value of than the other two algorithms. The ICA algorithm converged to 14,145$ and the PSO and GA algorithms converged to 14,562$ and 14,923$ respectively. The optimization running time is calculated as 121 S for the GA, 136 S for the PSO 136 S and 116 S for the proposed ICA algorithm.
The planned active powers for the main grid, fuel cell, and diesel generator as well as vehicle charging and discharging programs for 24 h for the proposed ICA algorithm in the first scenario are shown in Figure 7. The black solid line, blue dash-line and red dot-line are convergence curves of the ICA, PSO and GA algorithms respectively. As shown in Figure 6, the proposed ICA algorithm converges to a lower final value of than the other two algorithms. The ICA algorithm converged to 14,145 $ and the PSO and GA algorithms converged to 14,562 $ and 14,923 $ respectively. The optimization running time is calculated as 121 S for the GA, 136 S for the PSO 136 S and 116 S for the proposed ICA algorithm.
The planned active powers for the main grid, fuel cell, and diesel generator as well as vehicle charging and discharging programs for 24 h for the proposed ICA algorithm in the first scenario are shown in Figure 7. The black solid line, blue dash-line and red dot-line are convergence curves of the ICA, PSO and GA algorithms respectively. As shown in Figure 6, the proposed ICA algorithm converges to a lower final value of than the other two algorithms. The ICA algorithm converged to 14,145$ and the PSO and GA algorithms converged to 14,562$ and 14,923$ respectively. The optimization running time is calculated as 121 S for the GA, 136 S for the PSO 136 S and 116 S for the proposed ICA algorithm.
The planned active powers for the main grid, fuel cell, and diesel generator as well as vehicle charging and discharging programs for 24 h for the proposed ICA algorithm in the first scenario are shown in Figure 7. According to these figures shown, the results suggest that vehicles are charged at low-power watches that are reasonable, and in high-power watches, which are discharged with regard to their battery capacity and motion, because of the price of the purchased electricity. It is fixed by the owner of the vehicle owners and is equal to 0.03, so it is logical to buy them in these hours of electricity, rather than be taken from the grid. It is also observed that diesel generator generates more hours than the fuel cell in the circuit, according to the generation cost function itself, because the generation cost of the generator is lower due to the cost function of the generator. Distribution system voltage profile is shown in Figure 8. As shown in this figure, the voltage amplitude of all buses in the 24 h is within the permitted range. According to these figures shown, the results suggest that vehicles are charged at low-power watches that are reasonable, and in high-power watches, which are discharged with regard to their battery capacity and motion, because of the price of the purchased electricity. It is fixed by the owner of the vehicle owners and is equal to 0.03, so it is logical to buy them in these hours of electricity, rather than be taken from the grid. It is also observed that diesel generator generates more hours than the fuel cell in the circuit, according to the generation cost function itself, because the generation cost of the generator is lower due to the cost function of the generator. Distribution system voltage profile is shown in Figure 8. As shown in this figure, the voltage amplitude of all buses in the 24 h is within the permitted range. discharging of vehicles in scenario 1.
According to these figures shown, the results suggest that vehicles are charged at low-power watches that are reasonable, and in high-power watches, which are discharged with regard to their battery capacity and motion, because of the price of the purchased electricity. It is fixed by the owner of the vehicle owners and is equal to 0.03, so it is logical to buy them in these hours of electricity, rather than be taken from the grid. It is also observed that diesel generator generates more hours than the fuel cell in the circuit, according to the generation cost function itself, because the generation cost of the generator is lower due to the cost function of the generator. Distribution system voltage profile is shown in Figure 8. As shown in this figure, the voltage amplitude of all buses in the 24 h is within the permitted range.

Scenario 2: Minimizing the Cost of Operation Considering the Vehicle Owners' Opinion
In this scenario, the cost of operation with considering to maximizing profits for vehicle owners is considered. As it is clear from the formula of the objective function, the system operator should optimize the cost of network generation and distributed generation sources and discharging the vehicles in an optimum manner. So that, in addition to lowering the cost of exploitation, maximum profits will be generated for vehicle owners. The optimization algorithm results for the second scenario are shown in Figure 9.

Scenario 2: Minimizing the Cost of Operation Considering the Vehicle Owners' Opinion
In this scenario, the cost of operation with considering to maximizing profits for vehicle owners is considered. As it is clear from the formula of the objective function, the system operator should optimize the cost of network generation and distributed generation sources and discharging the vehicles in an optimum manner. So that, in addition to lowering the cost of exploitation, maximum profits will be generated for vehicle owners. The optimization algorithm results for the second scenario are shown in Figure 9. Similar to the first scenario, the proposed ICA algorithm performed better PSO and GA algorithms and converged to a lower final value. The final values for PSO and ICA are 14,873$, 14,432$ and 14,015$ respectively. For this scenario, the tion running time is calculated as 120 S, 134 S and 115 S for the GA, PSO and IC rithms respectively. The planned active powers for the main grid, fuel cell, an generator and charging and discharging vehicles for the proposed ICA algorithm scenario are shown in Figure 10. Similar to the first scenario, the proposed ICA algorithm performed better than the PSO and GA algorithms and converged to a lower final value. The final values for the GA, PSO and ICA are 14,873 $, 14,432 $ and 14,015 $ respectively. For this scenario, the simulation running time is calculated as 120 S, 134 S and 115 S for the GA, PSO and ICA algorithms respectively. The planned active powers for the main grid, fuel cell, and diesel generator and charging and discharging vehicles for the proposed ICA algorithm in this scenario are shown in Figure 10.
Similar to the first scenario, the proposed ICA algorithm performed better than the PSO and GA algorithms and converged to a lower final value. The final values for the GA, PSO and ICA are 14,873$, 14,432$ and 14,015$ respectively. For this scenario, the simulation running time is calculated as 120 S, 134 S and 115 S for the GA, PSO and ICA algorithms respectively. The planned active powers for the main grid, fuel cell, and diesel generator and charging and discharging vehicles for the proposed ICA algorithm in this scenario are shown in Figure 10. Voltage profile for the second scenario is shown in Figure 11. Voltage profile for the second scenario is shown in Figure 11.
Similar to the first scenario, the proposed ICA algorithm performed better than the PSO and GA algorithms and converged to a lower final value. The final values for the GA, PSO and ICA are 14,873$, 14,432$ and 14,015$ respectively. For this scenario, the simulation running time is calculated as 120 S, 134 S and 115 S for the GA, PSO and ICA algorithms respectively. The planned active powers for the main grid, fuel cell, and diesel generator and charging and discharging vehicles for the proposed ICA algorithm in this scenario are shown in Figure 10. Voltage profile for the second scenario is shown in Figure 11.   Figure 11 proves that in all conditions, the voltage amplitude is not out of range. The comparison between scenarios 1 and 2 is also given in Table 7. As outlined in the figures and tables, in Scenario 2, more vehicles are discharged, and as a result, the profits of vehicle owners from the sale of electricity have been increased. Also, the results indicate that the profit from the electricity sale is more when we used the proposed ICA algorithm for optimization. The profitability in the first scenario is calculated as 123.592 $, 136.678 $ and 153.592 $ for GA, PSO and ICA algorithms, respectively. Profit from electricity sales in the second scenario are 191.315 $ for GA, 204.308 $ for PSO and 227.808 $ for ICA.

Conclusions
In this paper, the daily production of the grid and distributed generation resources are scheduled and the scheduling of charging and discharging of vehicles around the clock is carried out according to the type of motion behavior received by the vehicle owners. This is an issue with a large number of complex constraints, which has been solved in a very large scale. A comprehensive objective function based on operation cost and EVs owner profitability is proposed for the energy management of the microgrid. This problem has been solved in 2 scenarios and the following results have been achieved. The presence of vehicles on the grid and their participation in network products has had a very important contribution to optimizing the functions involved. The vehicles are able to significantly reduce the cost of operating the system when it is needed. Also, if the operator of the system considers the vehicle owners at the time of discharging the vehicle, it will be good for the vehicle owners which increase their interest in the use of electric vehicles, which has a very positive impact on the cost of operation. Productive resources also contributed greatly to improving system performance and reduce operating costs, according to their generation cost functions. Fuel cell has less participation in power generation due to higher generation costs than diesel generators. The objective functions, constraints and the proposed ICA of this paper can be used for other microgrids with different topologies in future work. In this paper, the uncertainties are denied. Therefore, for future studies, generation and load uncertainties can be considered.