A Stochastic Bi-Level Scheduling Approach for the Participation of EV Aggregators in Competitive Electricity Markets

This paper proposes a stochastic bi-level decision-making model for an electric vehicle (EV) aggregator in a competitive environment. In this approach, the EV aggregator decides to participate in day-ahead (DA) and balancing markets, and provides energy price offers to the EV owners in order to maximize its expected profit. Moreover, from the EV owners’ viewpoint, energy procurement cost of their EVs should be minimized in an uncertain environment. In this study, the sources of uncertainty―including the EVs demand, DA and balancing prices and selling prices offered by rival aggregators―are modeled via stochastic programming. Therefore, a two-level problem is formulated here, in which the aggregator makes decisions in the upper level and the EV clients purchase energy to charge their EVs in the lower level. Then the obtained nonlinear bi-level framework is transformed into a single-level model using Karush–Kuhn–Tucker (KKT) optimality conditions. Strong duality is also applied to the problem to linearize the bilinear products. To deal with the unwilling effects of uncertain resources, a risk measurement is also applied in the proposed formulation. The performance of the proposed framework is assessed in a realistic case study and the results show that the proposed model would be effective for an EV aggregator decision-making problem in a competitive environment.


Introduction
Due to the fast development of electric vehicle (EV) technology, optimal scheduling of EVs integration in the electricity trading floor is required.Several frameworks have been suggested to develop the decision-making of an EV aggregator in electricity markets [1,2].In [3], an optimization method for aggregator's participation in the day-ahead and secondary reserve is proposed.In [4] conditional value at risk (CVaR) is applied as a risk measurement in the decision-making process of a wind producer to confront the uncertainties in day-ahead (DA) and balancing markets.In [5], a stochastic model for energy and reserve scheduling considering risk management strategy is investigated.In [6], the impact of the market price and reserve market uncertainties via a stochastic programming structure is expressed to obtain the EV scheduling problem.Integrated scheduling of EVs and renewable resources in a microgrid is investigated in [7] in order to control the intermittency of renewable energy generations through the stored energy in EVs' batteries.Coordination of charging schedules of EVs with the objective of minimizing the total charging cost while considering varying charging power of EVs is proposed in [8].An aggregator-based interactive charging management scheme adopting interruptible load pricing is investigated in [9] in which the EV aggregator will respond to the load control command of the grid.
An economic framework of responsive load based on the elasticity factor is proposed in [10] to schedule the energy and reserve of a microgrid in the presence of renewable energy resources and EVs.In some of the related literature the optimization of the aggregator's expected profit is considered subject to the constraints related to the EVs' demand [11].Authors in [12] propose a stochastic model in which the bidding strategy of an EV aggregator in DA and reserve markets is optimized without considering any risk aversion.In [13], a stochastic optimization problem for participation of plug-in EVs in electricity markets considering value at risk (VaR) as a measurement tool is investigated.A plug-in EV charging load is formulated in [14] to assess the influence of EVs on urban distribution networks.The authors in [15] tried to model the market price uncertainties to obtain fixed pricing, time-of-use pricing and real-time pricing by a retailer in a smart grid.In [16] a stochastic aggregated model of the EVs exchanging energy is formulated and the EVs' reaction to the stochastic balancing requests is presented.Also, the influence of vehicle-to-grid (V2G) service features of balancing contract is discussed.
Optimal bidding strategies of EV aggregators in DA energy and ancillary services markets while considering renewable generation is proposed in [17] within a stochastic optimization model.Authors in [18] proposed a stochastic linear program for the participation of aggregator in DA and balancing markets while considering risk via CVaR terms and in [19] the authors discussed the effects of charging program of EVs on the grid.
Since the EV aggregators can compensate the stochastic behavior of renewables or load forecasting errors, a cooperative game model has been presented in [20] to capture the interactions between utilities and parking lots in the spinning reserve market, considering the V2G scenario.EV aggregators could also form a non-cooperative game where they try to maximize their own profit in a competitive environment.Therefore, a given EV aggregator has difficulties making energy trading decisions and offering appropriate bids to the EV owners to make more profit.In this regard, a mathematical program with equilibrium constraints optimizing the aggregator's decisions is proposed in [21] to determine the optimal profit and to minimize the charging cost paid by the final customers.However, the work does not consider the performance of rival aggregators.In [22], in contrast to what is commonly assumed, the aggregator is supposed to affect market prices.Also, the impact of the aggregator's bids on prices is assessed using a bi-level problem, however the impact of the prices offered by other aggregators is not discussed.The problem of decision-making of the interaction between the parking lot and distribution system operator in a bi-level framework is provided in [23].It gives a model for participation of parking lots in both energy and reserve markets in order to compensate renewable generation and load uncertainties.In [24], authors propose an integrated model of plug-in EVs and renewable distributed generators in a market floor where users can sell back the energy generated from their renewables or the energy stored in their plug-in EVs.
In this paper, a bi-level stochastic model for the decision-making of an EV aggregator in a competitive electricity market is proposed.Then an equivalent single-level linear formulation based on the Karush-Kuhn-Tucker (KKT) optimality conditions and duality theory is used to combine the upper and lower levels.This concept has been applied to a hub manager problem in [25] and to a retailer problem in [26], previously.Here, this concept is extended to an EV aggregator decision-making problem while considering the reaction of EV owners to the selling prices offered by the aggregator and its rivals.The main contributions of this paper are as follows:

•
Proposing a stochastic bi-level model for the decision making of an EV aggregator in which the profit of the aggregator is maximized in the upper level and the cost paid by the EV owners is minimized in the lower level;

•
Considering the reaction of consumers to the offered selling prices by the aggregators in a competitive environment; • Considering risk aversion measurement to decrease the unfavorable influence of risk in the decision-making program.
The remaining sections of this paper are organized as follows: Section 2 describes the features of the problem; Sections 3 and 4 presents the problem formulation of the decision-making of an EV aggregator as a two-stage stochastic programming model; and Section 5 provides numerical results and discussion.Finally, a relevant conclusion is drawn in Section 6.

Problem Description
In this section the main characteristics of the problem of the decision-making of an EV aggregator in DA and balancing market with considering the EV owners' payments in a competitive environment are described.

Market Framework
The decision-making problem of an EV aggregator is considered as a bi-level problem which involves two optimization parts.In the upper level, the aggregator participates in short-term trading floors to maximize its expected profit from trading energy in the DA market and to minimize the imbalance cost entailed in the balancing market.In the DA market, the energy transaction within the next day is cleared.Then, due to the delay between the ending of the DA market and the time of the energy delivery, correcting actions should be performed to eliminate the differences between the expected and the scheduled consumption that was cleared in the DA market.
In fact, in the balancing market, the deviation between the forecasted demand in DA and the expected one near the real time is compensated.Thereafter, in the lower-level, the EV owners try to minimize their costs by purchasing energy from the aggregator and also from its rivals.
The complexity of the decision-making problem is due to the uncertainty in DA and balancing market prices and EVs' demand.In fact, the aggregator tries to buy energy from the network and sell it to the EV owners such that it maximizes its expected profit.So, the aggregator should offer selling prices to the EV owners such that they do not change their aggregator and go to its rivals and also, the prices should not be too low which leads to lower profits.Figure 1 illustrates the upper and lower levels of the problem.


Considering risk aversion measurement to decrease the unfavorable influence of risk in the decision-making program.
The remaining sections of this paper are organized as follows: Section 2 describes the features of the problem; Section 3 and 4 presents the problem formulation of the decision-making of an EV aggregator as a two-stage stochastic programming model; and section 5 provides numerical results and discussion.Finally, a relevant conclusion is drawn in Section 6.

Problem Description
In this section the main characteristics of the problem of the decision-making of an EV aggregator in DA and balancing market with considering the EV owners' payments in a competitive environment are described.

Market Framework
The decision-making problem of an EV aggregator is considered as a bi-level problem which involves two optimization parts.In the upper level, the aggregator participates in short-term trading floors to maximize its expected profit from trading energy in the DA market and to minimize the imbalance cost entailed in the balancing market.In the DA market, the energy transaction within the next day is cleared.Then, due to the delay between the ending of the DA market and the time of the energy delivery, correcting actions should be performed to eliminate the differences between the expected and the scheduled consumption that was cleared in the DA market.
In fact, in the balancing market, the deviation between the forecasted demand in DA and the expected one near the real time is compensated.Thereafter, in the lower-level, the EV owners try to minimize their costs by purchasing energy from the aggregator and also from its rivals.
The complexity of the decision-making problem is due to the uncertainty in DA and balancing market prices and EVs' demand.In fact, the aggregator tries to buy energy from the network and sell it to the EV owners such that it maximizes its expected profit.So, the aggregator should offer selling prices to the EV owners such that they do not change their aggregator and go to its rivals and also, the prices should not be too low which leads to lower profits.Figure 1 illustrates the upper and lower levels of the problem.

Uncertainty Characterization
When the aggregator wants to participate in a short term trading structure, it may face three sources of uncertainty including: DA prices, positive/negative balancing prices and EVs' demand.
These uncertainties are discretized with scenarios and the vector of stochastic processes is represented as follows: where, λ DA t,ω , λ +,B t,ω , λ −B t,ω and E D t,ω are DA, positive/negative balancing prices and EVs' demand at time t and scenario ω.Each scenario has a probability of occurrence ω, such that the sum of the probabilities over all scenarios is unity: Moreover, it is assumed that the aggregator has a forecast of the expected demand of EVs.In addition, it is considered that EVs' demand is correlated to DA prices.Thus, it is possible to generate EVs demand scenarios as follow [26]: where, λDA t is the expected DA price in period t and ∆ is a parameter representing the relationship between DA price and the EVs' demand in each scenario ω that can be assumed as ∆ = 0.2 [26].Based on the above equation, EVs' demand at time t and scenario w is equal to the sum of the forecasted demand and an additional value that is variable with the DA price.Therefore, EVs' demand at each scenario w is determined based on the DA price at that scenario.
Here, historical data is used to generate DA and balancing price scenarios based on time series.The EVs' demand is also obtained from (1).Then, for the sake of tractability of the problem, the size of the set of DA and positive/negative balancing price scenarios are reduced by scenario-reduction techniques [27].Similarly, rival aggregators' prices are also uncertain sources.The prices offered by rivals are considered as random variables, λ s (ξ), for a finite set of scenarios Ξ where ∑ ξ∈Ξ υ(ξ) = 1.
Scenario ξ = {λ s1 (ξ), λ s2 (ξ), . . ., λ s (ξ)}, s ∈ S Here, the uncertainty associated with the prices offered by the rival aggregators is modeled with Probability Distribution Function (PDF) with the related standard deviation that is used to generate scenarios based on historical forecasting errors.In order to model the forecast inaccuracies stemming from the uncertain nature of offered prices by the rival aggregators, normal PDF is used [25].In this case, the mean values are equivalent to the forecasted values of prices.Then the PDFs are divided into three discrete intervals with different probability levels as illustrated in Figure 2. The forecasted errors which correspond to the mentioned uncertain resources are obtained based on historical forecasting errors.These errors are considered within intervals equal to the standard deviation.
The price forecasting state is centered as the base case and its forecasted errors as the standard deviations are considered with the other intervals.In order to model each probability level associated with the selling prices offered by the rival aggregators, the Roulette Wheel Mechanism (RWM) is used.Each interval throughout the RWM represents a specific forecasting error corresponding to the offered prices by the rivals.Then, the probabilities of the intervals on the Roulette Wheel are normalized such that their summation equals unity.To generate a scenario corresponding to each forecast error of the offered prices, first Monte Carlo simulation is used to generate a random number in the range of [0-1].Each interval on the Roulette Wheel in which the generated random number falls corresponds to a scenario of the rival prices.

