Optimal scheduling of smart microgrids considering electric vehicle battery swapping stations

Received Mar 22, 2020 Revised Apr 24, 2020 Accepted May 3, 2020 Smart microgrids belong to a set of networks that operate independently. These networks have technologies such as electric vehicle battery swapping stations that aim to economic welfare with own resources. Improper handling of electric vehicles services represents overload, congestion or surplus energy. This study addresses both management and support of electric vehiculos battery swapping stations. The formulation of a decision matrix examines economically viable alternatives that contributes to scheduling battery swapping stations. The decision matrix is implemented to manage the swapping, charging and discharging of electric vehicles. In addition, the smart microgrid model evaluates operation issues. The smart microgrid model used extends with considerations of demand response, generators with renewable energies, the wholesale market, local market and electricity spot price for electric vehicles. Additionally, uncertainty issues related to the planning for the infrastructure of the electric vehicle battery swapping station, variability of electricity prices, weather conditions and load forecasting are used. Mentioned stakeholders must maximize their economic benefits optimizing their uncertain day-ahead resources. The proposed hybrid optimization algorithm supports aggregator decision making. This algorithm achieves a 72% reduction in total cost. This percentage of feasible reduction is obtained by calculating the random solution with respect to the suboptimal solution.

and constraints [9]. SMG model 4 proposes the dispatch of energy for EVs, wind and photovoltaic power generation. In fact, this EV model associates EVs with each node and only the load power varies. Therefore, the model lacks an approach of discharging, swapping batteries, and constraints [11].
BSS model 5 gathers the EVs in programs of DR. The case study demonstrates that ignoring the uncertainty of EVs traffic and PV generation leads to an inappropriate planning. Furthermore, BSS model 5 assumes simplifications without considering other elements of the grid and the uncertainty of the market prices [12]. The model 6 for battery charging stations considers the uncertainty over charging EVs. EV uncertainties are modeled through a Gaussian distribution model. In addition, the EVs are connected to the grid, PV generation, and battery-ESSs. In spite of this, the last variables have uncontrolled stochastic uncertainties, since there are no details about these uncertainty models [13]. BSS model 7 forecasts wind-power generation and uses real time prices to plan in short time. However, the EV model takes into account the uncertainty over charging EVs [14]. BSS model 8 considers the stochasticity in energy markets and demand management of batteries. Nevertheless, model 8 simplifies the interaction between stakeholders and EV BSS [15].
BSS model 9 purchases power in an upstream network and maximizes the day-ahead incomes. This bi-level model is divided into lower and upper levels. This model has acceses to the mechanism of real-time prices. The BSS model includes a micro-turbine, PV and wind generation. The uncertainty of the last two is considered together with the uncertainty of the load demand and the arrival time of EV. However, this model includes neither the ESS nor the load shedding restrictions [16]. A framework is proposed to restrict the load shedding in [17]. Other research also considers the uncertainty of PV and wind generation and introduces an index of probability of islanding operation [18].
BSS model 10 is formulated in this paper and integrates constraints to EVs through BSS, where BSS uncertainty is simulated by means of a K-means clustering approach. Moreover, it integrates SMG with uncertainty elements such as PV generation, electricity markets, and loads with DR. SMG planning is performed by the aggregator, which tries to increase the profits of the SMG. Then, the aggregator minimizes the operational cost while increasing the incomes. Indeed, the transactions in electricity markets generate profit. Besides, the aggregator has assets, such as EVs BSSs and ESSs, which become prosumers as they can either buy or sell energy. The BSS model formulation can be applied for DR programs [19]. The load is usually involved in DR programs [9]. In the BSS model, the aggregator negotiates energy in the electricity spot price. In the BSS, one available asset is the battery bank in the BSS that can be encoded with a EVs BSS matrix. The aggregator deals with the uncertainty in the arrival time of EVs and the volatility of market prices. For both, the uncertain scenarios are estimated with the K-means grouping method. In the case study, vehicle driving patterns are forecast based on NWS traffic [6]. Load management for EVs should tackle congestion times and relieve the scarcity of energy [20]. The SOC eases the scheduling the batteries charge or discharge as indicator [20].
In this way, SMG model 10 is the most comprehensive, taking into account the previous revision in Table 1. Satisfactory solutions of vital importance are inspected, through the formulation of heuristic methods [9,21]. These methods have been widely studied, however, there are still development gaps related to yields, and exploration and exploitation methods [21]. A vast majority of metaheuristics proposes a sequential combination of heuristics to be more successful [21]. For example, a hierarchy analysis is set out among several algorithms such as enhanced velocity differential evolutionary particle swarm optimization algorithm. In Figure 1, the main algorithms reported in the literature are organized according to the hierarchy of a better suboptimal solution [9,22]. In summary, VNS-DEEPSO algorithm turns out to have a greater hierarchy regarding the SMG models proposed in [9,22] and it is described in two (VNS and DEEPSO) main components below. VNS-DEEPSO is widely tested in a robust optimization approach [9]. This research finds out a robust solution with low sensibility to some uncertainty parameters, such as PV power forecast, load prediction, EVs planning, and wholesale and local markets [9].

