# Assignment Approach for Electric Vehicle Charging Using Traffic Data Collected by SUMO

Riham Farhani, Yassin El Hillali, Atika Rivenq, Yahia Boughaleb, Abdelowahed Hajjaji

► To cite this version:

Riham Farhani, Yassin El Hillali, Atika Rivenq, Yahia Boughaleb, Abdelowahed Hajjaji. Assignment Approach for Electric Vehicle Charging Using Traffic Data Collected by SUMO. World Electric Vehicle Journal, 2023, 14 (2), pp.40. 10.3390/wevj14020040 . hal-04034398

HAL Id: hal-04034398

https://hal.science/hal-04034398

Submitted on 25 Apr 2023

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Article

# Assignment Approach for Electric Vehicle Charging Using Traffic Data Collected by SUMO

Riham Farhani<sup>1,2,*</sup>,<sub>1</sub> Yassin El Hillali<sup>1</sup>, Atika Rivenq<sup>1</sup>, Yahia Boughaleb<sup>2,3</sup> and Abdelowahed Hajjaji<sup>2</sup>

**Abstract:** Consumption habits are changing due to the development of new technologies around renewable energy, environmental awareness, and new incentive policies. Smart grids are seen as an effective way to accommodate more renewable energy, achieve better control of demand, and improve the operating conditions of the electrical system. However, electric vehicles, which are an environmentally friendly alternative, have very high market penetration and require efficient electrical management at charging stations. Among the factors that have a significant impact on electrical energy consumption are traffic conditions, which can seriously impact the efficiency of electric vehicles. Therefore, the focus is on developing charging infrastructure and reducing vehicle waiting time by optimally allocating electric vehicles to charging stations. To this end, an optimization approach is presented, based on the traffic conditions collected by the SUMO simulator. This approach enables each vehicle to be assigned to the appropriate station while maintaining its battery state of charge at a higher level.

**Keywords:** smart grids; green environment; electric vehicle; charging station; traffic conditions; SUMO

<figure><img src="image_2.png" /></figure>

check for
updates

**Citation:** Farhani, R.; El Hillali, Y.; Rivenq, A.; Boughaleb, Y.; Hajjaji, A. Assignment Approach for Electric Vehicle Charging Using Traffic Data Collected by SUMO. *World Electr. Veh.* J. **2023**, *14*, 40. https://doi.org/10.3390/wevj14020040

Academic Editor: Peter Van den Bossche

Received: 18 October 2022

Revised: 16 January 2023

Accepted: 30 January 2023

Published: 3 February 2023

<figure><img src="image_3.png" /></figure>

**Copyright:** © 2023 by the authors.
Licensee MDPI, Basel, Switzerland.
This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## 1. Introduction

Today, with the many manifestations of climate change and demand for electricity expected to increase by approximately 70% by 2040, energy sustainability and environmental preservation have become global concerns. A 40% decrease in greenhouse gas emissions compared to 1990, at least 32% of the EU's final energy consumption being renewable energy, and at least a 32.5% increase in energy efficiency are just a few of the ambitious goals set by the European Union for decarbonization, the greening of the energy mix, and energy sobriety by 2030 [1,2]. As cities and countries move to adopt advanced technological plans, electricity consumption will increase to uncontrollable levels if we are not careful. In this context, the use of smart grids (SG) is emerging in the electrical system to achieve ecological and environmental goals while contributing to the reliability of the power supply for customers.

These smart grids are made up of millions of components, such as control systems, computers, power lines, and a large number of real-time communication devices. The development of energy-efficient systems is facilitated by several solutions, including the smart grid, which enables the seamless integration of renewable resources, storage facilities, electric vehicles (EV), smart meters, and other intelligent, affordable, sustainable, energy-efficient, and cleaner devices [3–5].

The provision of bi-directional power flow and communication signals is the main duty of SGs in conventional power systems. SGs can react to changes in power generation, transmission, and substations thanks to a robust control and communication system. This

<footnote n="1">¹ Laboratory Institute of Electronics, Microelectronics and Nanotechnology—IEMN, UPHF, 59300 Valenciennes, France</footnote>

<footnote n="2">² Laboratory of Engineering Sciences for Energy ENSA, El Jadida 24000, Morocco</footnote>

<footnote n="3">³ University Hassan II. ENS—Casablanca, Casablanca 20000, Morocco</footnote>

<footnote>* Correspondence: riham.farhani@uphf.fr</footnote>
functionality is derived from agent observations of sensor networks and the overall network. The embedded controller communicates instantly with each substation and power conversion unit, including transformers, converters, inverters, and generators [6].

Road transport is the leading emitter of CO₂ in France, accounting for 31% and 29% of emissions in 2019 and 2020, respectively [7]. The sector was also one of the main sources of air pollution in 2019, with CO₂ accounting for 97% of greenhouse emissions, 2% attributed to HFCs from air conditioning systems, and N₂O accounting for the remaining percentage.