Problem Formulation
The problem associated with aggregator's participation in the DA and balancing market is formulated as a bi-level problem as follows.

Upper Level: Aggregator′s Viewpoint
The understudy aggregator participates in the DA and balancing market to maximize its expected profit by supplying EVs' demand.This profit includes the revenue obtained from selling energy to the EV owners and from reducing load based on negative imbalance prices.The upper level problem is presented below: where,  and are the confidence level and auxiliary variable to calculate risk, respectively.Equation ( 2) explains the objective function from the aggregator's perspective in which  is the risk coefficient that keeps the tradeoff between the expected profit and CVaR.Constraint (3) expresses the energy balance in each time period and scenario.Constraints (4) and ( 5) are related to the CVaR term.The EVs' demand that is supplied by the aggregator is considered by equation ( 6).

Problem Formulation
The problem associated with aggregator's participation in the DA and balancing market is formulated as a bi-level problem as follows.

Upper Level: Aggregator's Viewpoint
The understudy aggregator participates in the DA and balancing market to maximize its expected profit by supplying EVs' demand.This profit includes the revenue obtained from selling energy to the EV owners and from reducing load based on negative imbalance prices.The upper level problem is presented below: where, α and ι(ω) are the confidence level and auxiliary variable to calculate risk, respectively.Equation (2) explains the objective function from the aggregator's perspective in which β is the risk coefficient that keeps the tradeoff between the expected profit and CVaR.Constraint (3) expresses the energy balance in each time period and scenario.Constraints (4) and ( 5) are related to the CVaR term.The EVs' demand that is supplied by the aggregator is considered by Equation ( 6).
The non-anticipativity is expressed in (7).The limitation for the energy traded in the positive and negative balancing market is represented in ( 8) and ( 9), respectively.

Lower Level: EV Owners' Viewpoint
The lower-level problem that relates to the decision-making of EV owners and their reaction to the prices offered by all the aggregators is modeled below: The first term in the objective function of the lower-level problem comprises the cost of purchased energy by the EV owners from both the understudy and rival aggregators, and the second term models the reluctance of EV owners to change their aggregator.Constraint (11) discusses the contribution of each aggregator to supply EVs and considers the EVs switching between the aggregators.Equation (12) explains the total expected demand of EVs at each hour and Equation (13) expresses that all of the EVs' demand should be supplied by all of the aggregators.The last two constraints explain the limitation for the variables.
From the upper-level problem, the amount of energy purchased from DA and balancing markets and the selling price offered to the EV owners can be determined.From lower-level problem, the percentage of EVs' demand that will be supplied by the aggregator would be obtained.It should be mentioned that the problem explained above is a nonlinear problem due to the product of terms E ch t,ω and λ ch t,ω in Equations ( 2) and (4).

Single Level Equivalent Linearization
In order to obtain a linearized form of the production of E ch t,ω and λ ch t,ω , the partial derivative of the Lagrangian function of (10) with respect to primal decision variables is considered.In addition to the constraints explained in ( 11)-( 15), the KKT optimality conditions for the lower-level problem are also taken into account.With considering the dual objective function, the lower-level problem is written as follows [26]: Then, the dual objective function and the primal one should be equal as below [26]: Therefore, the Revenue t,ω that is the production of E ch t,ω and λ ch t,ω is linearized as follows [26]: Finally, the bi-level problem explained in ( 2)-( 15) is transformed into an equivalent single-level mixed integer linear programming problem (MILP) including the objective function of the upper-level, the constraints of both levels as well as the equivalent expression of lower-level objective function.In the following, the equivalent single-level MILP problem is represented: Subject to constraints (3)-( 9), ( 10)-( 15) and the relation in ( 21) and the following constraints: where, the ε s (ξ) and φ(ξ) are the dual variables, e X s (ξ) and e Y s,s (ξ) are binary variables and M 1 and M 2 are chosen large enough such that the optimality of the problem would be kept.

Numerical Results and Discussion
In order to illustrate the applicability of the above-presented bi-level model, short-term scheduling for a test case with realistic electricity market prices is considered.

