Application Design Aiming to Minimize Drivers’ Trip Duration through Intermediate Charging at Public Station Deployed in Smart Cities †

: Today, smart cities are turning to electric transport, carpooling and zero emission zones. The growing number of electric vehicles on the roads makes it increasingly necessary to have a public charging infrastructure. On the other hand, the main limitations of electric vehicles are the limited range of their batteries and their relatively long charging times. To avoid having problems to recharge, electric vehicle drivers must plan their journeys more thoroughly than others. At the goal of optimizing trip time, drivers need to automate their travel plans based on a smart charging solution, which will require the development of new Vehicle-to-Grid applications that will allow at the charging stations to dynamically interact with the vehicles. In this paper, we propose an architecture based on an algorithm allowing the management of charging plans for electric vehicles traveling on the road to their destination, in order to minimize the duration of the drivers’ journey including waiting and charging times. The decision taken by the algorithm based on the exploration of the data of each public supply station according to its location, number of vehicles in the queue, number of charging sockets, and rates of service.


Introduction
Today, cities occupy 2% of the world's surface; they shelter 50% of the world population, consume 75% of the energy produced and are responsible for 80% of CO 2 emissions.Fuel-consuming is the main source of CO 2 emissions, the city and its inhabitants are the first to be concerned by the dangers of global warming.The success of the transition to a low-carbon society depends largely on what the cities will decide.Their rapid transition to smart cities, which takes steps to reduce emissions of pollutants and irritants, is essential to ensure better management of environmental resources based on the principles of sustainable development and to improve environmental performance of urban areas.
Many cities are implementing pollution reduction projects also through improvements in urban planning and transport, which are the main contributors to CO 2 emissions and other pollutants.Electric vehicles (EVs) are therefore ideal for creating an eco-sustainable urban environment, and thus the number of electric vehicles (EVs) is expected to increase significantly in the near future [1].
Electric vehicles have been seen by several countries around the world as a plausible and appropriate solution that can both solve transport sector problems and protect the environment.The problem facing them is essentially the limitation of battery manufacturing technologies, which makes their driving range too limited and more precisely, it may not exceed 500 km.Moreover, the recharging time is long, ranging from 30 min to 10 h or more, which is considered by the users very long compared to the gasoline vehicle that is capable to refuel in 10 min maximum.On the other hand, the availability and development of fast charging infrastructures [2] can prolong the waiting time of electric vehicles in charging stations (CSs) and influence the acceleration of EVs adoption.
In order to help EV drivers and to contribute to a wide diffusion of VEs, most of the previous work [3][4][5][6] presents many categories of applications that divided as following: applications that inform drivers on the way to the next charging station (CS) and battery level, applications assisting drivers to know the status of charging stations, route planning applications, and applications that collect the data from the EVs to purpose of an effective route.A solution proposed by the authors in [7], to place charging stations in a smart city in optimal ways.Thus, it presents a model for EVs, their battery depletion, and the mobility of EVs.In this model, they assume that the charging process only starts when the EVs have a low battery and the communication between the stations and the EVs performed directly using the vehicular ad-hoc network.In [8], the authors propose a model to help EV drivers locate the nearest charging station, they implement an interactive application developed via SQL and PHP platforms to assign EVs their charging locations.In order to make a vision of the smart city via dispersed detection devices, the Internet of Things (IoT), the authors in [9] discusses a data base, big data, based on the history of demand for energy, the location of EVs, and the time of connection.A reservation application based on the parameters set by the EV driver to calculate the optimal path to its destination is implemented in [10].A framework that shares information, on the real-time, between EVs and charging stations proposed in [11].EV charging stations can provide the peak/off-peak pricing of chargers, average service times, and customer service index for charging locations.The EV user can select the optimal charging stations based on a weighted combination of the cost of charging and the distance to the charging station.
Some works address the problem on where to charge, primarily, by minimizing the waiting time for EV charging.This cannot be overlooked, as it is the most important feature of a vehicle in future smart city, especially for fast charging.The works in [12] implement charging plans for all EVs based on the minimized queuing time.In [13], the authors proposed a navigation system where the drivers are expected to choose the option that is the least time consuming, where this time includes the driving time, waiting time, and charging time.A communication framework based on the publish/subscribe mechanism to disseminate the necessary information from the CSs' waiting times, to the electric vehicles, to make their individual decision to select the desired CS [14].Results in [15] show that considering the number of other EVs parking at the CS outperforms that considering the distance to the CS, achieves a shorter charging waiting time particularly given a high EV density.
In [16], optimal online scheduling was implemented by using a price-responsive charging scheme and a solution is proposed in [17] to improve the charge planning of electric vehicles by combining the cost and waiting time in CSs.An Android mobile application developed in [18] that provides a list of CSs in the closest way to EV.Although the app provides an estimate of the distance traveled and a list of available CSs, this a blind search that does not take into account the real-time status of CSs, i.e., the availability of slots.Article [19], based on an estimation of traction power to provide the driver with a recommendation on the most suitable charging station.However, the problem for the static system presented lies in the fact that the driver cannot obtain all the information about the charging station and whether it is working or not and the number of vehicles waiting.Our interest is to determine "where" electric vehicles should move to recharge their batteries while traveling.Indeed, drivers of electric vehicles have their own courses.On one hand, drivers may not be willing to wait long enough to charge their electric vehicles while they are parked at home.In addition, it is also not recommended to choose a host far from the destination.However, inappropriate charging taking place during journeys may degrade users' quality of experience, as drivers prefer to reach trip destinations as soon as possible.
To facilitate the interaction between charging stations and electric vehicles.Therefore, the electric vehicle drivers find an optimal solution to their charging requirements by reducing trip time to their destination.We proposed and implemented an application design for efficient management of charging requests.This solution minimizes the trip time of electric vehicle drivers by guaranteeing the charging of the EV during the journey.
The rest of this paper is organized as follows.In Section 2, we present the design of an application to optimize trip duration, including charging time in an electric vehicle public supply station (EVPSS).In Section 2, we evaluated the algorithm proposed in this paper with respect to what was proposed in [12].Finally, Section 4 concludes the document.