Variable neighborhood search-VNS
VNS is used in nonlinear optimization, as it can find a local optimum with quality solutions [23]. The algorithm makes automatics neighborhood changes and aims to extend the local search. The VNS algorithm is defined in two main stages: initialization and repetition. The initialization stage consists in defining the neighborhood structures. In the repetition is carried out in three steps. First step, the initial solution is found in the neighborhood. Second step, the search method looks for an initial solution called local optimum. In the third step, the local optimum is stored. Afterward, when the new solution improves the local optimum solution, then the local optimum solution will be updated. Two cases can happen: first, the new solution found in the process is worse than the local optimum or second, the new solution found is the same as the local optimum. In both cases, the search continues for the next neighborhood structure. These steps are repeated until the last neighborhood structure [23,24].

Differential evolutionary particle swarm optimization-DEEPSO
DEEPSO algorithm was developed based on three metaheuristics: differential evolution (DE), evolutionary algorithm (EA) and particle swarm optimization (PSO). These methods try to find the global correct direction and jointly search for a robust solution [25]. EA algorithm uses biological operators such as reproduction, mutation, recombination, and selection. Therefore, the population evolves through biological techniques. Furthermore, the fitness determines the solution quality [26].
PSO algorithm is a set of candidate solutions as swarm particles. They flow in tracks of the search space. The search motivation is the best performance of them and their neighbors [27]. DE algorithm has three or four operational parameters and in roughly 20 lines, it includes a simple and adaptable mutation operator [26]. Finally, DEEPSO algorithm was introduced as a metaheuristic technic and is a hybrid among EA, PSO, and DE. It has best outcomes than other techniques, however, it does not provide a deductive demonstration [25].

SMART MICROGRID MODEL
This section presents the main assumptions in the BSS model 10 of SMG that represents the profits (including operation costs and incomes). Figure 2 represents the main elements of the SMG (ESS, EV BSS, load with DR, day-ahead markets, PV generation and DG). The arrows mean buy or sell energy: selling is symbolized by the line entering to the aggregator and buying by the line coming out from the aggregator. The red line highlights the elements with uncertainty. The SMG model is obtained by codifying a black box model of SMG from [28] and a decision matrix is developed by collecting available data from [29,30], together with the EV uncertainty model based on the methodology from [6]. The main SMG assumptions are listed below.
Variable neighborhood search differential evolutionary particle swarm (VNS-DEEPSO) First hierarchy Evolutionary particle swarm optimization (EVDEPSO) Second hierarchy Ant colony optimization (ACO), chaotic evolutionary swarm optimization (CESO), cuckoo search (CS), evolutionary particle swarm optimization (EPSO), flower pollination (FP), differential evolution (DE), genetic algorithm (GA), hybrid simulated annealing (HSA), hybrid differential search algorithm (HDSA), particle swarm optimization (PSO), quantum particle swarm optimization (QPSO), simulated annealing (SA) and Tabu search (TS). SMGs is a component of the smart grid, but also SMGs operate independently and self-sufficiently. By the same token, SMGs consist of a set of loads and generators operating as a unique system [31]. In this context, SMGs have aggregators that try to increase the SMG profits. -SMGs are flexible in connecting distributed generation (DG) and PV generation [32]. -Two electricity markets are considered wholesale and local, and the EV prices are estimated with the Australian Market Operator from January 2016 to June 2019. Prices from electricity markets lead to revenues for selling or expenses for buying energy [28]. -A realistic approach of SMG includes energy resources with uncertainty. The uncertainty sources come from (a) PV renewable generation, (b) load profiles, (c) visit of EVs to BSSs, and (d) electricity market prices for wholesale, local, and electricity spot for EVs [6,28].

