Abstract
This paper investigates the optimal structure switching in the microgrid for improving the electrical services for cost minimization and power quality improvement. The proposed framework makes use of some tie and sectionalizing switches for changing the microgrid feeding path to the electrical consumers and thus minimizing the resistive power losses. This concept is assimilated with the mobile storage capability of electric vehicles to improve the operation of the microgrid. The wöhler curve is used to model the degradation costs of battery charging and discharging process in the electric vehicles. The proposed problem is formulated as a mixed-integer nonlinear optimization problem which is solved using the social spider optimization algorithm. Also, an effective two-phase modification method is developed to improve the algorithm diversity and avoid the premature convergence. An IEEE test system is used to investigate the performance of the proposed model.
Nomenclature
Wöhler curve parameters. Cost of power supply by the up-steam network. Cost of aggregated Electric vehicles. Cost of power losses. Cost of power purchased from DGs. Cost of battery degradation in Electric vehicles. Total network cost. Hourly price of energy purchased from main grid energy/loss/V2G. Hourly price of energy losses/V2G. Battery investment cost ($). Hourly price of energy purchased from DGs Initial/final DoD in a discharge cycle. Cartesian distance to closest/best individual. Usable energy of the battery (kWh). Energy of electric vehicle fleet v to drive at time t. Available energy in batteries of fleet v at time t. Initial/final energy in PEV fleet v. Min/max energy in electric vehicle batteries fleet v. Objective value of ith/best/worst individual. Weighted mean of male spiders in the colony. Number of loops/branches/ buses of network. Number of uncertain variables. Population size. Number of female/male spiders in the colony. Total number of Electric vehicles. Number of discharge cycles. Number of life cycles. Number of tie switches of grid. Number of sectionalizing switches of grid. Number of RCSs equal to N
tie
+ N
Sw
. Daily switching actions for each RCS. Maximum number of daily switching actions. Number of DG units including MTs and FCs. Output power of kth DG at hour t. Hourly/max imported power from upstream grid. Hourly active power loss of network. Charging/discharging capacity of PEV fleet v. Min/max charging capacity of PEV fleet v. Min/max discharging capacity of PEV fleet v. Min/max power capacity of ith DG at time t. Charge/discharge power rate of PEV fleet v at time t. Hourly injected active/reactive power at bus i. Mating region. Status of kth switch at time t
Hourly/max apparent power flow between bus i and j
Planning horizon. Random number equal to 1 or 2. Status of kth tie switch in tth hour. Status of kth sectionalizing switch in tth hour. Time in which SOC is set to a specific value. Status of grid connection of fleet v at time t. Indicator of fleet v in charge/ discharge/idle mode. Voltage magnitude/phase of bus i at hour t. Minimum/maximum voltage at bus i. Weight of ith/closest/best/ closest female individual. Position of closest spider/ closest female spider. Position of ith/best/randomly selected individual. Position of ith female/dominant male/non-dominant male spider. Magnitude/phase of impedance between bus i and j. Charging/discharging efficiency. ith random number between [0, 1].
Introduction
Microgrid is defined as a set of interconnected traditional and renewable-based units to supply a set of residential, industrial or commercial loads and can decide to connect or isolate from the main grid based on the requirements. Therefore, microgrid plays the role of an active electric element to generate power in the distribution level or can play the role of a passive element and be an electric consumer. The appearance of microgrid can bring some benefits for the distribution system and consumers. In the distribution system part, lower power losses, lower costs, higher voltage profile, less emission and higher reliability are some of the main advantages. In the consumer part, higher power quality and electrical services, lower energy price and access to the electricity during the blackout can be named. Along with these benefits, there are some questions and challenges made by the appearance of microgrid which necessitates deep and appropriate researches. In the area of operation and management, there are a couple of valuable works done which some of them are explained here.
In [10], a two-step power dispatch control approach counting the voltage regulation strategy is developed to keep away from the power constraint of distributed generation (DG) once the over-limit voltage occurs. Here, the absorption of distributed power by energy storage system (ESS) and the reactive power adjustment though the power control system are employed to regulate voltage. In [11], a mix-mode energy management strategy and an appropriate battery sizing method are proposed for operating the microgrid at the lowest possible operating cost. The proposed method is developed by combining three operating strategies, called “continuous run mode”, “power sharing mode” and “ON/OFF mode” for a 24 hour time period to minimize the microgrid costs. In [12], a multi-objective uniform water cycle algorithm is proposed for optimal operation management of microgrid considering the operation costs and emissions as the targets. The problem is solved to discover 24 pareto-optimal fronts corresponding to 24 hour operation time horizon to provide more flexibility for selecting hourly compromise solutions. In [13], an optimal framework is developed to analyze a microgrid which is characterized by the presence of different subsections including renewable plants coupled with ESSs. Several design conditions and features, related to DGs, ESSs and users, are considered to realize a sensitivity analysis aimed to identify the best solutions from both economic and energy point of views. In [14], a two-stage stochastic programming model is proposed for microgrids and the market competition model. In the stochastic model, energy demand and supply uncertainties are considered. In [15], a predictive control model is proposed based on the use of weather forecasts to improve the performances of power management in a domestic micro-grid system composed by Photovoltaic (PV), Fuel Cells (FC) and ESS. In [16], authors propose a collective energy dispatch solution to optimally coordinate DGs, ESSs and critical demands across multiple autonomous microgrids based on a “tree stem-leaves” approach. The energy distribution network modeled a weighted matrix considering power loss and reliability statistics as the objective. Recently, applications of fuzzy logic theory for engineering problems have attracted the attention of researchers [17, 18]. Fuzzy logic controller is one of the most powerful and well-known application of fuzzy logic theory. Since the role of the Energy Storage System EES is extremely important to keep the frequency and voltage of islanded micro-grid constant, authors in [19] proposed fuzzy PID controller along with Particle Swarm Optimization (PSO) algorithm for controller tuning to improve the frequency control performance of the energy storage system (EES). In several studies, it is shown that utilizing fuzzy logic controller has resulted in superior performance than conventional linear controllers [20, 21] Authors in [22] introduced a reconfigurable methodology based on a fuzzy multi-objective to obtain minimum active power loss and maximize the voltage magnitude of radial distribution networks based on distributed generations.
As it can be inferred from these explanations, the main focus of microgrid operation and management research works has been on the methods, objective functions and practical constraints. In this situation, the main tools available in the hands of the operator are the On/Off status of the DGs, their optimal output power, ESSs and in some situations the value of the responsive loads. However, there exists a valuable strategy in the distribution system, called switching or reconfiguration, which can improve the efficiency of the microgrid by changing the power flow path. Switching of the feeders can provide one more degree authority for the microgrid operator to apply his ideas for optimal operation and management of the system. By definition, reconfiguration is the process of changing the network topology using some normally open switches called tie and some normally closed switches called sectionalizing [23]. The valuable role of reconfiguration on the power loss reduction [24], voltage improvement [25], reliability enhancement [26], emission reduction [27] and cost decrease [28] are shown in the literature. Therefore, it is clear that reconfiguration can play a significant role in improving the microgrid operation and management by altering the network topology. In the connected mode operation, reconfiguration can provide better power dispatch among the units and thus reduce the costs. In the islanding mode, the reconfiguration can release the line capacity and thus reduce the necessity of possible load shedding. Therefore, this paper proposes the idea of reconfigurable microgrids for more optimal operation and management of these systems considering different types of DGs such as FC, PV, wind turbine (WT) and micro turbine (MT). The proposed method makes use of the pre-located tie and sectionalizing switches to change the power flow path in the microgrid. In order to make the analysis more practical, several electric vehicle fleets are considered in the microgrid to simulate a random load variation in some buses during the scheduling plan. This can make the reconfiguration a more complicated task which requires a smart optimization framework to be solved. The objective function is the total microgrid costs incorporating the cost of power losses, cost of power purchased from DGs, ESS and main grid and cost of battery degradation due to the charge and discharge of electric vehicles. Here we make use of the vehicle-2-grid (V2G) idea to provide a bidirectional power exchange between the microgrid and electric vehicles. The wöhler curve is used to model the degradation costs of battery charging and discharging process in the electric vehicles. Due to the complexity and nonlinearity of the problem, a new optimization framework based on social spider algorithm (SSA) is developed too. SSA is inspired from the social behavior of spiders in mating and surviving their generation [29]. A two-stage modification method based on genetic algorithm operators is also proposed to improve the search ability of the algorithm and reduce the possibility of trapping in local optima. The feasibility and appropriate performance of the proposed method are tested on an IEEE local distribution system.
The rest of this paper is organized as follows:Section 2 explains the problem formulation. Section 3 describes the optimization framework. The simulation results are explained in Section 4. Finally, the main concepts and conclusions are discussed in Section 5.
Problem formulation for reconfigurable micro-grids operation
This Section describes the problem formulation including the control variables, cost function and limitations for the proposed problem.
A. Control Variables
The control variables include the set of variables which should be determined optimally to make the microgrid operate in a feasible and sufficient status. According to the problem nature, the control variables consist of 1) ON/OFF status of sectionalizing and tie switches at each hour t as
In the above equations, X Tie , X Sw , X Uc , X Ud and X Ui are binary variables. The other variables are continuous.
B. Objective Function
The objective function minimizes the total microgrid costs including the cost of power supply by DGs, cost of electric vehicles charge/discharge, cost of degradation through V2G, cost of power purchased from the main grid and cost of power losses. Each of these terms is explained in the following.
- Cost of power supplied by DGs:
This term accounts the cost of power generation by DGs as follows:
- Cost of charging/discharging of electric vehicles:
The operation cost of electric vehicles can be positive or negative according to the charge/discharge status as follows:
- Cost of battery degradation:
The battery degradation cost due to several times charging and discharging is calculated by the wöhler curves. This cost is as the result of extra cycling of battery using the V2G. Figure 1 shows wöhler curve for a typical battery which is formulated as follows:

Wöhler curve for lithium-ion battery.
Here the battery parameters a and b are determined according to its type. Using this concept, the battery degradation cost from the initial status of DoD i to DoD f is evaluated as follows:
- Cost of power purchasing from the main grid:
The cost of power purchased from the main grid is calculated as follows:
- Cost of power losses:
The cost of power losses is calculated as follows:
C. Constraints
The proposed optimization problem is solved considering some constraints:
- DG Capacity:
- Bus voltage limit:
- Maximum power exchange between the microgrid and the main grid:
- AC power flow constraints:
- Maximum power flow in feeders:
- Maximum switching actions:
Due to the operational costs, the number of switching is limited as follows:
- Hourly charge/discharge/idle states of fleets: This constraint determines that at the each time t, each electric vehicle fleet can be in only one status of charging, discharging or idle mode:
- Hourly energy balance in PEV batteries:
- Max/Min power charge rate:
- Max/Min power discharge rate:
- Energy capacity limit of each fleet:
- Initial SOC of electric vehicle battery: at the beginning of the first travel, the electric vehicles should be charged fully to be ready for driving on the road:
- Network radiality: since distribution systems are made radial, this feature should be preserved before and after the reconfiguration. The number of loops in the network is calculated as follows:
Evolutionary algorithms (EAs) are considered as stochastic search methods that mimic the natural biological evolution and/or the social behavior of species. Such algorithms have been developed to arrive at near-optimum solutions to large-scale optimization problems, for which traditional mathematical techniques may fail [28] As it can be inferred from the last section, the proposed optimization problem is a mixed integer nonlinear optimization problem which requires a powerful optimizer to solve it. This section explains the SSA algorithm and its modification method. SSA was originally proposed in 2012 to model the social behavior of spiders in a colony. Some of the special features of SSA can be named as simple concept, ease of implementation, fast convergence and powerful global search mechanisms. The SSA is inspired by the mating process between the male and female spiders. A female spider attracts the other spiders according to its size and distance from them. The male spiders show the same behavior by interacting with each other based on their size. A bigger male spider is assumed as a dominant spider which can mate with female spiders. The non-dominate spiders gather at the center of population to prevent attending in a mating with abnormal broods. Therefore, initially N number of spiders with N
F
females and N
M
males are generated. In a normal colony, the ratio of female spiders to male spiders would be in the range 65% –90% [29]. After calculating the fitness function for spiders (here the cost function value), a weighting factor is designated to each spider as follows [29]:
Here the indices b and w are used to show the best and the worst spider. Then, the positions of female spiders are updated as follows [22]:
In the second step, the position of male spiders should be updated. Here first the spider population is sorted based on the weighting factors. Assuming the middle spider as the median, the spider with higher weighting factors are dominant and the others are non-dominate. The position of the ith dominant male Xi,DM is updates as follows [29]:
This equation simulates the attraction of female spiders toward the male dominate spiders. The non-dominate spiders are also updated using the below formulation [29]:
This process is repeated until the optimal solution is found.
While SSA is a powerful optimization method which has shown superior performance than a high number of other algorithms, this paper proposes a new two-stage modification method to improve the diversity of the algorithm. The first modification method makes use of the Levy flight to simulate a slow random movement around each spider. This is like a local search which can improve the search ability of the algorithm, greatly.
The second modification method uses a mathematical formulation to accelerate the improvisation rate of the algorithm. The main idea is to shift the mean/average value of the spider population toward the best spider X
b
as follows:
The above movement will try the whole population to move toward best solution swiftly.
This section focuses on the simulation results of the proposed method on a test system. To have a fair comparison, the IEEE test system is used as the test bed. Figure 2 shows the single-line diagram of the test system. This is a 32-bus network consisting of 5 tie switches, 31 sectionalizing switches, one MT, one FC, one PV, one WT and 2 travel paths for the electric vehicles fleets. The tie switches are shown by dotted lines and the sectionalizing switches are shown by solid lines.