Application Design
There are 3 types of charging, the normal charge, the accelerated charge and finally, the fast charge.The main difference between the three types is the loading speed, which depends on other parameters.Normal charging takes longer than others to charge an entire battery between 6 and 8 h.It is usually suitable for long periods of breaks such as a night at home or a day's work.The second possible type of charge takes between 1 and 2 h.Indeed, the stops of type car parks, shopping center or for a lunch break are ideal for this type of load.the latter type is the fastest option to charge an electric car at public charging stations.It may be necessary to quickly equip a vehicle with the necessary autonomy to make or continue a journey.This type of charge requires on average 20 to 30 min.So, the waiting time for charging, then the trip time, remains among the big obstacles to a wide use of EVs.
In this work, we implement a communication architecture between the EVs and the EVPSS.This architecture allows the EV driver to obtain, in real time, the information concerning the location of the charging station through which he will spend the minimum trip duration.To achieve this goal, EVs and EVPSS need connected to the internet networks to ensure the transmission of data between them and the server that will store the CSs data and manage the EVs requests Figure 1.
World Electric Vehicle Journal 2019, 10, 3 of 11 at home.In addition, it is also not recommended to choose a host far from the destination.However, inappropriate charging taking place during journeys may degrade users' quality of experience, as drivers prefer to reach trip destinations as soon as possible.
To facilitate the interaction between charging stations and electric vehicles.Therefore, the electric vehicle drivers find an optimal solution to their charging requirements by reducing trip time to their destination.We proposed and implemented an application design for efficient management of charging requests.This solution minimizes the trip time of electric vehicle drivers by guaranteeing the charging of the EV during the journey.
The rest of this paper is organized as follows.In Section 2, we present the design of an application to optimize trip duration, including charging time in an electric vehicle public supply station (EVPSS).In Section 2, we evaluated the algorithm proposed in this paper with respect to what was proposed in [12].Finally, Section 4 concludes the document.