Faced with this situation, electric vehicles have become a major issue for society due to rising environmental concerns, the volatility of oil prices, and the regal force of public authorities. The political will to deport pollutant emissions to energy production centers, on the one hand, on the need to reduce the energy bill, and on the other hand, it has led to several avenues of scientific reflection. The number of sales of EVs has increased from approximately 400 thousand vehicles in 2016 to 5 million vehicles in 2030, which is expected lead to an increase in the consumption of electrical energy from 700 GWh in 2016 to 10 TWh in 2030 [8]. The energy required to charge the vehicles is still reasonable, but the power demand is enormous (hundreds of GW for a total installed power of 130 GW in 2016). Thus, to avoid the negative impact of the power demand of EVs on the electrical network, solutions for electrical charge management are essential.

In order to achieve electrical charge management and obtain the information in real time, wireless communication is the best solution. Some communication technologies are specially designed to support the functionality of V2X (vehicle-to-everything), which is a wireless technology that allows the exchange of data between a vehicle and its environment C-ITS (cooperative intelligent transport system), where ITS-G5 and LTE-V2X are existing solutions standardized respectively by the ETSI (European Telecommunication Standards Institute) and 3GPP (3rd Generation Partnership Project). These communication technologies provide the core of the vehicular network's performance, enabling improved real-time communication between various architectural elements. The communication modes of V2X are distinguished as infrastructure-to-vehicle (I2V), vehicle-to-vehicle (V2V), vehicle-to-infrastructure (V2I), vehicle-to-grid (V2G), and grid-to-vehicle (G2V) [9].

To effectively address the issue of electric charge management at charging stations, communication between vehicles is crucial. In our research, we integrated ITS-G5 technology to collect real-time data to monitor the movement of electric vehicles. We proposed an allocation technique to assign each EV to the ideal station based on the traffic circumstances collected by the SUMO traffic simulator. This provided flexibility in managing the charging of the system by reducing the energy consumption and charging time required. These are the important contributions of the study:

* First, we describe the architecture of an enhanced smart grid system integrating ITS-G5 technology, which provides useful real-time information and efficient communication between roadside units (RSUs) and EVs for the purpose of distributing EV charging management decisions.

* Second, an optimized approach allowed for optimal allocation of EVs by taking into account the characteristics of the EVs, charging stations, and road traffic disseminated by the RSUs and collected in our study by the SUMO simulator.

* Third, a linear mathematical program incorporated all of the constraints. This approach assigned each electric vehicle to an appropriate charging station and consumed a minimum of electric energy when it reached the designated charging station, thus maximizing the final state of charge and reducing the waiting time of EVs at the charging station.

* Finally, we performed extensive simulations to verify the effectiveness of this approach. Our evaluation was performed using the realistic traffic simulator. The proposed strategy was found to be more effective than the shorter path strategy in managing the charging of electric vehicles.

The structure of this paper is as follows: In Section 2, we provide an overview of the relevant related literature and propose a description of the system and linear mathematical
model of the global context of the system and the constraints. In Section 3, we propose an assignment algorithm. Then, in Section 4, we detail the data collection procedure with SUMO and analyze the obtained results. The Section 6 includes a conclusion and recommendations for further research.

## 2. Related Work

To date, several studies have shown that the cumulative load of electric vehicles is detrimental to the stability of smart grids [1]. To overcome the smart grid overload constraint, many researchers have focused on charging management strategies to optimally disperse electric vehicles in terms of time and space. Several studies have focused on the optimization of charging strategies for electric vehicles.

### 2.1. Abbreviations Smart Grids Based on Traffic Management Techniques

A global scheduling optimization problem was addressed in order to optimize power and minimize the total cost of charging electric vehicles during the day. However, the solution was not practical, so the authors formulated an alternative local scheduling optimization method. The findings demonstrated that the local scheduling method could achieve a performance that was comparable to that of the global method. Several algorithms have been proposed [10–12]. A queueing model with priority discipline was proposed, which allowed the network to effectively manage coordination between charging and discharging processes by favoring the discharge of electric vehicles during the peak period [13]. In addition, the model balanced the number of electric vehicles between charging stations to reduce their occupancy states and minimize the waiting time of electric vehicles. Two other algorithms for decentralized power generation and decentralized charging station management of D-EVSS were proposed to manage the interactions between EVs and D-EVSSs by maximizing driver satisfaction in terms of reduced waiting time and minimum load for D-EVSSs [10] as well, as described in ref. [11]. A proposed scheduling strategy in the form of a moving-window optimization scheme that considered load and price forecasts as well as power demand generally exhibited a faster convergence characteristic than the global optimization scheme. In this manner, a trustworthy assessment of the ideal low-cost charging strategy was accomplished. A previous study [12] presented a sequence of charging-related events using an approach based on the max-plus method, illustrating the platform with the electric vehicle as an autonomous entity and the charging station as the energy-supplying entity. Each task in the charging process had its occurrence date assessed using the created max-plus model. To estimate the distribution of electric vehicles and their direction to charging stations, they also developed a predictive charging strategy.

