Real-time optimization in electric vehicle stations using artificial neural networks

The current study proposes a smart decision-making algorithm to be utilized in electric vehicle stations. The suggested approach emphasizes the prediction of queuing delay seeking for minimum total charging time. For this purpose, artificial neural network (ANN) model is used, where a dataset is pre-generated to be seeded into the model. The proposed model effectiveness can be proven when the number of arriving vehicles at the station exceeds the maximum number of charging points at the station. The model accuracy was recorded to reach 89%. For validity, the proposed ANN model was evaluated with respect to a meta-heuristic optimizer, showing a reduced total charging time by 2.5%, and 23.9% with respect to a bare model with no optimization. As a final validation step, a physical realization of the ANN model was conducted by emulating a vehicle as a transmitting node and the station as a receiving node.


Introduction
Nowadays, clean sources of energy gain awareness all over the world. This lead to a rapid increase in utilizing renewable energy resources as well as pollution-free automation [1]. The replacement of normal fossil-fuel-based vehicles by both hybrid [2][3][4] as well as electric vehicles (EVs) glows up significantly in the previous decade [5]. According to European free trade association (EFTA), the number of EVs sold increased by 18% in the period between 2010 and 2017 [6].
Following the work in [7], the number of electric vehicles is increasing rapidly in Amsterdam and it is predicted to reach 3.5 million vehicles per year according to [8]. However, such a booming take-off is still limited due to inconvenient long chagrining time as well as restricted decentralized charging topologies [9]. Consequently, researchers acted to efficiently optimize the charging process using various conventional as well as artificial techniques.
Integrating renewable energy resources with the energy management systems is the main key to reducing the fossil fuel pollution and optimization energy charged and discharged from the grid [10]. This can help to satisfy the local demand for energy besides reducing fossil fuel pollution [11]. District energy management system which minimizes energy cost showed improvement by integrating renewable energy resources with the energy storage systems and plug-in electric vehicles to the main grid. In such a context, linear programming effectiveness was validated as a robust algorithm [12]. A complete study was elaborated in [13] to review the importance of linear programming and nonlinear programming for electric vehicles optimization. Additionally, heuristic approaches such as sequential heuristic and Global heuristic were also reported in the literature, with enhanced performance over conventional optimizers [14]. Meta-heuristic models were efficiently utilized in minimizing the electric vehicle charging time and charging cost for centralized DC fast charging stations [9]. The meta-heuristic model demonstrated in [9] showed an outstanding capability in estimating the queuing delay per EV. However, the sophisticated objective function can limit the model extension to include more inputs. Moreover in [7] study aimed to estimate the cost of developing a new charging infrastructure under five scenarios used a Linear Integer Programming optimization model, on the basis of geographic data on car registration, existing EV chargers, and electricity substations. Although conventional optimizers recorded very acceptable accuracy in EV-based problems, the use of up-to-date artificial intelligent algorithms can influence the system performance positively.
Alternatively, in [15] artificial neural network (ANN) is trained using previously established database time series. The main goal was to minimize electricity cost by integrating electric vehicle and battery storage system under control of energy management system. The work demonstrated a very acceptable accuracy in achieving the targeted global optimum point. A study for a combination of mathematical optimization method and machine learning to estimate optimized solutions by being trained on previously optimized solutions [16]. This study showed that machine learning model is more accurate and efficient in obtaining the value of the optimized instances [16]. Moreover, the work in [17] introduces Multi-Deep-Q-Network (Multi-DQN) reinforcement to minimize charging time and charging cost. By screening literature, it can be observed that a literature gap is still detected regarding the overall chagrining time optimization. The gap is not only in terms of the effective charging time in the station but also concerning the queuing delay and the distance to reach the appropriate station. Herein, an ANN model is developed to be utilized in optimizing the EV total charging time in station(s). The algorithm acts to rank the EV charging sequence as far as the number of arriving EVs is greater than the number of charging points available at the station.
In the next section, section two, the dataset generation process is discussed, followed by an illustration of the ANN model used in section three. In section four, all simulation results have been demonstrated with model validation and evaluation. Finally, a physical realization model is presented in section five, while conclusion is provided in section six.

