**1. Introduction**

Energy production has been essentially based on non-renewable sources, i.e., from fossil fuels, resulting in increased anthropogenic gas emissions. Among the sectors of the economy, the transport sector has a weight of about 15% in global emissions [1]. Likewise, the transport sector is responsible for more than 28% of the energy consumed in most countries [2]. To reduce greenhouse gas emissions, electric vehicle adoption has been discussed worldwide [3,4]. The market share of electric vehicles remains low since the higher acquisition cost of electric vehicles compared to conventional vehicles is one of the important barriers to adoption [3]. Policy incentives for the acquisition of electric vehicles include financial incentives and non-financial incentives [3]. Financial incentives include direct purchasing subsidies, and registration/emission/tax fee exemptions, which are the most widely used incentives to lower the high initial purchasing cost [3]. Non-financial incentives are designed for the convenience of electric vehicle owners, including free parking policies, and toll tax exemptions [3]. The power system perceives the integration of a large number of electric vehicles as a threat and the electricity market participants perceive this integration as an opportunity to consider electric

vehicles as a new source of energy in the electricity market [5]. Therefore, in the coming years, with the increase in electric vehicles in the power system, aggregating agents tend to play an important role as intermediaries among the owners of electric vehicles, the electricity market, distribution system operators, and transmission system operators [6]. Ref. [7] presents one of the most important works regarding the role of electric vehicle aggregators in electricity markets. The trading of energy in electricity markets is a well-studied subject [8–14]. Ref. [8] proposes an aggregation platform for wind, photovoltaic, and thermal power in electricity markets. Ref. [9,12] present the stochastic coordination of joint wind and photovoltaic systems in the day-ahead market. Ref. [10] proposes the coordination of wind power, photovoltaic power, and energy storage. Ref. [11] proposes the analysis of the impact of dust on photovoltaic systems in aggregation with wind and thermal power. Ref. [13] presents the self-scheduling and bidding strategies of thermal units with stochastic emission constraints. Ref. [14] proposes the bidding strategy of wind–thermal energy producers.

In recent years, the participation of electric vehicle aggregators in electricity markets has been gaining attention among researchers and market players. Electric vehicles management has been proposed according to two different approaches: considering unidirectional charging [15], i.e., grid-to-vehicle; and considering bidirectional charging [16], vehicle-to-grid (V2G). The development of management systems for the management of electric vehicles in electricity markets is divided into two main groups: group 1 studies electric vehicles as deterministic units [17–19], suggesting the absence of uncertain characteristics; group 2 studies electric vehicles as stochastic units [17–25], suggesting the consideration of uncertain characteristics. Ref. [17] presents a mechanism to determine the two-way energy storage of a large pool of electric vehicles that can be contracted in the ancillary services market on a long-term basis to provide the regulation up and regulation down to the grid. Ref. [18] proposes an algorithm for an electric vehicle aggregator providing unidirectional V2G regulation. Ref. [20] proposes a bidding strategy for an electric vehicle aggregator that participates in the day-ahead market. The problem is formulated using stochastic robust optimization, considering uncertainty in day-ahead market prices, and driving requirements of electric vehicles. Ref. [21] investigates the application of stochastic dynamic programming to the optimization of charging and frequency regulation capacity bids of an electric vehicle in a smart grid [26,27]. Ref. [22] presents an optimal bidding strategy of an electric vehicle aggregator participating in day-ahead energy and regulation markets using stochastic optimization. Ref. [23] proposes a stochastic optimization model for optimal bidding strategies of electric vehicle aggregators in day-ahead and ancillary services markets with variable wind energy. Ref. [24] proposes the optimal scheduling of plug-in electric vehicle aggregators in the electricity market considering as uncertain parameters market prices, availability of electric vehicles, and status of being called in the reserve market. Ref. [25] proposes a two-stage stochastic optimization problem for optimally coordinated bidding of an electric vehicle in the day-ahead, intra-day and real-time markets. The formulation also includes risk management with the hourly conditional value at risk. Ref. [28] presents the bidding strategy for electric vehicle aggregators participating in the day-ahead market. Ref. [29] proposes the problem of decision making on an electric vehicle aggregator in a competitive market in the presence of different uncertain resources. The problem is formulated using stochastic programming. Ref. [30] proposes a stochastic programming problem for the scheduling of electric vehicle aggregators in the day-ahead market. The main contribution of this paper is the consideration of the level of flexibility of the owners of vehicles. Flexibility is the consent regarding electricity usage for charge/discharge to a practice stated by the aggregator, allowing the aggregator to obtain a higher expected profit than the one in the case of the inflexibility of owners. This contribution allows further improvement in the management of the aggregator and is an extension of the scope of the work in [5] addressing only inflexible owners.