-
The aggregator uses ESS and BSS as their own assets and supports the programming of energy resources of SMG. Indeed, ESS has constraints related to the state of the battery, while EVs have constraints related to stochastic visits to BSS, brand, and plug type of EV.

-
The improvement of SMG profits is formulated with a heuristic optimization algorithm. Specifically, the VNS-DEEPSO algorithm is a recently studied technique that has demonstrated good performance for these types of problems [21].

Figure 2. Depiction of energy transactions in SMG
According to the main aspects in the SMG operation, the objective function aims to minimize Z, that is, the negative of the profits (1), which means that profits are maximized. It is defined as the addition and subtraction of six terms. The first term introduces the value of buying energy to load with DR. The second term, Gen can be negative when the energy of DGs and PV generation are sold. The third, fourth and fifth terms are the prosumers, represented by the ESS, BSS of EVs, and market transactions (MTs). These costs or revenues are quantified based on the type of transfer. In the first place, the incomes are represented with a negative value and, in the second place, costs are estimated with a positive value. The sixth term of (1) is penalties (Pen), which are defined for an imbalance, when the demand is not satisfied or the generation is exceeded [28]. Fixed costs are related to the purchase of batteries, degradation of components, and maintenance. As in math, the derivative of a constant is zero. Fixed costs are also constant (they do not vary regardless of the decision variables), therefore, they are not included in the objective function, because their change rate is zero (1) [6]. For explanations purposes, the six terms on the right side of (1) are formulated from (2) to (7).
Equation (2) represents the prices ( ) per capacity ( ) of loads with DR and the scenarios (s) have a probability ( ( )). In (3), the total generation is denoted as the sum of DGs, external supplier, and PV generation. Equation (4) details the operation of the ESS. In (5), BSS revenue is calculated from allocating a swapped battery per price . If EVs visit the station, but there is no battery to swap, then BSS owners will receive penalties. The penalty is calculated based on the subtraction of an assigned battery from EVs battery demand [15]. In (5), the efficiencies ( and ) refer to charging and discharging of batteries, while and represent the number of batteries that are charged and discharged in the electricity spot price for EVs ( ). In (6), MTs represent the sale ( ) and purchase ( ) of energy. Finally, the penalizations (Pen) are made such that the demand is not satisfied, or the generation is exceeded as shown in (7). This model is structured with mixed-integer linear programming. However, in (9) the constraint for demand with DR is nonlinear, so it can be classified as mixed-integer nonlinear programming.

minimize Z DR Gen ESS BSS MT Pen
The energy balance has constraints shown in (8). The conservative balance should be zero. The energy balance is composed of the total generation (DG, an external supplier, and PV), ESS, load with DR, transfer in the market, and imbalance in the generation of energy [28]. EVs BSS has another analysis equal to the energy balance shown from (10) to (17). This model also considers that EVs and loads are involved in DR programs. Equation (9) formulates a constraint for the load DR that they should be different from zero and the demand welfare represents at least 10 % of the total energy being supplied for all periods [32]. Equation (1) is subject to (8) and (9). EVs encompass the DR program and schedule the BSS arrival time with the following assumptions. The amount of visits of EVs is expected to be fixed [6]. However, visiting hours are estimated with the K-means clustering method [6]. Therefore, the visiting hours of EVs is uncertain [16]. The priority in the BSS is that the swapping batteries must be charged. Once the batteries are charged, the aggregator decides whether to discharge or swap them. This option is only possible when one or more EVS eventually demand to swap a battery.
Fully charged batteries are available per hour. At least one fully charged battery is guaranteed every period in the BSS. In the event that electric vehicles visit the substation, two cases may occur. In the first case, the battery is not swapped because the aggregator does not consider it compelling or there are no batteries available. These assumptions contemplate that the aggregator is penalized, so these situations are undesirable [15]. In the second case, the battery is swapped. The day begins with a fully charged battery bank. EVs arriving at the BSS have completely depleted batteries [6]. The charging / discharging capacity of EVs batteries is constant. This is estimated with the average charging time according to the type of charger and the EV brand [6]. The battery swapping time is considered negligible [16].
The substation has a constant number of batteries [33]. However, the SOC depends on factors, such as the visits of EVs and the decisions of the aggregator [16]. Battery degradation is estimated as a fixed cost. In other words, the variability of costs for battery degradation is assumed negligible for day-ahead planning [33]. The aggregator can swap several batteries at the same time [33]. In accordance with the aforementioned considerations, the restrictions for the programming of EVs are formulated.
In (10), fully-charged batteries ( ) include the previous fully-charged batteries in each period, new batteries that are fully-charged ( ) and depleted batteries that are swapped for fully-charged batteries ( ). An additional function of EV batteries consists in supplying the SMG demand. In (11), the waiting time for charging or discharging is represented by the interval charging time ( ) or interval discharging time ( ).
is calculated as the ratio between the vehicle battery capacity ( ) and the minimum between the power of the on-board EV ( ) and the allowed power from the charger level specification ( ).
The acceptance rate is limited by the EV technology for charging or discharging in BSS. EV charging levels are frequently grouped into three categories as shown in Table 2 [34]. Level 1 chargers are required either at home or in overnight process. Level 2 chargers have two uses in public or private facilities. Level 3 chargers are developed with technology that allows a quick charge in a short time; however, these advances are at a premature phase yet [34].
The next EV restriction (12) establishes the initial batteries in the station ( ). Fully-charged batteries ( ) should maintain this limit. Furthermore, discharging ( ) and swapping ( ) batteries are allowed without surpassing the number of initial batteries (13). In addition, EV customers demand ( ) should be higher than the batteries being swapped (14).
The batteries to be charged ( ) depend ( − ( , ) ) on the battery availability and the allocated batteries to swap in the actual period (15). In (16), the SOC is represented by the succession of the charge (∑ ) periods. The sum of these two terms cannot exceed the initial number of batteries. In (17), decision variables are greater than or equal to zero.