Most current works rely on cellular or Wi-Fi technologies to collect real-time vehicle information. The real-time intelligent coordination system (STRTCS), a new online coordination system for plug-in electric car charging, is presented in ref. [14]. A prediction unit that can estimate the future energy needs of PEVs and an optimization unit that offers effective charging coordination make up this system. The outcomes revealed STRTCS's strong performance in terms of its quick management of numerous parking lots. A solution to the energy-constrained vehicle routing issue using a sparse station network was presented in ref. [15]. This study's goal was to determine the routes and quantity of recharging needed so that the total time of cars on the road was as short as possible.

### 2.2. Smart Grids Improvements Due to V2X Communications

Nevertheless, the majority of the charging strategies used in the literature do not take into account communication of the EVs, which cannot be neglected nowadays due to its importance in fast charging. Therefore, real-time information must be taken into account to design new, efficient charging strategies for electric vehicles.

The authors in ref. [16], using smart grid communication with VANET-enhanced capabilities, proposed a predictive charging strategy for EVs that addressed drivers' concerns about autonomy by reducing the average trip cost. These authors showed that this strategy
performed better than a strategy that did not take into account the mobility and trip cost of the EVs. In ref. [17], the authors proposed a communication framework of an electric vehicle mobile charging application based on the publish/subscribe (P/S) mechanism and public buses. On the one hand, the results showed that the frequency with which P/S published information about the state of the vehicles determined the charging performance in terms of waiting time and number of recharged electric vehicles. On the other hand, the flexibility and mobility of buses improved the charging performance compared to when RSUs were deployed. Finally, they observed that the advantage of reservation aggregation led to a reduction in communication costs.

## 2.3. Mobility Simulators

The primary function of mobility simulators is to simulate the movement of vehicles. In this context, we specifically highlight SUMO, TSIS-CORSIM [18], and Quadstone Paramics as the most popular simulators [19]. In the development of road traffic simulation, these software have advantages and disadvantages; however, combining at least two software enables optimal results. One of the most practical approaches for this development is the combination of SUMO and Matlab [18]. In the same field, the authors of ref. [20] proposed TraCi, which allows SUMO to be linked to other applications through a client-server architecture based on TCP.

# 3. Proposed Solution

## 3.1. Model System

The system overview is shown in Figure 1, where the smart grid can be wirelessly connected to electric vehicles when they are on the roadside before they reach the outlet to schedule their charging or discharging needs. The smart grid is also connected by communication technology to the electric vehicle power equipment (EVSE) in order to update the vehicle's state. We first assumed that an EV could communicate its profile to the smart grid via a roadside unit (RSU) for the most appropriate station based on the vehicle's final state of charge. The availability and location of the charging station is known by the smart grid and communicated to the appropriate vehicle.

<figure><img src="image_4.png" /><figcaption>**Figure 1.** System overview.</figcaption></figure>

## 3.2. Assignment Algorithm

The system was represented by an optimization model using linear programming for optimal assignment and decision-making. The goal was to assign each EV to an appropriate CS while keeping the EV's pin SOC as high as possible when the CS location was reached. By consuming a small amount of power while reaching the recommended CS, EV drivers are more confident that the risk of failure (without power) is minimized. There are many constraints to this goal, including resource constraints, such as energy remaining in the electric battery, availability of a free CS, and the energy provided by charging stations; location constraints, such as the location of each EV and CS, the distance between them,
road traffic, and the nature of the routes; and time constraints, such as the time needed to reach the CS.

The assignment problem was a scientific analysis method in which we expressed the objective and constraints by linear equations. This allowed us to assign (n) individuals to establish (m) tasks. In our work, the objective was to satisfy the demand in terms of energy at the smart grid level and reduce the occupation time at the charging station. Therefore, the proposed solution was to route an EV, according to its needs, to a charging station while consuming the minimum energy.

We proposed that each EV was characterized by:

* The distance given by the GPS.

* The state of charge (SOC) of the remaining battery.

* The driving mode of the driver and accessories.

* The capacity and autonomy of the battery.

Additionally, for each charging station, we granted the following parameters:

* The number of charging stations.

* The charging power of each station and its position.

Another very important parameter in our modeling that impacted energy consumption was the infrastructure conditions, especially between the position of the EV and the charging station. Each path was defined by several characteristics, including traffic conditions (traffic jam/not), urban area, etc. We assumed *Alloc* (i, j) to be the assignment matrix of a number (n) of EVs to a number (m) of load stations, such that $m < n$ for $1 \le i \le n$ and $1 \le j \le m$.

$$Alloc(i, j) = \begin{pmatrix} SOC_{f11} & \dots & SOC_{f1m} \\ \vdots & \ddots & \vdots \\ SOC_{fn1} & \dots & SOC_{fnm} \end{pmatrix}$$