## **2. Assumptions**

This paper considers a set of assumptions: (1) the aggregator is the intermediate entity between the owners of electric vehicles and the electricity market; (2) the parties agree on the inflexibility or flexibility for the electricity usage, so the aggregator is only empowered to carry out operation planning with the owners' authorization; (3) the aggregator is responsible for the degradation of vehicles when in the process of charging or discharging, in which the cost is paid to the owners of electric vehicles; (4) the owners of electric vehicles pay back to the aggregator the cost of the degradation due to the demand for energy for driving; (5) the owners of electric vehicles are penalized with the respective cost of the degradation of the vehicles, when a violation occurs on the schedule given by aggregator for charge or discharge of energy; (6) the market gives aggregators a premium for the participation of electric vehicles in the electricity market, through a special price in the purchase of energy, in order to stimulate the purchase of electric vehicles and their participation in the electricity market and in a wider energy matrix; (7) through an agreement between the parties, the profit obtained from participation in the electricity market can be divided between the aggregator and the owners of electric vehicles.

#### **3. Problem Formulation**

The current wholesale markets do not allow small agents to participate in the market, due to minimal power requirements, for example, in Nord Pool, the minimum bid size in the day-ahead market is 1 MW. So, a single electric vehicle is not allowed to participate in the market, but a fleet of electric vehicles satisfying minimal power requirements can be in a market through an aggregator. The electric vehicles are considered in this paper as non-stationary energy storage devices. The aggregator's functions are: (1) the management of charges and discharges in periods where the vehicles are available, by agreement with the owners of the vehicles; (2) to be an intermediary agent between the owners of electric vehicles and the electricity market; (3) present profitable offers for the purchase and sale of energy in the day-ahead market; (4) to manage the charges and discharges to reduce the degradation of the batteries of electric vehicles. The aggregator's main objective in participating in the market is the maximization of profit, subjected to constraints as follows:

$$\max \sum\_{s=1}^{N\_S} \sum\_{t=1}^{N\_T} \frac{1}{N\_S} \left( \lambda\_{st}^{DA} P\_{st}^D - \lambda\_{st}^{DA\*} P\_{st}^C + \zeta E\_{st}^R - \mathcal{C}\_{st}^{D \text{eff}} \right) \tag{1}$$

Subject to:

$$\underline{P^D} \sigma\_{st}^D \le P\_{st}^D \le \overline{P^D} \sigma\_{st}^D \,\forall \, s\_\prime \,\,\forall t \tag{2}$$

$$\underline{P^C} \sigma\_{st}^{\mathbb{C}} \le P\_{st}^{\mathbb{C}} \le \overline{P^C} \sigma\_{st}^{\mathbb{C}} \,\forall s\_{\prime} \,\,\forall t \tag{3}$$

$$0 \le \sigma\_{st}^D \le \sigma\_{st}^A \,\forall s\_\prime \,\,\forall t \tag{4}$$

$$0 \le \sigma\_{st}^C \le \sigma\_{st}^A \,\,\forall s\_\prime \,\,\forall t \tag{5}$$

$$
\sigma\_{\rm st}^{D} + \sigma\_{\rm st}^{\mathbb{C}} \le \sigma\_{\rm st}^{A} \,\,\forall \mathbf{s}\_{\prime} \,\,\forall \mathbf{t} \tag{6}
$$

$$\text{SoC.st} = \text{SoC}\_{st-1} + \frac{\eta^C P\_{st}^C}{\overline{E}} - \frac{P\_{st}^D}{\overline{E}\eta^D} - \frac{E\_{st}^R}{\overline{E}} \,\forall s\_\prime \,\,\forall t \tag{7}$$

$$
\underline{\operatorname{SoC}} \le \operatorname{SoC}\_{st} \le \overline{\operatorname{SoC}} \,\forall \, \mathrm{s}, \,\,\forall t \tag{8}
$$

$$P\_{\rm st}^{D} - P\_{\rm s't}^{D} \le 0 \; : \; \lambda\_{\rm s't}^{DA} \ge \lambda\_{\rm st}^{DA} \; \forall s, s' \; \; \forall t \tag{9}$$

$$P\_{st}^C - P\_{s't}^C \le 0: \ \lambda\_{st}^{DA} \ge \lambda\_{s't}^{DA} \text{ } \forall s\_\prime s', \ \forall t \tag{10}$$