Application Design
There are 3 types of charging, the normal charge, the accelerated charge and finally, the fast charge.The main difference between the three types is the loading speed, which depends on other parameters.Normal charging takes longer than others to charge an entire battery between 6 and 8 h.It is usually suitable for long periods of breaks such as a night at home or a day's work.The second possible type of charge takes between 1 and 2 h.Indeed, the stops of type car parks, shopping center or for a lunch break are ideal for this type of load.the latter type is the fastest option to charge an electric car at public charging stations.It may be necessary to quickly equip a vehicle with the necessary autonomy to make or continue a journey.This type of charge requires on average 20 to 30 min.So, the waiting time for charging, then the trip time, remains among the big obstacles to a wide use of EVs.
In this work, we implement a communication architecture between the EVs and the EVPSS.This architecture allows the EV driver to obtain, in real time, the information concerning the location of the charging station through which he will spend the minimum trip duration.To achieve this goal, EVs and EVPSS need connected to the internet networks to ensure the transmission of data between them and the server that will store the CSs data and manage the EVs requests Figure 1.In order to reduce design complexity, have a clear and efficient design, and save maintenance time and system evolution, we have implemented the distributed structure based on the design pattern MVC ("model view controller") which is development architecture to separate the source code into modules.Indeed, this widely used model consists of separating data access (databases), the view displayed to the user and the business logic separately.As well as the MVC model, our In order to reduce design complexity, have a clear and efficient design, and save maintenance time and system evolution, we have implemented the distributed structure based on the design pattern MVC ("model view controller") which is development architecture to separate the source code into modules.Indeed, this widely used model consists of separating data access (databases), the view displayed to the user and the business logic separately.As well as the MVC model, our system has been divided into three layers, one of which is the display layer or view consisting of an application for EVs and one for EVPSS, the logic layer or controller contains all the services allowing the optimization of charging time, and the model layer manages the status or data of EVPSS Figure 2.
World Electric Vehicle Journal 2019, 10, 4 of 11 system has been divided into three layers, one of which is the display layer or view consisting of an application for EVs and one for EVPSS, the logic layer or controller contains all the services allowing the optimization of charging time, and the model layer manages the status or data of EVPSS Figure 2. The development of the MVC model of our system needs an application protocol allowing web accessibility and exchange of information between EVs, EVPSS, and the server.Thus, the protocol must have non-functional aspects such as the transport of information that is delegated to lower layers, Transmission Control Protocol (TCP) or even HyperText Transfer Protocol (HTTP).For these latter reasons, we have adopted the Representational State Transfer (REST) application protocol which makes it possible to guarantee the interoperability of our system and to extend it by facilitating the integration of new applications.In addition, we have based on the JSON format (JavaScript Object Notation), text format, to exchange the data between the components of our system in an ideal way and independent of any programming language.

View Layer
The visualization layer represents a communication interface with the system.It consists of a display control and data sending.At each change of EVPSS state, the application server receives the new data.Thus, it responds to the demands of EVs drivers looking for a CS at which trip duration will be minimized.This layer consists of two mobile applications, one for the EVs and the other for the public charging stations.
The mobile application of EVs is an interface designed for their drivers.It allows sending a recharge request.The latter contains the information about the geographical location of the EV and its destination on the map, in order to find the EVPSS by which the EV driver will spend the minimum trip duration.
When the server receives the request from the EV, it uses the queuing service, executes Algorithm 1, to determine the state of each EVPSS and to extract the data from EVPSS in gals that will be send by the server to the EV's mobile application.The latter is responsible for drawing the path to follow on the map using the Google Maps API Figure 3.
The flow management at EVPSS is performed by a mobile application.It allows communicating with the incoming EVs by assigning them the serial number of charging queue.Thus, it sends to the server the new state with each input or output of the EVs to the station Figure 3.The development of the MVC model of our system needs an application protocol allowing web accessibility and exchange of information between EVs, EVPSS, and the server.Thus, the protocol must have non-functional aspects such as the transport of information that is delegated to lower layers, Transmission Control Protocol (TCP) or even HyperText Transfer Protocol (HTTP).For these latter reasons, we have adopted the Representational State Transfer (REST) application protocol which makes it possible to guarantee the interoperability of our system and to extend it by facilitating the integration of new applications.In addition, we have based on the JSON format (JavaScript Object Notation), text format, to exchange the data between the components of our system in an ideal way and independent of any programming language.

View Layer
The visualization layer represents a communication interface with the system.It consists of a display control and data sending.At each change of EVPSS state, the application server receives the new data.Thus, it responds to the demands of EVs drivers looking for a CS at which trip duration will be minimized.This layer consists of two mobile applications, one for the EVs and the other for the public charging stations.
The mobile application of EVs is an interface designed for their drivers.It allows sending a recharge request.The latter contains the information about the geographical location of the EV and its destination on the map, in order to find the EVPSS by which the EV driver will spend the minimum trip duration.
When the server receives the request from the EV, it uses the queuing service, executes Algorithm 1, to determine the state of each EVPSS and to extract the data from EVPSS in gals that will be send by the server to the EV's mobile application.The latter is responsible for drawing the path to follow on the map using the Google Maps API Figure 3.
The flow management at EVPSS is performed by a mobile application.It allows communicating with the incoming EVs by assigning them the serial number of charging queue.Thus, it sends to the server the new state with each input or output of the EVs to the station Figure 3.