### 3.2.1. Problem Formulation

The notation used in our work is presented in Table 1.

<table><caption>**Table 1.** Notation.</caption><thead><tr><th>Notation</th><th>Description</th></tr></thead><tbody><tr><td>n</td><td>Number of electric vehicles (EV<sub>1</sub>, EV<sub>2</sub>, ..., EV<sub>n</sub>)</td></tr><tr><td>m</td><td>Number of charging stations (CS<sub>1</sub>, CS<sub>2</sub>, ..., CS<sub>m</sub>)</td></tr><tr><td>Alloc (i, j, t)</td><td>EV<sub>i</sub> allocation coefficient at charge station CS<sub>j</sub> at time t</td></tr><tr><td>K (i, j, t)</td><td>Vehicle density instant on the route between the EV<sub>i</sub> and station CS<sub>j</sub> at time t [veh/km]</td></tr><tr><td>V (i, j, t)</td><td>Vehicle speed according to traffic conditions at time t [km/h]</td></tr><tr><td>v<sub>f</sub> (i, j, t)</td><td>Reference speed on the route between the EV<sub>i</sub> position and station CS<sub>j</sub> at time t [km/h].</td></tr><tr><td>k<sub>jam</sub>(i, j, t)</td><td>Traffic density, capacity supported by the road leading from the EV<sub>i</sub> position to charging station CS<sub>j</sub> at time t [veh/km].</td></tr><tr><td>q (i, j, t)</td><td>Vehicle flow [veh/h]</td></tr><tr><td>d (i, j, t)</td><td>Distance between the vehicle EV<sub>i</sub> and charging station CS<sub>j</sub> at time t [km]</td></tr><tr><td>C (i)</td><td>Nominal capacity of EV<sub>i</sub>'s traction battery [KWh]</td></tr><tr><td>A(i)</td><td>Autonomy of the traction battery of vehicle EV<sub>i</sub> [km]</td></tr><tr><td>T (i, j, t)</td><td>Time required to complete distance d (i, j, t) [h]</td></tr><tr><td>SOC<sub>0</sub>(i, t)</td><td>Initial state of charge of the EV<sub>i</sub> battery at time t [%]</td></tr><tr><td>SOC<sub>f</sub>(i, j, t + T)</td><td>Final state of charge of the EV<sub>i</sub> battery upon arrival at charging station CS<sub>j</sub></td></tr></tbody></table>
As shown in Figure 2, the system starts with the EV trip. If the SOC of the vehicle's battery is sufficient, then the driver can continue the trip. On the other hand, if the battery SOC reaches a certain limit, the driver will receive a low battery warning notification. In this case, a drop-off request is sent to a collaboration platform, which takes care of finding the CS that matches all of the received requests based on the information stored in its database or by communicating directly with the CS. Once the free CS is found, the platform will use other services to allocate the appropriate EV to the free CS, taking into account their characteristics (load state, path, power of each CS, etc.). Among these services, the collaboration platform uses an optimization algorithm to compute the optimal allocation, taking into account the system characteristics as well as the information provided by other services (traffic information services, road conditions, etc.). When the optimal allocation is found, the EV is informed of a CS corresponding to its criteria. After the charging process is completed, the used charging point is released and the DB platform database is updated. Then, the EV can continue its journey.

<figure><img src="image_5.png" /><figcaption>**Figure 2.** General framework of the proposed approach.</figcaption></figure>

The goal was to assign each electric vehicle to the appropriate station with minimal energy consumption. We proposed that:

* The electric vehicles are of the same brand.

* An electric vehicle can be assigned to only one station.

* The charging stations have the same characteristics (power of charge).

* The charging station has several charging points.

* The road is flat.
The coefficient Alloc (i, j, t) may depend on several parameters, such as: Soc₀ (i, t), SOCf (i, j, t + T), q (i, j, t), Kjam (i, j, t), and Vf (i, j, t).

In this study, we were interested in the expression of the equation as a function of the elements characterizing the road traffic in order to determine their impact on the variation of the energy consumed during the trip. To do this, we worked with the following equations [21,22].

According to the following relation, the density of vehicles was proportional to the flow of vehicles and the time T (i, j, t) necessary to cover distance d (i, j, t):

$$K(i, j, t) = \frac{q(i, j, t)T(i, j, t)}{d(i, j, t)} \qquad (1)$$

The relationship between speed, traffic density, and vehicle density was proposed by Greenshield for multiple vehicles and stations, as follows:

$$v(i, j, t) = v_f(i, j, t)\left(1 - \frac{K(i, j, t)}{K_{jam}(i, j, t)}\right) \qquad (2)$$

Considering the traffic conditions that impact the electrical energy consumption, the final state of charge of the battery SOCf (i, j, t + T (i, j, t)) can be expressed as a function of SOC₀ (i, t) and speed variation:

$$\text{SOC}_f(i, j, t + T(i, j, t)) = \left( \frac{\text{Soc}_0(i, t)}{100} - \frac{Ap}{A(i)} \right) * 100 \qquad (3)$$