Single-line diagram of the test bed.
For electric vehicles, as it can be seen from Fig. 2, two travel paths are considered. Table 1 shows the location and time of each travel path. About electric vehicles, lithium-ion with wöhler parameters a = 1331 and b = –1.825 are considered. Also, the battery investment cost is considered 315 ($). Table 2 shows the capacity and charge/discharge rate of electric vehicle fleets in the microgrid.
Electric vehicle fleet travel characteristics
*Outside of microgrid (OMG).
Electric vehicle fleet characteristics
Table 3 shows the characteristics of DGs, either renewable energy source or the traditional fossil fuel based DGs. The location, capacity, max/min capacity, cost of energy purchase and start-up or shut-down costs are provided in the table.
The limitations and energy price of DGs
Figures 3 to 4 show the hourly forecast output power of PV and WT. Since we have two wind turbines, similar output power pattern with different capacities are considered.WT-2 is assumed to be a bigger unit with 1.3 larger capacity that WT-1. As it can be inferred from these figures, the operation time horizon is 24 hours. For electric vehicles, they can attend the V2G plan anytime when they are either in the parking of home or the office. Also, the aggregated load demand and the market electricity price are shown in Figs. 5 and 6, respectively.

Normalized WT output power.

Normalized PV output power.

Aggregated hourly load demand of the Microgrid.