$$P\_{\rm st}^{D} = P\_{\rm s't}^{D} \; ; \; \lambda\_{\rm s't}^{DA} = \lambda\_{\rm st}^{DA} \; \forall \mathbf{s}, \mathbf{s'} \; \; \forall \mathbf{t} \tag{11}$$

$$P\_{st}^C = P\_{s't}^C \; ; \; \lambda\_{s't}^{DA} = \lambda\_{st}^{DA} \; \forall s \; s' \; \; \forall t \tag{12}$$

In (1), the objective function is the aggregator's expected profit, with the following terms: (1) revenue from sales offers in the day-ahead market, as a result of electric vehicle discharges, where λ*DA st* is the day-ahead market price and *PD st* is the sale offer/discharge power; (2) cost of purchase

<sup>o</sup>ffers in the day-ahead market, as a result of charging electric vehicles, where <sup>λ</sup>*DA*<sup>∗</sup> *st* is a V2G tariff to encourage the electric vehicle owners to operate in V2G mode and *PC st* is the purchase offer/charge power; (3) revenue from the energy consumed by the owners of electric vehicles, where ζ is the price for driving requirements and *ER st* is the energy consumed for driving requirements; and (4), the cost of battery degradation of electric vehicles given by *CDeg st* . In (2), the technical limits of operation are presented for the sale offer/discharge power, where *PD* and *PD* are the minimum and maximum discharge power, respectively. In (3), the technical limits of operating limits are presented for the purchase offer/charge power, where *PC* and *PC* are the minimum and maximum charge power, respectively. In (2) and (3), σ*<sup>D</sup> st* and <sup>σ</sup>*<sup>C</sup> st* are the binary variables that model the discharge and charge cycles of electric vehicles, respectively. In (4) and (5), maximum and minimum values of the binary variables are presented, where σ*<sup>A</sup> st* is the availability parameter of electric vehicles (0/1 parameter). In (6), it is imposed that electric vehicle batteries cannot charge and discharge at the same time. According to the fleet being available, there are two events imposed to be feasible and one event imposed to be feasible for the fleet being unavailable: (σ*<sup>A</sup> st* = 1; <sup>σ</sup>*<sup>D</sup> st* <sup>=</sup> 1, <sup>σ</sup>*<sup>C</sup> st* = 0) is event\_1, available for discharge; (σ*<sup>A</sup> st* <sup>=</sup> 1; <sup>σ</sup>*<sup>D</sup> st* <sup>=</sup> 0, <sup>σ</sup>*<sup>C</sup> st* <sup>=</sup> 1) is event\_2, available for charge; (σ*<sup>A</sup> st* <sup>=</sup> 0; <sup>σ</sup>*<sup>D</sup> st* <sup>=</sup> 0, <sup>σ</sup>*<sup>C</sup> st* = 0) is event\_3, in which discharge or charge is unavailable. In (7), the equation of state of charge of the electric vehicle battery equation is presented, where *SoCst* is the state of charge, η*C*/η*<sup>D</sup>* is the charge/discharge efficiency and *E* is the maximum capacity of the battery of electric vehicles. In (8), *SoC* and *SoC* are the minimum and maximum values of the state of charge variable, respectively. In (9), it is imposed that the offering curves for the sale offer increase monotonically, where *PD <sup>s</sup><sup>t</sup>* is the power discharge of a specific scenario and *s s* . In (10), it is imposed that the offering curves for the purchase offer decrease monotonically, where *PC <sup>s</sup><sup>t</sup>* is the power charge of a specific scenario and *s s* . Regarding (9) and (10), once the market participants submit their offering curves for sales offers and offering curves for purchase offers, the market operator clears the day-ahead market and publishes the market-clearing price of the day-ahead market and the accepted offers. In (11) and (12), non-anticaptivity constraints are imposed. With these constraints, only one offering curve can be submitted to the day-ahead market for each hour irrespective of the driving requirement realizations. The expression to compute the battery degradation is as follows [31]:

$$\mathbf{C}\_{st}^{Deg} = \left| \frac{m}{100} \right| \left( \frac{P\_{st}^C + P\_{st}^D - E\_{st}^R}{\overline{E}} \right) \mathbf{C}^B \tag{13}$$

In (13), *m* is the parameter for the relationship of the cost incurred with the reduction in useful life due to charge or discharge of the battery [31] and *CB* is the cost of batteries for electric vehicles. The extra cost of degradation incurred by charge or discharge processes due to the aggregator management decisions is paid to the electric vehicle owners. This cost is given by the total cost of degradation minus the cost of degradation incurred by the owner driving requirement since the energy used in driving is the one stored by charging.

## **4. Uncertainty Modeling**