Dataset generation
As mentioned earlier in the introduction, the main aim of this work is to utilize ANN model in optimizing the overall charging time for an EV. In the current context, the overall charging time is introduced as: where T C is the effective charging time, T Q is the estimated queuing delay and T S is the time taken to reach the station. For fair comparison, the charging method is fixed, assuming DC constant current constant voltage (DC-CCCV) approach as already discussed in the previous work in [9]. Accordingly, the ANN model should be seeded with the required dataset to be able to estimate the overall charging time. Herein, the introduced model assumes three main inputs to the ANN model: the distance between the EV and the station ( d n ) , the initial state of charge ( SOC i ) , and the battery charging capacity ( CC) . The weather condition as well as the traffic is included in the distance between the EV and the station ( d n ) . The distance is turned into time to reach the targeted station in the proposed dataset. The conversion of time into distance is based on the EV speed, the traffic density, and the area classification: rural, urban or suburban.
In the current model, we assume a DC fast charging as an optimized charging technique with respect to both time and charging cost per kWh. The Levelized Cost of Energy (LCOE) for different charging techniques, including AC charging (220 V and 110 V), DC constant current constant voltage (CCCV) charging and DC fast charging. We consider the LCOE as one of the main evaluating parameters in this stage because LCOE includes both the impact of the system costs and the energy variation in terms of power variation per technique. LCOE is calculated as a function of the (1) T TotalCharging = T C + T Q + T S capital cost (LE), the running cost, and the energy sold to the grid (LE). The installation capital cost and all other related maintenance and running costs are conducted following the same approach in [9]. As a result, DC fast charging recorded a constant electric tariff of 1.60 LE/KWh. It is worth to highlight that in the system under investigation we assume a constant charging cost based on the Egyptian government charging regulation. As the current model is assumed to be in El-Sherouk City, Egypt (30,07,03, N-31,36,20, E).
In order to construct an appropriate dataset to be inputted to the ANN model, 12 various EV from different manufacturers [9] were utilized to map the assumed EV arrival distribution as given in [18]. This results in an overall of 154 EVs per day per station. Considering the three main inputs mentioned above, the EV CC is fixed per EV battery as given in [19]. For both d n and SOC i , Monte Carlo simulation technique (MCST) has been utilized. MCST is a wide base of computational algorithms that generate a group of randomized data [20] for a specific group of data that have the same mean and same standard deviation. Besides predicting the probability of occurrence of unexpected value to happen, it can determine this event.

Artificial neural network model
In general, to minimize queuing delay during EV charging an optimization model should be followed. Several techniques based on probabilistic dynamic network and training mathematical model can be utilized [21][22][23]. One of these methods is the Levenberg-Marquardt method [24]. Levenberg-Marquardt has been chosen in this work as it showed the highest validation among other algorithms, including Bayesian regularization and Scaled conjugate gradient, as reported in [25]. A detailed illustration for the Levenberg-Marquardt is demonstrated in the flowchart in Fig. 1. As the time series app helps in utilizing the inputs and outputs to continuously predict the minimum future EVs queuing delay. A real-time autoregressive nonlinear optimization algorithm [26] is used to rank EVs according to the SOC at station (SOC S ) , d n , and EV battery CC . The SOC S is defined as: where SOC 1Km represents the expected reduction in the SOC per 1 km distance.
In the current study, two scenarios were considered for queuing delay optimization. Firstly, a data set of 154 vehicle with only one charging station is used to optimize EVs charging time by ranking EVs upon arrival at the station. A queuing delay occurs when the number of arriving EVs exceeds the number of charging points at station. Herein, it is assumed that there are three charging points per station.
Furthermore, the data is enlarged to 770 vehicles with five charging stations, considering the same ratio of 154 EV/station. This ensures the capability of the model to be inputted by various datasets based on the given boundaries. An added output is generated related to the ranking of optimum station per EV to be used in charging, not only based on the distance to station d n , but also based on the station availability. The proposed model is implemented assuming three charging points per station, however, the model can perform updates in case of charging point failure so that the station priority decrement accordingly.

Results and discussion
In this section, all simulation results are demonstrated. Initially, the ANN model accuracy is investigated using the seeded dataset in terms of training, testing, and validation. Secondly, the station model with 154 EVs is presented seeking an optimal EV arrangement to minimize the overall queuing delay. Then, the model is extended to include five stations, with still 154 EVs/station. Finally, the utility of the ANN model is evaluated with respect to a previously published meta-heuristic model and another reference model where no optimization algorithm is implemented.