With

$$Ap = \int_{t}^{t+T} v_f(i, j, s) \left(1 - \frac{q(i, j, s)T(i, j, s)}{d(i, j, s)K_{jam}(i, j, s)}\right)$$

### 3.2.2. Algorithm

After receiving the needs of the vehicles by the control center of the SG, the Algorithm 1 calculates the SOCf max (see Equation (3)) of each vehicle with each station, then it selects the stations with an available outlet at the minimum. If the number of outlets available at the station is greater than or equal to the number of vehicles assigned to the same station, the assignment is made. Otherwise, the average SOCf max of the EVs assigned to the same station is calculated and the minimum average is selected.

**Algorithm 1:** Assignment Algorithm

**Input:** EVᵢ[Soc₀, Cᵢ, Aᵢ]; CSⱼ [qᵢⱼ, dᵢⱼ, Kjamᵢⱼ]

**Output:** [Socf max]

1. RSU broadcasts the EV charging service

2. For each EV (1, ..., nEV) and for each CS (1, ..., mcs)

3. Calculate SOCfij (using Equation (3))

4. Select CS according to occupancy (number of available outlets)

5. If the number of outlets is less than the number of vehicles assigned to the same station, then

6. Calculate the average of Max(Socfij) of the vehicles assigned to the same station

7. Select the minimum of the average SOCfij

8. Update outlet matrix after EV affectation

9. end if

## 4. Experiments

### 4.1. Preparation of the Simulation

SUMO is a traffic simulation software designed to manage large vehicle networks. It is, above all, a micro simulation because it applies a micro model of vehicle mobility. One of its main features is that it includes vehicle traffic without collisions. It also includes
many other features, such as a large number of vehicle types, multi-lane roads, lane change options, single and dynamic routing, different road hierarchies and types of junctions, and the implementation of all traffic rules at intersections. This allows SUMO to manage large simulation environments since it can accept various input network file formats, such as XML descriptors, etc.

The SUMO traffic simulator was in charge of collecting traffic data. This section provides a full overview of the methods involved in gathering traffic statistics (distance, speed, density, and flow) from the extracted map.

In this study, we chose the city of Valenciennes, more precisely, the area that included the university campus because of the high traffic congestion in this area. The first step, as shown in Figure 3, was to extract the map from the *OpenStreetMap* website, which gave us an .OSM file. To insert this map in SUMO, we converted it into a *Net.xml* file using the *Netconvert* command `netconvert [-osm-files map.osm -o filename.net.xml]`.

After the file was converted, Python script was used to add Trip and Route to the network using RandomTrips.py. Using the command `py [randomTrips.py -n Filename.net.xml -r File-name.rou.xml -e 1000 -l -e]` created two automatic files with the extensions .rou and .rou.alt, which contained all of the information concerning the road and vehicles.

Finally, to run the map on SUMO, a configuration file was created with a `.sumo.cfg` extension that contained the previous files as input, as shown in Figure 4.

## 4.2. Insertion of EV and CS

The electric vehicles were integrated into the map after importing the Valenciennes map and the flows were generated using SUMO. To generate the electric vehicles, the following lines of code were added to the map, as shown in Figure 5.

Since Sumo does not allow station information to be edited, the charging stations were manually inserted on the map using Netedit, a graphical network editor included in SUMO. The charging stations were located on highways, which SUMO referred to as curbs, as shown in Figure 6.

## 4.3. SUMO Connection with TraCi

Our study consisted of collecting traffic data, including distance, speed, flow, and density. TraCi (traffic control interface) allowed us to interact with SUMO, giving access to a road traffic simulation and also allowing us to retrieve and manipulate the data online. The connection with TraCi was performed using script written in Python, following a request-response model on a TPC/IP connection.

Then, we connected SUMO with our script.

In the first step, we imported TraCi in our script and added the SUMO HOME/Tools directory on the Python path to use the library, as shown in Figures 7 and 8. In the second step, we inserted some lines in our script to interface with SUMO using Python. Finally, we added functions that consisted of calculating the distance *d* (i, j, t), *q* (i, j, t), *K*<sub>jam</sub> (i, j, t), and *V*<sub>f</sub> (i, j, t) for a choice of 6 vehicles (n = 6) and 6 stations (m = 6).
<figure><img src="image_6.png" /><figcaption>Figure 3. EV trip management using OSM and SUMO.</figcaption></figure>
<figure><img src="image_7.png" /><figcaption>Figure 4. Configuration file and running the network.</figcaption></figure>

<figure><img src="image_8.png" /><figcaption>Figure 5. Lines of code.</figcaption></figure>
<figure><img src="image_9.png" /><figcaption>Figure 6. insertion of CS in the map.</figcaption></figure>

<figure><img src="image_10.png" /><figcaption>Figure 7. Importing TraCi in a script.</figcaption></figure>