Test Case
The formulation proposed above is tested on a realistic case study based on the electricity market of the Nordpool.The 2016 data for the DA and balancing prices are obtained from [28] and are used to estimate parameters of the auto-regressive integrated moving average (ARIMA) models [29].The ARIMA models are characterized by the number of auto-regressive terms, the differencing order and the number of moving-average terms, respectively.Here, 200 scenarios for DA, positive and negative prices are generated over a 24 h horizon using the error terms from the time-series estimation, as shown in Figures 3-5, respectively.It should be mentioned that the prices are generated for one week, but to show the prices more accurately, only the prices for one day are shown.Also, the dashed blue lines in the Figures 3-6 show the mean of DA, positive and negative prices and EVs' demand, respectively.In this study, it is assumed that EVs charge with domestic chargers.The battery capacity for each EV is 24 kWh and the charging efficiency is 0.9 and it takes about 4 hours to be charged fully [19].The amount of energy that each EV requires depends on its driving profile as well as its trip distance.Also, the final state-of-charge of EVs on the operating day is equal to the initial state-of-charge for the next day due to equal net energy exchange over the scheduling horizon [20].With considering the correlation between EVs' demand and DA prices, the model in [26] is used to generate the EVs' demand scenarios with respect to DA prices.This means each DA scenario provides the EVs' demand scenario that is shown in Figure 6.
In this figure, the uncertainty in driving behavior and energy requirement from the network is represented by different scenarios.Considering the actual number of scenarios may cause computational problems and too few scenarios may yield inaccuracies.So, a proper scenario reduction algorithm is used to omit the low probable and similar scenarios [27], and seven scenarios remained and are applied to the program as entries.
The prices offered by the three rival aggregators are also considered.The forecasted errors are generated in the proposed model through different scenarios.The normal distribution function is used to model the forecasting errors as shown in Figure 2 [27].Here, one segment is centered as the predicted mean that is extracted from [30] and two slices are created to forecast errors with standard deviation δ = 0.15 [23].
The formulation proposed above is tested on a realistic case study based on the electricity market of the Nordpool.The 2016 data for the DA and balancing prices are obtained from [28] and are used to estimate parameters of the auto-regressive integrated moving average (ARIMA) models [29].The ARIMA models are characterized by the number of auto-regressive terms, the differencing order and the number of moving-average terms, respectively.Here, 200 scenarios for DA, positive and negative prices are generated over a 24 h horizon using the error terms from the time-series estimation, as shown in Figures 3-5, respectively.It should be mentioned that the prices are generated for one week, but to show the prices more accurately, only the prices for one day are shown.Also, the dashed blue lines in the Figures 3-6 show the mean of DA, positive and negative prices and EVs' demand, respectively.In this study, it is assumed that EVs charge with domestic chargers.The battery capacity for each EV is 24 kWh and the charging efficiency is 0.9 and it takes about 4 hours to be charged fully [19].The amount of energy that each EV requires depends on its driving profile as well as its trip distance.Also, the final state-of-charge of EVs on the operating day is equal to the initial state-of-charge for the next day due to equal net energy exchange over the scheduling horizon [20].With considering the correlation between EVs' demand and DA prices, the model in [26] is used to generate the EVs' demand scenarios with respect to DA prices.This means each DA scenario provides the EVs' demand scenario that is shown in Figure 6.
In this figure, the uncertainty in driving behavior and energy requirement from the network is represented by different scenarios.Considering the actual number of scenarios may cause computational problems and too few scenarios may yield inaccuracies.So, a proper scenario reduction algorithm is used to omit the low probable and similar scenarios [27], and seven scenarios remained and are applied to the program as entries.
The prices offered by the three rival aggregators are also considered.The forecasted errors are generated in the proposed model through different scenarios.The normal distribution function is used to model the forecasting errors as shown in Figure 2 [27].Here, one segment is centered as the predicted mean that is extracted from [30] and two slices are created to forecast errors with standard deviation       The bi-level stochastic programming problem is formulated as an equivalent MILP problem and solved with CPLEX in the GAMS software environment [31] on a computer with 4 GBs of RAM and Ci5 CPU.

Simulations and Discussion
In this study, risk aversion is considered in the form of CVaR weights.Figure 2 shows the cumulative distribution functions of the scenario profits plotted for different levels of β.In order to prevent data crowding in the figure, only four βs are selected to show the cumulative distribution    The bi-level stochastic programming problem is formulated as an equivalent MILP problem and solved with CPLEX in the GAMS software environment [31] on a computer with 4 GBs of RAM and Ci5 CPU.

Simulations and Discussion
In this study, risk aversion is considered in the form of CVaR weights.Figure 2 shows the cumulative distribution functions of the scenario profits plotted for different levels of β.In order to prevent data crowding in the figure, only four βs are selected to show the cumulative distribution The cost of modeling the reluctance of EV owners to change their aggregator is neglected (K s,s = 0) and the initial EVs' demand supplied by all aggregators is generated randomly.The maximum limitation for positive balancing energy is equal to the maximum rate of charging for each EV battery that is 3.6 kWh.The value of α is 0.95.
The bi-level stochastic programming problem is formulated as an equivalent MILP problem and solved with CPLEX in the GAMS software environment [31] on a computer with 4 GBs of RAM and Ci5 CPU.