ANN model validation
To ensure the suitability of the chosen ANN model described in Sect. 3 with respect to the optimization problem under test, the generated dataset was tested as shown in Fig. 2. The dataset has been divided into three subsets: training, validation, and testing. A 70% of the dataset was included as a training data, where the model learning process is conducted. Another 15% of the dataset is used for validating the data in terms of the data range under test. Finally, the reaming 15% are seeded as new input to the system to examine the prediction capabilities of the learning process implemented with the first 70% of the dataset. As illustrated in Fig. 2, the accuracy of the validation process showed around 93%, while 91% and 71% were observed for the validation and testing process, respectively. As an overall accuracy performance indication, 89% accuracy was recorded for the suggested ANN model. We consider this output as an acceptable accuracy for the model to be used in the current study.

Single-station scenario
As a first step toward implementing the proposed ANN model in the EV optimization problem, the constructed dataset of 154 EVs was assumed to arrive at one station per day, where the arrival distribution was mapped similar to the work in [18]. The arriving time, the initial state of charge and the distance between the EV and the station are all output from MCST randomizer, to be seeded to the ANN model. Per EV, the ANN model outputs the total charging time as the sum of the charging time using DC-CCCV approach, the time taken to reach the station and the queuing delay. It is worth to highlight that the main predicted output is the queuing delay as the first two outputs are deterministic outputs. Obviously, the queuing delay occurs if, and only if, the number of arriving EVs at station is greater than the number of charging points, which is taken to be three points in our case. Accordingly, for investigation, we highlighted the rush hours case where the probability of queuing delay is maximized. Following the arrival distribution in [18], as well as the work in [9], a peak is predicted by 5 pm, at which around 25 EVs reach the station. Consequently, this portion is demonstrated in Fig. 3a that shows the time charging sequence of the 24 EVs across the three charging points. Such a charging sequence is extracted from the proposed ANN model. In this model, the overall charging time recorded was 155.41 min to charge the 24 EVs reaching station during rush hours.

Five-station scenario
To examine the expandability of the proposed model, the same approach in Sect. 4.2 is extended to include five stations with 770 EVs, to ensure the same EV ratio per station. However, due to the randomization associated with the MCST model, a non-uniform distribution of EV among the five stations was observed. Station, one received 137 vehicles, while station two charged 141 vehicles, station three had 164 vehicles, station four had 168 vehicles and station five had 160 vehicles. We believe that such non-uniform distribution reflects the reality in the model rather than having a biased uniform distribution. Additionally, it is worth to mention that the EV decision concerning the selected station is a part of the ANN model. In other words, it was not only due to the nearest distance but also due to the availability of charging point in the targeted station to avoid large queuing delay. Such a procedure can be illustrated in the flowchart given in Fig. 4.
Applying the same approach in Sect. 4.2, the rush hours EVs per station were demonstrated in Fig. 3b- 1 3 failure. The 8 EVs gap was distributed across the remaining four EVCSs, with 30% increase in EVs approaching EVCS #1. Alternatively, the five stations' overall queuing delay has increased by 7% on average concerning the regular model. We can attribute this to the reduction in the charging resources, which impacted the station with CP failure and influenced the overall system delay. Logically, CP failure negatively attribute to the overall queuing delay, as demonstrated in the above case study. However, such impact can be controlled by introducing the partial charging coefficient. Herein, each EV final state of charge is not maintained at 100%. Accordingly, the overall queuing delay can be compensated. This flags the trade-off between SOC and charging time, the higher the targeted SOC, the larger the queuing delay.