<figure><img src="image_11.png" /><figcaption>Figure 8. Interfacing TraCi with SUMO.</figcaption></figure>

## 5. Obtained Results: Discussion and Analysis

First, we present the information recovered by our program on the predefined road network. Figure 9 illustrates the value of each parameter (distance, reference speed, traffic flow, traffic density) of the road that linked the 6 vehicles with the 6 selected stations.
<figure><img src="image_12.png" /><figcaption>**Figure 9.** Traffic conditions data. (a) Traffic density (b) Traffic flow (c) Distance (d) Reference speed.</figcaption></figure>

**5.1. Illustrative Example**

After obtaining the traffic information, our second task was to implement it in our algorithm as input and launch the simulation on Matlab in order to obtain the optimal assignment of each vehicle. In our study, we chose the brand “Renault ZOE” with an autonomy of $A_i = 160$ km and capacity of $C_i = 24$ KWh:

* $n = 6$ EVs.

* $m = 6$ CSs.

* The $SOC_0(i, t)$ of each vehicle $EV_i$ is given.

* Number of outlets at the charging stations: $n_1 = 1, n_2 = 1, n_3 = 1, n_4 = 0, n_5 = 2, n_6 = 2$.

Table 2 lists the values of $SOC_{f\max}$ chosen by our approach to match the assignments (numbers written in red). The optimal solution of the linear program that represented the system is given in Table 3 and Figure 10. This answer corresponded to the optimal assignment of each EV. A comparative study in the following paragraph explains the advantages of our approach.

**5.2. Evaluation and Performance**

To prove the performance of our approach, we will compare it with shortest way, which is the first decision that the driver can think of.

Following the results in Table 4 and Figure 11 showing the shortest distance for the assignment, we noticed that most of the vehicles were assigned to station number 2, which contained just one available outlet and meant that vehicles would wait longer to charge, which implies an increase in waiting time at this station. This meant that the assignment based on the shortest path was not always optimal.
<table><caption>**Table 2.** Optimal values of SOC<sub>f</sub> for each EV.</caption><thead><tr><th></th><th>CS<sub>1</sub></th><th>CS<sub>2</sub></th><th>CS<sub>3</sub></th><th>CS<sub>4</sub></th><th>CS<sub>5</sub></th><th>CS<sub>6</sub></th></tr></thead><tbody><tr><td>EV<sub>1</sub><br>SOC0 = 25%</td><td>5.115</td><td>23.357</td><td>19.366</td><td>13.336</td><td><span style="color:red;">22.117</span></td><td>20.659</td></tr><tr><td>EV<sub>2</sub><br>SOC0 = 36%</td><td>0.218</td><td><span style="color:red;">34.062</span></td><td>0</td><td>0</td><td>0</td><td>0</td></tr><tr><td>EV<sub>3</sub><br>SOC0 = 45%</td><td>39.306</td><td>42.564</td><td>40.219</td><td>39.642</td><td>41.253</td><td><span style="color:red;">39.788</span></td></tr><tr><td>EV<sub>4</sub><br>SOC0 = 21%</td><td>10.763</td><td>15.938</td><td>12.001</td><td>11.236</td><td><span style="color:red;">13.486</span></td><td>12.001</td></tr><tr><td>EV<sub>5</sub><br>SOC0 = 45%</td><td>24.592</td><td>28.360</td><td><span style="color:red;">25.622</span></td><td>25.020</td><td>26.776</td><td>25.387</td></tr><tr><td>EV<sub>6</sub><br>SOC0 = 28%</td><td>0</td><td>21.840</td><td>0</td><td>0</td><td>6.691</td><td><span style="color:red;">6.784</span></td></tr></tbody></table>

<table><caption>**Table 3.** Optimal assignment of EVs.</caption><thead><tr><th></th><th>CS<sub>1</sub></th><th>CS<sub>2</sub></th><th>CS<sub>3</sub></th><th>CS<sub>4</sub></th><th>CS<sub>5</sub></th><th>CS<sub>6</sub></th></tr></thead><tbody><tr><td>Number of outlets</td><td>1</td><td>1</td><td>1</td><td>0</td><td>2</td><td>2</td></tr><tr><td>Optimal Assignment</td><td>EV<sub>2</sub></td><td>EV<sub>5</sub></td><td></td><td>EV<sub>4</sub>/EV<sub>1</sub></td><td>EV<sub>3</sub>/EV<sub>6</sub></td><td></td></tr><tr><td>SOC<sub>f</sub> (%)</td><td>34.062</td><td>25.622</td><td></td><td>13.486/22.117</td><td>39.788/6.784</td><td></td></tr></tbody></table>

<figure><img src="image_13.png" /><figcaption>**Figure 10.** Optimal assignment of EVs.</figcaption></figure>