Simulations and Discussion
In this study, risk aversion is considered in the form of CVaR weights.Figure 7 shows the cumulative distribution functions of the scenario profits plotted for different levels of β.In order to prevent data crowding in the figure, only four βs are selected to show the cumulative distribution function of profits for all scenarios at hour 4:00.At this time the DA prices are too low and as a result, the aggregator can economically supply the EVs.It is observed that with increasing risk aversion (increasing β), the worst scenarios are eliminated.Also, it shows that with increasing risk aversion, the profits which are far from the mean profit are ignored.This implies that when the CVaR concept is modeled, lower-profit scenarios with a low probability are not considered in the decision-making process.In fact, CVaR results in an average value with a higher probability and a lower variance with respect to the cases with the lowest risk aversion factor (β = 0.1).It can be observed that with increasing β and improvements in the lower tail of the distribution and omitting the worst scenarios with lower probabilities, the cumulative distribution function has higher values.Also, with increasing β, the upper profits with high probabilities are also omitted and the scenarios which are near the expected profit would remain.That is why the cumulative function for higher risk aversion factor reaches 1 before the other curves.
with respect to the cases with the lowest risk aversion factor (β = 0.1).It can be observed that with increasing β and improvements in the lower tail of the distribution and omitting the worst scenarios with lower probabilities, the cumulative distribution function has higher values.Also, with increasing β, the upper profits with high probabilities are also omitted and the scenarios which are near the expected profit would remain.That is why the cumulative function for higher risk aversion factor reaches 1 before the other curves.Figure 8 depicts the variation of expected profits for the whole day against their corresponding CVaR for different values of β.The efficient frontier illustrates how the risk averse EV aggregator can trade off in the electricity market for different levels of β.It is observed that with increasing the risk aversion weighting factor, the expected profit decreases and CVaR increases.This means that as the aggregator becomes more risk averse, its expected profit decreases.Also it shows that beyond a critical β (i.e., beyond β = 10), the expected profit decreases significantly.Moreover, negative CVaR indicates there is negative profit in some of the scenarios.With increasing risk aversion factor, these undesired scenarios are ignored.Figure 7 shows that with increasing values of β, negative scenarios are eliminated; this means that with increasing β, profits in the scenarios become more positive, because when it hedges against volatilities, the profits that are far from the mean profit would be ignored.In other words, lower profit scenarios with low probabilities would be eliminated.Therefore, the expected profit for the all hours of the day would be reduced.
Figure 9 illustrates the expected profit versus its standard deviation for different values of β.It is observed that with increasing β, since low profit scenarios are not considered, the profit volatility decreases.So, the standard deviation associated with profit scenarios reduces.In other words, a conservative aggregator prefers minimizing risk; therefore, it chooses a large value of β to increase the weight of the risk aversion in the objective function.In contrast, a non-conservative aggregator might be willing to obtain a higher profit, hence it selects values for β close to 0.
In order to assess the effect of risk aversion on the purchased power by the aggregator, Table 1 represents the expected DA, positive and negative procurements in different values of β.It should be mentioned that a higher risk aversion weighting factor leads to a decrease in the DA purchases such that less negative and more positive balancing is provided.These results are consistent with the results provided in [4,18].It has to be mentioned that the strong shift from DA into the balancing market is because of the assumption of full insight of balancing market prices within the 24 h.When future markets and contracts are not considered, the aggregator can control risk only by participation in the DA and balancing markets.It should be noted that DA procurements are made Figure 8 depicts the variation of expected profits for the whole day against their corresponding CVaR for different values of β.The efficient frontier illustrates how the risk averse EV aggregator can trade off in the electricity market for different levels of β.It is observed that with increasing the risk aversion weighting factor, the expected profit decreases and CVaR increases.This means that as the aggregator becomes more risk averse, its expected profit decreases.Also it shows that beyond a critical β (i.e., beyond β = 10), the expected profit decreases significantly.Moreover, negative CVaR indicates there is negative profit in some of the scenarios.With increasing risk aversion factor, these undesired scenarios are ignored.Figure 7 shows that with increasing values of β, negative scenarios are eliminated; this means that with increasing β, profits in the scenarios become more positive, because when it hedges against volatilities, the profits that are far from the mean profit would be ignored.In other words, lower profit scenarios with low probabilities would be eliminated.Therefore, the expected profit for the all hours of the day would be reduced.under uncertainty, while balancing purchases are made with awareness of prices.Also, when the aggregator takes part in the balancing market, it has a perfect knowledge of EVs' energy requests and their availability.It is observed that with increasing β, since low profit scenarios are not considered, the profit volatility decreases.So, the standard deviation associated with profit scenarios reduces.In other words, a conservative aggregator prefers minimizing risk; therefore, it chooses a large value of β to increase the weight of the risk aversion in the objective function.In contrast, a non-conservative aggregator might be willing to obtain a higher profit, hence it selects values for β close to 0.
In order to assess the effect of risk aversion on the purchased power by the aggregator, Table 1 represents the expected DA, positive and negative procurements in different values of β.It should be mentioned that a higher risk aversion weighting factor leads to a decrease in the DA purchases such that less negative and more positive balancing is provided.These results are consistent with the results provided in [4,18].It has to be mentioned that the strong shift from DA into the balancing market is because of the assumption of full insight of balancing market prices within the 24 h.When future markets and contracts are not considered, the aggregator can control risk only by participation in the DA and balancing markets.It should be noted that DA procurements are made under uncertainty, while balancing purchases are made with awareness of prices.Also, when the aggregator takes part in the balancing market, it has a perfect knowledge of EVs' energy requests and their availability.For a detailed discussion and elaboration of the DA and balancing purchases, the expected procurements during the whole day are assessed.Figures 10-12 illustrate the expected DA, positive and negative supplements at each hour during a given day, respectively.During midnight and early in the morning, EV owners usually connect their vehicles to the network to charge them for the next work-day hours.Since, at this time the DA prices are very low, the aggregator purchases a high amount of DA energy.Accordingly, less energy is purchased in the positive balancing market, since the aggregator bought high quantities of energy in the DA market, so it is not required to purchase a high bulk of energy from positive balancing.Also, it can be a good source of revenue for the aggregator to participate in negative balancing market such that it encourages the EV owners to decrease their demand, (i.e., unplug their vehicles or shift the charging of their EVs to other hours).From 7:00 to 21:00, when the predicted EVs' demand is lower than the other hours, the aggregator decides to participate in the positive balancing market to supply EVs during this operating period.Table 1.Total expected energy (MWh) traded by the aggregator in DA and balancing markets.For a detailed discussion and elaboration of the DA and balancing purchases, the expected procurements during the whole day are assessed.Figures 10-12 illustrate the expected DA, positive and negative supplements at each hour during a given day, respectively.During midnight and early in the morning, EV owners usually connect their vehicles to the network to charge them for the next work-day hours.Since, at this time the DA prices are very low, the aggregator purchases a high amount of DA energy.Accordingly, less energy is purchased in the positive balancing market, since the aggregator bought high quantities of energy in the DA market, so it is not required to purchase a high bulk of energy from positive balancing.Also, it can be a good source of revenue for the aggregator to participate in negative balancing market such that it encourages the EV owners to decrease their demand, (i.e., unplug their vehicles or shift the charging of their EVs to other hours).From 7:00 to 21:00, when the predicted EVs' demand is lower than the other hours, the aggregator decides to participate in the positive balancing market to supply EVs during this operating period.Moreover, the aggregator can deal economically with this low amount of demand in joint DA and positive markets.However, from 19:00 to 21:00, the EVs' demand increases, so the aggregator purchases more energy from the positive market to meet their energy requirements.During these hours, it participates in negative balancing to obtain some profits from load decrements.After 22:00, there are many EV owners who want to charge their EVs for the next day; so the aggregator participates in the DA market to buy energy.In this regard, it purchases less energy from the positive balancing market.Also, the aggregator is paid based on the negative balancing price to decrease its demand.It should be mentioned that negative prices fluctuate more than the positive ones, because the aggregators should be encouraged to decrease their demand based on that.
there are many EV owners who want to charge their EVs for the next day; so the aggregator participates in the DA market to buy energy.In this regard, it purchases less energy from the positive balancing market.Also, the aggregator is paid based on the negative balancing price to decrease its demand.It should be mentioned that negative prices fluctuate more than the positive ones, because the aggregators should be encouraged to decrease their demand based on that.
Generally, the expected DA and balancing procurements during the day also demonstrate that increment of risk factor leads to lower participation in the DA and negative balancing energy trading floor and higher positive balancing purchases at each hour.there are many EV owners who want to charge their EVs for the next day; so the aggregator participates in the DA market to buy energy.In this regard, it purchases less energy from the positive balancing market.Also, the aggregator is paid based on the negative balancing price to decrease its demand.It should be mentioned that negative prices fluctuate more than the positive ones, because the aggregators should be encouraged to decrease their demand based on that.
Generally, the expected DA and balancing procurements during the day also demonstrate that increment of risk factor leads to lower participation in the DA and negative balancing energy trading floor and higher positive balancing purchases at each hour.there are many EV owners who want to charge their EVs for the next day; so the aggregator participates in the DA market to buy energy.In this regard, it purchases less energy from the positive balancing market.Also, the aggregator is paid based on the negative balancing price to decrease its demand.It should be mentioned that negative prices fluctuate more than the positive ones, because the aggregators should be encouraged to decrease their demand based on that.
Generally, the expected DA and balancing procurements during the day also demonstrate that increment of risk factor leads to lower participation in the DA and negative balancing energy trading floor and higher positive balancing purchases at each hour.Generally, the expected DA and balancing procurements during the day also demonstrate that increment of risk factor leads to lower participation in the DA and negative balancing energy trading floor and higher positive balancing purchases at each hour.
Figure 13 shows the expected values of the selling prices offered by the rivals with spotted lines and the price signal offered by the understudy aggregator with a solid line at each hour of the day.The rivals' prices shown in this figure are the expected values of the considered scenarios that are generated based on normal PDF as explained in Section 2.2.Moreover, the price signal offered by the understudy aggregator is obtained based on the optimization problem.As can be seen, from 1:00 to 2:00, because the demand is high and the DA and positive balancing prices are relatively high, the aggregator buys a low amount of energy from these markets.Also, the negative price that should be paid due to the load reduction is low.Therefore, the aggregator would not obtain substantial profit from taking part in the negative balancing market.So, it offers high prices to avoid profit losses.From 3:00 to 6:00 and 21:00 to 24:00, the understudy aggregator offers lower prices because it buys the energy from the DA market at lower price rates.During these hours, the aggregator manages to provide a high amount of energy from DA to benefit from low prices (see Figure 10).Moreover, during the working period (i.e., 7:00-21:00), as mentioned before, the aggregator mostly participates in the positive balancing market.Also, the aggregator participates in the negative balancing market and obtains adequate revenues due to the load reduction.So, its low offered price would be compensated with the earnings from the negative balancing market.In the working period, although it purchases energy with higher prices, it suggests cheap selling prices to keep its clients and compete against its rivals, especially aggregators 1 and 2, which offer low prices in this period.Also, during this period, the aggregator participates in the negative balancing market and could achieve some money due to load decrement.In this period, although the negative balancing prices are high, the aggregator does not participate in the negative balancing market, since the requested load is low.generated based on normal PDF as explained in Section 2.2.Moreover, the price signal offered by the understudy aggregator is obtained based on the optimization problem.As can be seen, from 1:00 to 2:00, because the demand is high and the DA and positive balancing prices are relatively high, the aggregator buys a low amount of energy from these markets.Also, the negative price that should be paid due to the load reduction is low.Therefore, the aggregator would not obtain substantial profit from taking part in the negative balancing market.So, it offers high prices to avoid profit losses.
From 3:00 to 6:00 and 21:00 to 24:00, the understudy aggregator offers lower prices because it buys the energy from the DA market at lower price rates.During these hours, the aggregator manages to provide a high amount of energy from DA to benefit from low prices (see Figure 10).Moreover, during the working period (i.e., 7:00-21:00), as mentioned before, the aggregator mostly participates in the positive balancing market.Also, the aggregator participates in the negative balancing market and obtains adequate revenues due to the load reduction.So, its low offered price would be compensated with the earnings from the negative balancing market.In the working period, although it purchases energy with higher prices, it suggests cheap selling prices to keep its clients and compete against its rivals, especially aggregators 1 and 2, which offer low prices in this period.Also, during this period, the aggregator participates in the negative balancing market and could achieve some money due to load decrement.In this period, although the negative balancing prices are high, the aggregator does not participate in the negative balancing market, since the requested load is low.The EVs' demand supplied by the aggregators during the whole day is illustrated in Figure 14.It is observed that when the rivals offer lower prices and the price offered by the understudy aggregator is high (i.e., 1:00-2:00), the total demand is supplied by other rivals.On the other hand, at hours that the aggregator's price is the lowest value (3:00 to 6:00 and 21:00 to 24:00), the total demand is supplied by the understudy aggregator.The EVs' demand supplied by the aggregators during the whole day is illustrated in Figure 14.It is observed that when the rivals offer lower prices and the price offered by the understudy aggregator is high (i.e., 1:00-2:00), the total demand is supplied by other rivals.On the other hand, at hours that the aggregator's price is the lowest value (3:00 to 6:00 and 21:00 to 24:00), the total demand is supplied by the understudy aggregator.
understudy aggregator is obtained based on the optimization problem.As can be seen, from 1:00 to 2:00, because the demand is high and the DA and positive balancing prices are relatively high, the aggregator buys a low amount of energy from these markets.Also, the negative price that should be paid due to the load reduction is low.Therefore, the aggregator would not obtain substantial profit from taking part in the negative balancing market.So, it offers high prices to avoid profit losses.
From 3:00 to 6:00 and 21:00 to 24:00, the understudy aggregator offers lower prices because it buys the energy from the DA market at lower price rates.During these hours, the aggregator manages to provide a high amount of energy from DA to benefit from low prices (see Figure 10).Moreover, during the working period (i.e., 7:00-21:00), as mentioned before, the aggregator mostly participates in the positive balancing market.Also, the aggregator participates in the negative balancing market and obtains adequate revenues due to the load reduction.So, its low offered price would be compensated with the earnings from the negative balancing market.In the working period, although it purchases energy with higher prices, it suggests cheap selling prices to keep its clients and compete against its rivals, especially aggregators 1 and 2, which offer low prices in this period.Also, during this period, the aggregator participates in the negative balancing market and could achieve some money due to load decrement.In this period, although the negative balancing prices are high, the aggregator does not participate in the negative balancing market, since the requested load is low.The EVs' demand supplied by the aggregators during the whole day is illustrated in Figure 14.It is observed that when the rivals offer lower prices and the price offered by the understudy aggregator is high (i.e., 1:00-2:00), the total demand is supplied by other rivals.On the other hand, at hours that the aggregator's price is the lowest value (3:00 to 6:00 and 21:00 to 24:00), the total demand is supplied by the understudy aggregator.However, in the working period, the aggregator contributes to supply a high portion of demand.As it is observed, rivals 1 and 3 supply the demand only in some of the hours.Generally, it should be noted that EV owners select the most competitive aggregator to purchase energy which leads the aggregator to compete against other aggregators that offer similar services.