Hourly energy price.
In order to have a good comparison, four different scenarios, so called status of operation (SOP), are defined. In the first SOP, electric vehicles are ignored and DGs are forced to be on ON mode. In thesecond SOP, electric vehicles are ignored yet but DGs can decide to switch between ON and OFF status. The main purpose is to clarify the effect of switching capability of DGs on the microgrid cost. In the third SOP, DGs can switch between ON and OFF status and electric vehicles are considered in the network. In the last scenario, SOP 4, DGs can switch ON or OFF and the electric vehicles and reconfiguration are considered. Table 4 shows the hourly cost of the microgrid during the operation time horizon. A comparison among different SOPs shows that the SOP 4 could get to the least cost for the microgrid. The lower cost of SOP 2 than SOP 1 shows the useful role of switching scheme for DGs. In the SOP 3, it is supposed that electric vehicles exist in the microgrid. In contrast to the first expectations which the existence of electric vehicles can increase the costs, the V2G technology has helped the microgrid to reduce its costs. In fact, V2G makes use of the electric vehicles like mobile storages which can charge or discharge according to the network benefits. The best scenario with lowest cost is SOP 4. In this scenario, the microgrid is equipped with the switching capability of the reconfiguration and thus the overall network costs are reduced, properly. Due to the efficient performance of the microgrid in SOP 4, this scenario is considered as the dominate scenario in the rest of the paper.
Expected cost function value in different scenarios
Table 5 shows the optimal output power of DGs. According to this table, WT and PV are producing their normal forecasted daily power. The microgrid is dedicated to buy all power production of these non-dispatchable sources to support the renewable energy idea. Nevertheless, MT as an expensive power unit is forced to minimize its power in most of hours. FCs are both producing power at a good range due to their fair price for the electric consumers.
Optimal power dispatch of DGs considering electric vehicles and reconfiguration (kW)
Optimal power dispatch of electric vehicles and optimal switching
Finally, Table 6 shows the optimal switching scheme and optimal charge/discharge values of the electric vehicle fleets. In this table, both electric vehicle fleets are attending the V2G plan during the hours which are free in the parking. Also, since the electric vehicles should have enough energy to travel on the road, they are fully charged before the first trip. For the second trip, the amount of energy stored in the electric vehicles batteries is over 20% remained energy plus the energy required for two hours driving on the road. It should be noted that electric vehicles are assumed to not discharge more than 80% to avoid fast battery aging.
In order to have a better comparison about the power loss values, the amount of power losses for different SOPs are plotted in Fig. 7. The amount of power losses is reduced in the last SOP. Nevertheless, the system power loss is reduced in all scenarios owing to the DGs, electric vehicles andreconfiguration.

Microgrid power losses.
This article focused on the optimal operation and management of the microgrids considering DGs, electric vehicles and reconfiguration strategy. The optimal switching is offered as a powerful tool to reduce the microgrid costs and help better dispatching of the units. The proposed problem is reflected in the form of a mixed integer nonlinear optimization framework which uses SSA algorithm to be solved. Also, a two stage modification method is developed to improve the search ability of the algorithm when reducing the possibility of trapping in local optima. The simulation results on the IEEE test system show that reconfiguration strategy can play a significant role in reducing the network losses. Also, it can help higher penetration and operation of electric vehicles. The amount of power losses is reduced most in SOP 4 which incorporates the reconfiguration strategy. In overall, it was seen that reconfigurable microgrid can be more efficient and will help to better dispatch of units in the scheduling problem.