<table><caption>**Table 4.** Optimal values of assignment according to the value of the distance.</caption><thead><tr><th></th><th>CS<sub>1</sub></th><th>CS<sub>2</sub></th><th>CS<sub>3</sub></th><th>CS<sub>4</sub></th><th>CS<sub>5</sub></th><th>CS<sub>6</sub></th></tr></thead><tbody><tr><td>EV<sub>1</sub></td><td>0.931</td><td>1.102</td><td>0.696</td><td><span style="color:red;">0.563</span></td><td>0.864</td><td>1.432</td></tr><tr><td>EV<sub>2</sub></td><td>1.37</td><td><span style="color:red;">1.31</span></td><td>1.357</td><td>1.356</td><td>1.525</td><td>2.093</td></tr><tr><td>EV<sub>3</sub></td><td>1.244</td><td><span style="color:red;">1.179</span></td><td>1.229</td><td>1.228</td><td>1.398</td><td>1.966</td></tr><tr><td>EV<sub>4</sub></td><td>2.105</td><td><span style="color:red;">2.04</span></td><td>2.091</td><td>2.09</td><td>2.259</td><td>2.827</td></tr><tr><td>EV<sub>5</sub></td><td>1.858</td><td><span style="color:red;">1.793</span></td><td>1.844</td><td>1.843</td><td>2.012</td><td>2.580</td></tr><tr><td>EV<sub>6</sub></td><td>1.235</td><td><span style="color:red;">1.17</span></td><td>1.447</td><td>1.192</td><td>1.615</td><td>2.1831</td></tr><tr><td>Number of outlets</td><td>1</td><td>1</td><td>1</td><td>0</td><td>2</td><td>2</td></tr></tbody></table>
<figure><img src="image_14.png" /><figcaption>**Figure 11.** Assignment of EVs according to the shortest way.</figcaption></figure>

The results in Figure 11 illustrated the optimal management of EV dispatch at the charging station by keeping the battery at a high level of charge upon arrival at the charging station, which minimized the charging time at the charging station and also allowed space for subsequent vehicles without having to wait for a long time.

From this comparison, we can see the importance of our approach, which allowed the inclusion of the state of the road (reference speed, distance, traffic flow, traffic density) in the final decision. Our approach also integrated V2I, V2V, and V2G communication using ITS-G5 technology, which facilitated obtaining information in real time (free hold, final load status, etc.).

**6. Conclusions**

In this paper, we have discussed an approach to achieve optimal assignment to charging stations for a fleet of electric vehicles based on the final state of charge of the battery. An EV was optimally assigned when its energy consumption was minimal, which meant that its battery state of charge was maintained at a high level when it arrived at the SC. To achieve this goal, our problem was modeled using a linear program, taking into account the traffic conditions that are a disturbing element in the consumption of energy of the EV to reach the CS. We detailed the steps performed in order to collect the traffic conditions (traffic flow, distance, reference speed, traffic density). Numerical examples to illustrate the proposed approach and the results obtained were presented and analyzed, followed by a comparative study with the shortest path. This comparison showed the added value of the proposed approach for the better charge management of electric vehicles. As a perspective of this work, we will study V2G technology (vehicle-to-grid) to consider not only the recharge but also the discharge of vehicles to ensure the energetic stability in the SG. Additionally, as a perspective that has a link with the communication part of our study, we will assess our approach using traffic results obtained with the OMNeT++ network simulator.

**Author Contributions:** Conceptualization, R.F.; Methodology, R.F.; Validation, Y.E.H., A.R., A.H. and Y.B.; Writing—original draft, R.F. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Data Availability Statement:** The data presented in this study are available on request from the corresponding author.

**Conflicts of Interest:** The authors declare that there is no conflict of interest.
References

1. Ban, D.; Michailidis, G.; Devetsikiotis, M. Demand response control for PHEV charging stations by dynamic price adjustments. In Proceedings of the 2012 IEEE PES Innovative Smart Grid Technologies (ISGT), Washington, DC, USA, 16–20 January 2012; pp. 1–8.

2. Cabello, G.; Navas, S.; V'azquez, I.; Iranzo, A.; Pino, F. Renewable medium-small projects in Spain: Past and present of microgrid development. *Renew. Sustain. Energy Rev.* **2022**, *165*, 112622. [CrossRef]

3. Lakshminarayana, S.; Quek, T.Q.; Poor, H.V. Cooperation and storage tradeoffs in power grids with renewable energy resources. *IEEE J. Sel. Areas Commun.* **2014**, *32*, 1386–1397. [CrossRef]

4. Maharjan, S.; Zhu, Q.; Zhang, Y.; Gjessing, S.; Basar, T. Dependable demand response management in the smart grid: A Stackelberg game approach. *IEEE Trans. Smart Grid* **2013**, *4*, 120–132. [CrossRef]

5. Palensky, P.; Kupzog, F. Smart grids. *Annu. Rev. Environ. Resour.* **2013**, *38*, 201–226. [CrossRef]

6. Kabalci, Y. A survey on smart metering and smart grid communication. *Renew. Sustain. Energy Rev.* **2016**, *57*, 302–318. [CrossRef]