Conclusions
A bi-level framework for the problem of decision-making by an EV aggregator in a competitive environment was proposed in this paper.The problem was formulated such that the aggregator and the EV owners were placed in the upper and the lower level, respectively.The bi-level nonlinear stochastic model was transformed into the linear single-level using the KKT optimality and the strong duality condition.The EV aggregator offered selling prices in an uncertain environment to compete against its rivals.The risk aversion of the EV aggregator was modeled by the CVaR of the profit.The results showed that when the aggregator becomes more risk averse, it decreases its DA purchases and increases the positive balancing procurements as well as reduces its participation in the negative balancing market.This is because of the uncertainties in the DA market but perfect knowledge of prices when reaching to the real time.Moreover, the EV owners choose the lowest electricity prices and shift between the aggregators in order to minimize their costs.Additionally, the effect of risk aversion was assessed and the results showed that ignoring the influence of unwilling scenarios caused the decrement of profit volatility and reduction of its standard deviation.

Conflicts of Interest:
The authors declare no conflict of interest.

Figure 1 .
Figure 1.Bi-level framework of the problem.

Figure 1 .
Figure 1.Bi-level framework of the problem.

Figure 2 .
Figure 2. The probablity density function corresponding to the forecasted errors of rival aggregators′ prices.

Figure 2 .
Figure 2. The probablity density function corresponding to the forecasted errors of rival aggregators' prices.

