*4.2. Scenario Reduction*

The 1000 scenarios generated for each parameter in the previous section are reduced to 10 by applying the *K*-means scenario reduction technique. The *K*-means technique identifies clusters of scenarios that show considerable similarity; determining a scenario represents clusters of scenarios while maintaining relevant information for optimal decision-making. The *K*-means technique is relatively easy to implement, having broad convergence, and can be adapted to larger data sets. The objective function of the *K*-means technique is as follows [33]:

$$\min \sum\_{k=1}^{K} \sum\_{x\_i \in \mathcal{S}\_k} dist\left(x\_i, c\_k\right)^2 \tag{15}$$

In (15), *K* is the number of clusters, *dist* is a chosen distance measure, and *xi* and *ck* are data points and centroids belonging to cluster *Sk*.

#### **5. Case Studies**

The case studies are tested using data of day-ahead market prices from the Iberian Electricity Market (MIBEL) [34] and the behavior profiles of drivers in Europe [35]. The time horizon considered is 24 h. The electric vehicle aggregator manages 1000 similar electric vehicles, having a battery capacity of 25 kWh [5]—a common value for Nissan Leaf models. The rated power of the super battery/superload is 25 MWh [5]. This paper assumes that the driving patterns of all electric vehicles are similar. The battery cost in an electric vehicle is 250 €/kWh and the battery modeled for battery degradation has the cost given by Equation (13) with a linear approximated slope of *m* −0.0013 given in [31]. The ratio distance/consumption is assumed to be the same, having a value of 6 km/kWh. The V2G tariff <sup>λ</sup>*DA*<sup>∗</sup> *st* is assumed to be <sup>λ</sup>*DA*<sup>∗</sup> *st* <sup>=</sup> 0.65λ*DA st* . This V2G tariff should be sufficiently low to encourage the electric vehicle aggregator to participate in electricity markets, covering the operating costs of the electric vehicles and the battery degradation costs. Similar approaches regarding incentives for aggregators are applied in other research works, such as the case of [36] where a price markup is considered. Three case studies are considered: (1) Case 1—Inflexible charging; (2) Case 2—Partially-flexible charging; (3) Case 3—Flexible Charging.

The analysis of the results obtained from the formulation proposed in this paper is on the basis of the offering curves, whether regarding the offering curves for the purchase or sale of energy, typically presented in electricity markets, as is the case in the Iberian Electricity Market. The purpose of the analysis is to confirm that the flexibility of vehicle owners can influence the management of the electric vehicle fleet and to determine how flexibility can improve the aggregator's profit through the use of the offering curves. The importance of this analysis is its further support for the aggregator to access the market with better levels of rationality when submitting the offers. The scenarios of day-ahead market prices given by the *K*-means scenario reduction technique are in Figure 1.

**Figure 1.** Scenarios of day-ahead market prices.

Figure 1 shows the typical tendency for the behavior of market prices.