Logical Layer
The logical layer or controller is for the essential role of coordinating the sequences of actions/reactions of the proposed system.It receives requests or data sent by EVs and EVPSS, triggers a logic based on business objects to which Algorithm 1 has been deployed, and finally to delegate the path drawing on EV application that constitutes the answer to the request.Thus, when executing Algorithm 1, the controller taking into account the following assumptions: • EVPASS is continuously connected to the electrical grid, and each has several charging sockets, and such that a number of EVs can be charged in parallel.

•
EVPSS are deployed geographically in a city.

•
EVs are equipped with Global Positioning System (GPS) [20,21] and wireless communication devices such as 3G to determine their current position and to provide charging request/response services.

•
First-come-first-served (FCFS) policy applied in EVPSS.So, if an EV entered at EVPSS where all its charging sockets are currently be used, the EV must wait for one of charging sockets to be free.

•
Each EVPSS contains an Ns number of charging sockets, the latter being identical and functioning according to an exponential service rate μ.

•
Each EV input into EVPSS sends, input data, the parameters of battery status and when it is output from the station, their battery is fully charged.

EVPSS Selection Decision Algorithm
The execution of the Algorithm 1 by the server is performed when an EV driver requests an estimate of the trip duration, including the charging time.The result of this execution is to select a CS based on a list (LIST) of the CSs deployed in the smart city.
The criterion selection is based on the minimization of trip duration which consists of the arrival time from EV to CS (T arr ), the waiting time, and the charging time of EV in CS (T wait ), and the trip time of EV between CS selected and its destination (T cs, evd ).Line 1 indicates the loading of the list (LIST) by all CSs from the database.In line 2, the CS min is initialized by the first CS of the list (LIST) in order to initializing the minimum trip duration, line 3.To obtain the station that meets our objective, the algorithm traverses all the CSs registered in list (LIST), between line 4 and line 17.At each iteration, it extracts the parameters of the following CS in order to calculate T trip of EV through this CS, between line 5 and line 12.In line 15, the CS replaces the CSmin if the obtained T trip is less than the T tripMin .

Logical Layer
The logical layer or controller is for the essential role of coordinating the sequences of actions/reactions of the proposed system.It receives requests or data sent by EVs and EVPSS, triggers a logic based on business objects to which Algorithm 1 has been deployed, and finally to delegate the path drawing on EV application that constitutes the answer to the request.Thus, when executing Algorithm 1, the controller taking into account the following assumptions: • EVPASS is continuously connected to the electrical grid, and each has several charging sockets, and such that a number of EVs can be charged in parallel.

•
EVPSS are deployed geographically in a city.

•
EVs are equipped with Global Positioning System (GPS) [20,21] and wireless communication devices such as 3G to determine their current position and to provide charging request/response services.

•
First-come-first-served (FCFS) policy applied in EVPSS.So, if an EV entered at EVPSS where all its charging sockets are currently be used, the EV must wait for one of charging sockets to be free.

•
Each EVPSS contains an Ns number of charging sockets, the latter being identical and functioning according to an exponential service rate µ.

•
Each EV input into EVPSS sends, input data, the parameters of battery status and when it is output from the station, their battery is fully charged.

EVPSS Selection Decision Algorithm
The execution of the Algorithm 1 by the server is performed when an EV driver requests an estimate of the trip duration, including the charging time.The result of this execution is to select a CS based on a list (LIST) of the CSs deployed in the smart city.
The criterion selection is based on the minimization of trip duration which consists of the arrival time from EV to CS (T arr ), the waiting time, and the charging time of EV in CS (T wait ), and the trip time of EV between CS selected and its destination (T cs, evd ).Line 1 indicates the loading of the list (LIST) by all CSs from the database.In line 2, the CS min is initialized by the first CS of the list (LIST) in order to initializing the minimum trip duration, line 3.To obtain the station that meets our objective, the algorithm traverses all the CSs registered in list (LIST), between line 4 and line 17.At each iteration, it extracts the parameters of the following CS in order to calculate T trip of EV through this CS, between line 5 and line 12.In line 15, the CS replaces the CS min if the obtained T trip is less than the T tripMin .After traversing all the CSs, the algorithm returns the CS to which the EV driver will spend a minimum trip time, including the charging time, line 18.The Table 1 contains the meaning of the variables used in the algorithm.The minimum time for EV arrives at their destination S ev Moving speed of EV