UNCERTAINTY SOURCES
The uncertainty is represented in the three groups presented below.

Uncertainty of PV generation, electricity markets, and loads with DR
The case study is created by using 5000 scenarios based on [28]. This research looks for robust solutions to the uncertainty parameters, such as PV power forecast, load prediction, and wholesale and local markets [28]. The PV power geration, the loads with DR and the variations of energy markets (wholesale and local) have forecast errors of 15%, 10% and 20% respectively. In (18), the Monte Carlo method generates the scenarios. A normal distribution function is used to forecast the error ( , error s x ) through historical data.
The forecast errors ( forecast x ) with uncertainty are represented by a normal distribution function. In the second step, 5000 scenarios are reduced to 100 using a reduction technique based on low probabilities [35].

Uncertainty of driven pattern and electricity spot price for EVs
Data on EV trips and electricity spot prices for EVs use the transportation and electricity sources from New South Wales (NSW) [30]. The data on electricity spot prices is obtained from January 2016 to June 2019. They are estimated with the Australian Energy Market Operator. The time resolution is per hour and the K-means clustering is employed to forecast electricity spot prices from hour 1 to hour 24 [6]. Electricity spot prices for EVs are grouped into 10 clusters together with their probability percentages, as shown in Figure 3. The percentages represent the probability of occurrence. A similar feature is called a scenario and the prices are normalized so that the sum is unity for each day [6].
The cluster dataset identifies the EV expected visits in a specified region [6]. It is illustrated in Figure 4, EVs are group by arrival time. Then, the traffic data includes the amount of cars for a 24-hour time interval. The numer of vehicles and market prices have been normalized with a value of 0.1. Cars passing in southbound and northbound areas are separated. The scenarios are produced through probability of occurrence, where each cluster has some associated feature sets. In addition, the probability of occurrence depends on the number of characteristic patterns [6].

RESULTS AND DISCUSSION
This section develops the case study and the results are discussed after its formulation.

Development of the case study
The structure of the problem is based on the modified case study proposed in the IEEE-CEC/GECCO 2019 competition [28]. This case study is carried out in Matlab 2016. Figure 5 shows the SMG components. Therefore, a 26-bus SMG has 5 DGs, 1 external supplier, 1 PV generation, 15 swapping batteries for EVs, 34 EVs, 90 loads with DR, and 2 ESSs. Moreover, the wholesale and local markes, and electricity spot price for EVs are considered. The capacity of energy resources is represented in Table 4. Prices of the wholesale and local markets are taken from [28], while the prices for EVs are taken from the New South Wales (NSW) electricity market given in monetary units (m.u.) per kWh [30].
The capacity of energy resources is representedn Table 4. Prices of the wholesale and local markets are taken from [28], while the prices of the EVs market are taken from the New South Wales (NSW) electricity market given in monetary units (m.u.) per kWh [30]. EVs are selected based on the market reach of top EV manufacturers. Under this context, three types of vehicles are chosen: Toyota, Nissan, and Mitsubishi. In Table 5, surveys of EVs sales allow to compute the probability of EV transit [29]. Additionally, the battery characteristics are provided in [36].