Figure 4 .
Figure 4. Scenarios and mean of positive imbalance price.

Figure 4 .
Figure 4. Scenarios and mean of positive imbalance price.

Figure 5 .
Figure 5. Scenarios and mean of negative imbalance price.

Figure 5 .
Figure 5. Scenarios and mean of negative imbalance price.

Figure 4 .
Figure 4. Scenarios and mean of positive imbalance price.

Figure 5 .
Figure 5. Scenarios and mean of negative imbalance price.

Figure 8 .
Figure 8. Variation of expected profit and conditional value at risk with varying β.

Figure 9 .
Figure 9. Expected profit versus profit standard deviation for different levels of β.

Figure 8 .
Figure 8. Variation of expected profit and conditional value at risk with varying β.

Figure 9
Figure9illustrates the expected profit versus its standard deviation for different values of β.It is observed that with increasing β, since low profit scenarios are not considered, the profit volatility decreases.So, the standard deviation associated with profit scenarios reduces.In other words, a conservative aggregator prefers minimizing risk; therefore, it chooses a large value of β to increase the weight of the risk aversion in the objective function.In contrast, a non-conservative aggregator might be willing to obtain a higher profit, hence it selects values for β close to 0.In order to assess the effect of risk aversion on the purchased power by the aggregator, Table1represents the expected DA, positive and negative procurements in different values of β.It should be mentioned that a higher risk aversion weighting factor leads to a decrease in the DA purchases such that less negative and more positive balancing is provided.These results are consistent with the results provided in[4,18].It has to be mentioned that the strong shift from DA into the balancing market is because of the assumption of full insight of balancing market prices within the 24 h.