Data Base Layer
The growing demand for electric vehicles in the future requires a powerful and efficient information storage tool.So, we are relying on the Big Table, which is integrated in Google's Data Store tool to develop the database layer.This tool adopts the concept of entities, which helps us to structure the data sent by EVPSS and EVs via the REST architecture that we have chosen as a communication protocol between the system actors.Moreover, it is a distributed tool on several data centers, very fast in execution of queries, able to handle heavy loads, and very resistant to errors.

Performance Evaluation
We used programming with JAVA on Android to develop the architecture of the proposed system and to simulate the communication between the EV, the public charging stations, and the global aggregator (GA) in which we deployed the server of the business layer.
The mobile interface of the EVPSS allows the management of the input and output flows of electric vehicles in a charging station.Figure 4 shows the extraction of the ticket during the entry and the mobile interface that has implemented to allow EV drivers to search for the charging station with the minimum waiting time.We used the Google Maps API to indicate the location of the charging station by specifying the appropriate route.
three vehicles per hour which represents the parameter μ, service rate.We dispose two global aggregator (GA) in the city center in Agadir, the first one (GA1) uses ALs1 and the second one (GA2) based on ALs2, to manage charging requests of EVs.On the server side, we created a project on the Google App Engine platform to publish our server application.
We implemented a custom simulator in Java to evaluate Algorithm 1 (Alg.1) of the proposed system and compare it with Algorithm 2 (Alg.2) proposed in [12], the latter algorithm allows to determine the charging station where waiting time is minimal without taking into account EV driver destination.
As a case study, we simulated a network of electric vehicle drivers covering an area of 8000 × 18,000 m 2 , which was the center of Agadir in Morocco.As shown in Figure 5, there are ten fast charging stations with the parameters listed in Table 2.In this table, we have listed a number of virtual EVPSS stations, for example Wanma with coordinates of latitude 30.398747 and longitude-9.197610.We assume that the station above contains 10 charging slot and each slot serves three vehicles per hour which represents the parameter µ, service rate.

10:
if (T minWait > T wait ) 11: T minWait = T wait 12: CSmin = CS 13: end if 14: end while 15: send to EV the CSmin location In addition, 200 electric vehicles with a maximum speed of movement in cities fixed at 16 m/s are initialized in the network, 1000 electric vehicles are assigned to charging stations in a random way by initiating their queues.Thus, each EV needs charging must send to the server their current coordinates and the coordinates of their destination.
The comparison schemes in this evaluation are:

•
The trip duration estimated by Algorithm 2 is equal to the trip duration estimated by Algorithm 1, named A1EA2.

•
The trip duration estimated by Algorithm 2 is greater than the trip duration estimated by algorithm 1, named A1GA2

•
The trip duration estimated by Algorithm 2, by adding to the waiting time given by Algorithm 2 the arrival time of the EV at the selected charging station and the duration of the trip between this station and the EV destination, named Alg.2.

•
The evaluation measures are as follows: • Average trip duration: average duration of a VE experiences for his trip, through the recharge service to an intermediate CS.We dispose two global aggregator (GA) in the city center in Agadir, the first one (GA1) uses ALs1 and the second one (GA2) based on ALs2, to manage charging requests of EVs.

Figure 1 .
Figure 1.General architecture of smart grid.Reproduced with permission from [12].

Figure 1 .
Figure 1.General architecture of smart grid.Reproduced with permission from [12].

Figure 3 .
Figure 3. Communication scenario: (a) between electric vehicles (EV) and Server; (b) between electric vehicle public supply station (EVPSS) and Server.Reproduced with permission from [12].

Figure 3 .
Figure 3. Communication scenario: (a) between electric vehicles (EV) and Server; (b) between electric vehicle public supply station (EVPSS) and Reproduced with permission from [12].

Table 2 .
Parameters of electric vehicle public supply station (EVPSS).

Table 2 .
Parameters of electric vehicle public supply station (EVPSS).