ANN against metaheuristic optimizers
In the introduction section, it was highlighted that various optimization techniques can be utilized to study EV problems. Based on that, the capability to catch the global optimum point (maximum or minimum) in a fastest way, is usually the target. In the current context, the target parameter is the minimization of the queuing delay seeking for minimum charging time. Consequently, this section demonstrates a comparison between utilizing ANN as a part of a machine learning model against water cycle optimization technique, as a meta-heretic optimizer. A third reference model is also included as a bare model with no optimization technique utilized. For the water cycle optimization algorithm, the model in [9] is used with the objective function given by: where WCOT is the optimization factor to be minimized using WCOT, T nor. ( ) is the normalized charging time concerning the maximum DC-CCCV charging time, C nor. is the normalized EV battery charging capacity, SOC is ( 1 ) the normalized state of charge upon arriving to the station, β is a weighting factor for the corresponding elements, δ is the number of EVs and σ is the coefficient for partial charging. The normalization implemented in this model is with respect to the maximum value across the selected dataset, while the number of EVs is still fixed to 154 EV/ station as in the previous two sections. Figure 6 shows the total charging time, as defined in Eq. (1) when using ANN model, WCOT model and no optimization model. Again, the EVs during rush hours, where the number of arriving EVs exceeds the number of charging points, were considered for demonstration in Fig. 6. Principally, the bare model, where no optimization model is used, recorded the maximum charging time across the selected 11 EVs (sample for demonstration). On the other hand, a debatable variation between the ANN model and the WCOT model was observed. In terms of the average total charging time, the ANN reached a minimum of 5.46 min which represent 29.96% while the WCOT exceeded it with 7 min represents 36.20%. Such a competitive trend validates the effectiveness and utility of ANN in ranking EVs arriving at the station, seeking minimum queuing delay.
To assess the utility of the proposed ANN model, the model is evaluated against our WCOT model as illustrated above. The work in [9] demonstrated meta-heuristic/nonlinear programming optimization models that can estimate the EV queuing delay as well as the entrance to the station sequence. Applying the same boundaries, in terms of number of EVs and stations, the two models were compared. It is a fact that the ANN model adds some complexity to the system. However, the observed accuracy in capturing the global minimum and estimating the queuing delay was enhanced through the ANN with respect to the water cycle optimization technique (WCOT) in [9] by around 12.48%. In a detailed manner, the superiority of our proposed ANN model over the previous work in [9] can be observed in both minimizing queuing delay as well as maximizing EV charging capacity. The work in [9] acted to minimize the queuing delay by limiting the EV charging capacity by introducing the partial charging factor (σ). As a result, the queuing delay is minimized, while the charging capacity of the served EVs is not at maximum level. The suggested ANNN model reached a global minimum point for the queuing delay, with all served EVs charged up to 100%. Another added value is considered in building an accumulative learning curve through updating the ANN database per EV arrival. Herein, the ANN can make use of all previous history of both EV and station in making the decision, while the WCOT still rely only on the instantaneous data received from the EVs arriving at the same time.

Physical realization
In this section, we propose a real model implemented on an embedded system to prototype electric vehicle that communicates with an electric vehicle station. Our proposed real-time ANN energy management model is deployed on an Arduino kit for measuring the SOC and calculating the expected total charging time. The model pretends to estimate the queuing delay using the developed ANN model, previously discussed, and validated. A series of experimental measurements were recorded and compared with ANN model expectations.
As a prototype, six electric vehicles are assumed to arrive the station at the same time, while the number of chagrining points in the station is limited to three points (as mentioned earlier). In this scenario, EV number 4 is emulated with a variable SOC, while the remaining vehicle's SOC is static. The model depends upon scaling down vehicle number 4 battery which was FIAT 500 Model 2018 with a battery capacity of 42 KW h to small battery used with small capacity. A 9-V battery is used, while Arduino is acting as a control unit. The Arduino is deployed with the proposed ANN model that can determine the SOC as well as predict the total charging time, assuming CCCV charging approach.
For estimating the queuing delay, a real-time ANN energy management model is utilized as described in the flowchart demonstrated in Fig. 1. The model is considered a possibility for a queuing delay whenever the number of arriving vehicles is more than the available charging points at the station side. The illustrated model was deployed on the Arduino kit for physical realization. The Arduino kit supplies the circuit with 5 V and the LCD is supplied by 10 V total, and the data wires connected to (8,9,10,11,12,13) digital pins with (RS, E, D4, D5, D6, D7). LEDA connected to positive side to provide better vision, and the batteries are connected to potentiometer to vary the output voltage controlling the SOC as shown in Fig. 7. Consequently, the real circuit realization is shown in Fig. 8.
The model shows that the queuing delay is directly proportional to the SOC. In other words, when the SOC increases the queuing delay increases. This means that the optimization algorithm identifies the high-priority vehicles which have the smallest SOC to minimize the queuing delay for those vehicles as it reaches zero. While the vehicle which has large SOC will have the largest queuing delay time, they have the shortest charging time. Overall, the average charging time including the queuing delay when applying optimization technique for those vehicles is less than the average charging time without applying this technique.

Conclusion
In this paper, the impact of queuing delay on the total charging time of an EV in a centralized DC station has been investigated. The proposed ANN model acted to optimize the queuing delay by ranking EVs reaching the station simultaneously. The charging sequence for two different scenarios with variable number of stations is discussed. The ANN model validity was evaluated with respect to a meta-heuristic optimizer, recording a better capability of targeting a global minimum by around 2.5%. Finally, a primitive attempt to physically realize the model was performed, where two communicating nodes were chosen to prototype the EV and the station.