Figure 8 .
Variation of expected profit and conditional value at risk with varying β.

Figure 9 .
Figure 9. Expected profit versus profit standard deviation for different levels of β.

Figure 9 .
Figure 9. Expected profit versus profit standard deviation for different levels of β.

Figure 10 .
Figure 10.Expected DA procurement for different levels of β.

Figure 11 .
Figure 11.Expected positive balancing procurement for different levels of β.

Figure 12 .
Figure 12.Expected negative balancing procurement for different levels of β.

Figure 13 Figure 10 .
Figure13shows the expected values of the selling prices offered by the rivals with spotted lines and the price signal offered by the understudy aggregator with a solid line at each hour of the day.The rivals' prices shown in this figure are the expected values of the considered scenarios that are

Figure 10 .
Figure 10.Expected DA procurement for different levels of β.

Figure 11 .
Figure 11.Expected positive balancing procurement for different levels of β.

Figure 12 .
Figure 12.Expected negative balancing procurement for different levels of β.

Figure 13 Figure 11 .
Figure13shows the expected values of the selling prices offered by the rivals with spotted lines and the price signal offered by the understudy aggregator with a solid line at each hour of the day.The rivals' prices shown in this figure are the expected values of the considered scenarios that are

Figure 10 .
Figure 10.Expected DA procurement for different levels of β.

Figure 11 .
Figure 11.Expected positive balancing procurement for different levels of β.

Figure 12 .
Figure 12.Expected negative balancing procurement for different levels of β.

Figure 13 Figure 12 .
Figure13shows the expected values of the selling prices offered by the rivals with spotted lines and the price signal offered by the understudy aggregator with a solid line at each hour of the day.The rivals' prices shown in this figure are the expected values of the considered scenarios that are

Figure 3 .
Figure 3. Price offered to the EV owners by the aggregators.

Figure 14 .
Figure 14.EVs' demand share during the whole day.

Figure 13 .
Figure 13.Price offered to the EV owners by the aggregators.

Figure 3 .
Figure 3. Price offered to the EV owners by the aggregators.

Figure 14 .
Figure 14.EVs' demand share during the whole day.

Figure 14 .
Figure 14.EVs' demand share during the whole day.

Table 1 .
Total expected energy (MWh) traded by the aggregator in DA and balancing markets.

Table 1 .
Total expected energy (MWh) traded by the aggregator in DA and balancing markets.
Cost to model the reluctance of EV owners for shifting between the aggregators (€) X s (ξ) Percentage of EVs supplied by rival aggregators in scenario ξ X s0 (ξ) Percentage of EVs' demand supplied by the aggregator Z S,S (ξ) Percentage of EVs shifted between the aggregators Total demand of EVs at time t and scenario ω Day-ahead price at time t and scenario ω λDA Number of scenarios for DA price, balancing market price and Evs' demand Ξ Number of rival aggregator scenarios t Expected day ahead price at time t υ(ξ) Probability of occurrence of prices offered by rival aggregators in scenario ξ α Confidence level for calculation of CVaR β Risk factor ∆ The parameter to show the relationship between the EVs' demand and DA prices