Discussion of case study results
In this study case, the SMGs are optimized through the VNS-DEEPSO algorithm with 100 probabilistic scenarios. The cost is reduced by 72 % in the overall cost, which is obtained by calculating the reduction percentage of the random solution with respect to the suboptimal solution. Additionally, according to [9], the VNS algorithm is selected (simple version) and the DEEPSO algorithm is formed by the following parameters: the mutation rate, the communication probability, the population and the local DEEPSO search probability as 0.8, 0.8, 2 and 0.1, respectively. The number of evaluations is restricted to a maximum of 50,000 [28].
Results are summarized in Figure 6, where the generation is presented for a period of 24 hours (in day-ahead markets). For this period, the maximum generation is supplied by the external supplier. DG 5 has relevant participation followed by PV generation. The other generators (DG 1, DG 2, DG 3, and DG 4) have a lower participation rate. To summarize, the generation presents a stochastic generation. Load with DR is calculated by using a coefficient 10 from (9), as suggested by [32]. However, it is adjusted to 20 to avoid consumption equal to zero. The peak consumption in Figure 7 is 0.0722 kW at midday. Other peaks are found at 10 a.m., 7 p.m., and 9 p.m. with consumption of 0.0147 kW, 0.0198 kW, and 0.0117 kW, respectively. In [9], they report that the load is reduced because it is more convenient for the aggregator to carry out load shedding.

5105
EV batteries have events such as swapping, charging, and discharging as shown in Figure 8. A BSS of EVs has 15 EV batteries and it has scheduled visits of 34 EVs at any given time. The EV batteries can be partially charged. Figure 8 shows a smooth increase in the number of battery discharge at 2 a.m. and the number of discharging batteries decreases close to zero at 9 a.m. Afterward, from 2 p.m. the number of discharging batteries increases smoothly until 11 p.m. and ends steadily.
The number of swapping batteries have stochastic behavior. It depends on the EVs visit and the EVs batteries that are accepted. The number of charging EVs batteries increases from 2 a.m. to 5 a.m. as shown in Figure 8. Then, it remains steady until 7 a.m. and decreases close to zero at 1 p.m. ESS 1 as shown in Figure 9 has a discharging peak with 0.1986 kW at 4 a.m. and a charging peak with 0.3144 kW at 9 p.m. ESS 2 has lower participation, presumably due to the use of EVs. In addition, [22] reports ESS 2 with a suboptimal solution of 0.87 kW. Transfer power in electricity spot price for EVs is computed as result of EVs matrix per average charger rate (19). This equation takes into account the average type of electric vehicle and type of charger rate.
Electricity markets in Figure 10 show a tendency to sell and not to buy energy for higher profits. The wholesale market has the higher participation with transactions close to 85 kW and some fluctuations. highlighted when there are batteries charging and discharging. The transfer power is not carried out in the EVs market, but it is performed between the same batteries of the BSS. Therefore, the energy transaction of electricity spot price for EVs shown in Figure 10 is lower. Figure 10. Electricity markets

CONCLUSIONS
The optimization of EVs in SMG with uncertain scenarios has not been fully explored, thus this study proposes a new methodology that involves uncertainty decisions in battery swapping stations. In the proposed method, a decision matrix is formulated to schedule EVs BSS. Furthermore, the stocastic visit is based on the K-means clustering approach. Once the visit schedule to EV BSS has been generated, idle spaces appear in the probabilistic scenarios within a decision matrix. This means that the idle spaces are generated when the charge of a battery must be mandatory.
As a result, optimization is only allowed for free spaces, that is, charging, discharging, or no action. In addition, other elements of the SMG are included in the model, such as DG, PV generation, ESS, loads with DR, and day-ahead markets. Finally, the best schedule of charging, discharging, and swapping for EVs batteries in BSS, and the transfer of power in the market are identified satisfactorily. The generation, loads with DR, and ESS are stochastic, however, the patterns are recognized of the main generators, peak hours in loads with DR (at midday), and ESS participation.