7. Liu, Z.; Ciais, P.; Deng, Z.; Lei, R.; Davis, S.J.; Feng, S.; Zheng, B.; Cui, D.; Dou, X.; Zhu, B.; et al. Near-real-time monitoring of global CO₂ emissions reveals the effects of the Covid-19 pandemic. *Nat. Commun.* **2020**, *11*, 5172. [CrossRef] [PubMed]

8. Roszczypala, D.; Batard, C.; Ginot, N.; Poitiers, F. Optimisation de charge de véhicules électriques au sein d'un micro-réseau avec production d'énergie renouvelable, et stockage fixe. In Proceedings of the Symposium de Genie Electrique (SGE 2018), Nancy, France, 3–5 July 2018.

9. Dominguez, J.M.L.; Sanguino, T.J.M. Review on V2X, I2X, and P2X communications and their applications: A comprehensive analysis over time. *Sensors* **2019**, *19*, 2756. [CrossRef] [PubMed]

10. Alghamdi, T.G.; Said, D.; Mouftah, H.T. Decentralized energy storage system for EVs charging and discharging in smart cities context. In Proceedings of the 2019 IEEE International Conference on Communications (ICC), Shanghai, China, 20–24 May 2019; pp. 1–5.

11. Ma, C.; Rautiainen, J.; Dahlhaus, D.; Lakshman, A.; Toebermann, J.-C.; Braun, M. Online optimal charging strategy for electric vehicles. *Energy Procedia* **2015**, *73*, 173–181. [CrossRef]

12. Kristoffersen, T.K.; Capion, K.; Meibom, P. Optimal charging of electric drive vehicles in a market environment. *Appl. Energy* **2011**, *88*, 1940–1948. [CrossRef]

13. He, Y.; Venkatesh, B.; Guan, L. Optimal scheduling for charging and discharging of electric vehicles. *IEEE Trans. Smart Grid* **2012**, *3*, 1095–1105. [CrossRef]

14. Shaaban, M.F.; Ismail, M.; El-Saadany, E.F.; Zhuang, W. Real-time PEV charging/discharging coordination in smart distribution systems. *IEEE Trans. Smart Grid* **2014**, *5*, 1797–1807. [CrossRef]

15. Wang, T.; Cassandras, C.G.; Pourazarm, S. Energy-aware vehicle routing in networks with charging nodes. *IFAC Proc. Vol.* **2014**, *47*, 9611–9616. [CrossRef]

16. Wang, M.; Liang, H.; Zhang, R.; Deng, R.; Shen, X. Mobility-aware coordinated charging for electric vehicles in VANET-enhanced smart grid. *IEEE J. Sel. Areas Commun.* **2014**, *32*, 1344–1360. [CrossRef]

17. Cecchini, G.; Bazzi, A.; Masini, B.M.; Zanella, A. Performance comparison between IEEE 802.11 p and LTE-V2V in-coverage and out-of-coverage for cooperative awareness. In Proceedings of the 2017 IEEE Vehicular Networking Conference (VNC), Turin, Italy, 27–29 November 2017; pp. 109–114.

18. Lim, K.G.; Lee, C.H.; Chin, R.K.Y.; Yeo, K.B.; Teo, K.T.K. Simulators for vehicular ad hoc network (VANET) development. In Proceedings of the 2016 IEEE International Conference on Consumer Electronics-Asia (ICCE-Asia), Seoul, Republic of Korea, 26–28 October 2016; pp. 1–4.

19. Lee, C.H.; Lim, K.G.; Chua, B.L.; Chin, R.K.Y.; Teo, K.T.K. Progressing toward urban topology and mobility trace for vehicular ad hoc network (VANET). In Proceedings of the 2016 IEEE Conference on Open Systems (ICOS), Langkawi, Malaysia, 10–12 October 2016; pp. 120–125.

20. Wegener, A.; Piórkowski, M.; Raya, M.; Hellbrück, H.; Fischer, S.; Hubaux, J.-P. TraCi: An interface for coupling road traffic and network simulators. In Proceedings of the 11th Communications and Networking Simulation Symposium, Ottawa, ON, Canada, 14–17 April 2008; pp. 155–163.

21. Mkahl, R.; Nait-Sidi-Moh, A.; Gaber, J.; Wack, M. A linear optimization approach for electric vehicles charging. In Proceedings of the 3rd International Renewable and Sustainable Energy Conference (IRSEC), Marrakech, Morocco, 10–13 December 2015; pp. 1–6.

22. Farhani, R.; El Hillali, Y.; Rivenq, A.; Boughaleb, Y.; Hajjaji, A. Real-time traffic data collection using the two simulators SUMO and OMNeT++. In Proceedings of the 11th International Symposium on Signal, Image, Video and Communications (ISIVC), El Jadida, Morocco, 18–20 May 2022; pp. 1–4.

**Disclaimer/Publisher's Note:** The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.