Theoretical and Experimental Analysis of a New Intelligent Charging Controller for Off-Board Electric Vehicles Using PV Standalone System Represented by a Small-Scale Lithium-Ion Battery

: Electric vehicles are rapidly infiltrating the power grid worldwide, initiating an immedi-ate need for a smart charging technique to maintain the stability and robustness of the charging process despite the generation type. Renewable energy sources (RESs), especially photovoltaic (PV), are becoming the essential source for electric vehicle charging points. The stochastic behavior of the PV output power affects the power conversion for regulating the battery charger voltage levels, which influences the battery to overheat and degrade. This study presents a PV standalone smart charging process for off-board plug-in electric vehicles, represented by a small-scale lithium-ion battery based on the multistage charging currents (MSCC) protocol. The charger comprises a DC– DC buck converter controlled by an artificial neural network predictive controller (NNPC), trained and supported by the long short-term memory recurrent neural network (LSTM). The LSTM network model was utilized in the offline forecasting of the PV output power, which was fed to the NNPC as the training data. Additionally, it was used as an alarm flag for any possible PV output shortage during the charging process in the long- and short-term prediction to be supported by any other electricity source. The NNPC–LSTM controller was compared with the fuzzy logic and the conventional PID controllers while varying the input voltage and implementing the MSCC protocol. The proposed charging controller perfectly ensured that the minimum battery terminal voltage ripple and charging current ripple reached 1 mV and 1 mA, respectively, with a very high-speed response of 1 ms in reaching the predetermined charging current stages. The present simulated and experimental results are in good agreement with the previous related work in the literature survey.


Introduction
Technological advancement revealed the electric vehicle (EV) as a revolutionary technology for minimizing greenhouse gas emissions and contributing to power grid electricity compensation [1]. In recent years, the number of EVs has increased exponentially, and they have been proposed as an alternative direction for freedom from dependence on oil, as a solution to air pollution, and for use in advanced energy storage systems [2][3][4]. The rechargeable battery employed in the EVs is often characterized as having a long-term lifetime, where current ripple and low coulomb charge-discharge cycles at high frequencies affect the battery's performance, degradation, and lifespan [5,6]. EVs' battery chargers are broadly classified as on-board and off-board chargers [7,8]. The on-board chargers are widely known as AC chargers, which can be a single-phase Level 1 or Level 2 charger, defined as SAE J1772, or a three-phase AC charger, defined as SAE J3068. The off-board chargers are referred to as DC chargers, which ensure higher charging current rates, defined as SAE J1772-Combo/CHAdeMO standards [9,10]. The off-board charger ensures safe and fast charging capability [11]. Its charging protocols are the constant current constant voltage (CCCV), multistage charging current (MSCC), and pulsating charging current (PCC) protocols [12]. The constant voltage (CV) stage was replaced by the fuzzy-controlled active state-of-charge controller (FC-ASCC) and grey-predicted lithiumion battery charge system (GP-LBCS) to speed up the charging process in [13,14]. However, integrating those techniques into a commercial battery charger is not an option due to its complicated control algorithm [12]. In [15,16], the design of different battery chargers for EVs was introduced using some particular aspects of power electronics in the EV battery charger design. It was stated that one of the main challenges in the design was limiting the current ripple to not exceed 10% according to the standards. Hence, the MSCC protocol has been used due to the high charge/discharge energy efficiency and short charging time [17][18][19][20]. In [21], a control strategy for EV charging was proposed based on a three-phase, three-level neutral-point clamped (NPC) rectifier. The controller was optimized using the genetic algorithm (GA) to reduce the DC-bus current fluctuation in the level 1, level 2, and DC modes. However, the input voltage was constant, and a DC mutation period reaching 15ms in the single-phase charging mode was observed. In [12], the off-board charger was used based on the four-stage constant current stages where the Taguchi method was employed to determine the charging current of the Sanyo 840 mAh 3.6V lithium-ion battery. However, a fluctuation was observed in the output voltage during the PWM waveform of the inverter without any further investigation.
As a result, industries are focusing on EVs' battery chargers, which are considered the main interface between the electric power supply and vehicles [8]. Renewable energy sources (RESs) such as photovoltaic (PV) and wind turbine generators (WTG) are utilized for charging the EVs (PV-EV and WTG-EV, respectively) to reduce the utility grid overload [8]. The PV stand-alone system is one of the on-board and off-board chargers used for charging the EV solely without support from the utility grid. It is more beneficial in remote areas and more efficient because it has fewer conversion stages [22,23]. The main disadvantage of PV systems is the irregular stochastic voltage level. Hence, the challenge with this method is that it requires power conversion for regulation and matches the voltage levels for the battery chargers. Where the output voltage ripples, charging current ripples overheat the battery and shorten its lifespan [24]. With the blossoming development of EVs, DC-DC converters have been utilized to regulate the output voltage and alleviate the battery current ripples [3,6,25]. However, converters are still facing challenges to rapidly reach the desired output voltage with minimum error, such as load variation, disturbances in the input voltage, parameter deviation, and pulse width modulation (PWM) saturation constraints of the converters [4,19,26]. To resolve the challenges stated above, three main categories of control methods, conventional, advanced, and artificial intelligent (AI) control techniques, are used for the control of the DC-DC converters. The conventional control methods can be classified as voltage mode controller (VMC) and current mode controller (CMC). The VMC uses PI, Type II, or Type III compensators with a single closed-loop voltage feedback [27,28]. The CMC uses dual-voltage and current loops to improve the performance of the converter, but it depends on a current sensor and a latching circuit based on a clocking signal. Additionally, the output voltage control could be affected by the two controlled loops [3,29]. In recent years, diversified advanced control techniques have been investigated, such as the sliding mode control (SMC), fuzzy logic controller (FLC), and model-predictive controllers (MPC). The SMC method improved the performance of measuring the transient response. However, the need remains for an extra capacitive current sensor, high-switching frequency to ensure a good dynamic response, which causes losses, and a less-complicated filter design as it is not suitable for high-power converters [3,30,31]. FLC responded quickly to changing environmental conditions with the knowledge of the system parameters, and it dealt only with the error and change of error of the predetermined reference [32]. MPC is a method of designing and implementing a feedback control system that performed better than conventional methods [33,34]. In [34], the output voltage was controlled based on MPC under variable load conditions. An offset-free model predictive controller (MPC) for DC-DC buck converter was proposed in [35] for optimal voltage tracking and for optimizing transient dynamics. However, this controller is used to feed only constant power loads (CPLs). Artificial intelligent (AI) is a prevailing control technique for developing efficient methodologies to deal with a huge amount of data by investigating patterns and underlying structures in various scientific fields where heterogeneous data are available [36]. Some of the most widely used AI techniques are: heuristic techniques, expert systems, and machine learning, with its categories and sub-categories of unsupervised learning (clustering, metric learning, and anomaly detection), supervised learning (decision trees, support vector machines, and neural networks), and reinforcement learning (Markov decision processes, Deep Q-Networks, and Q-learning) [37,38].
AI has been exploited in the fields of vehicular environments, such as charging management, transmission scheduling, and control [36,38,39]. Q-learning technique, which is a kind of reinforcement learning, was used in [40] to forecast the plug-in hybrid EVs' charging loads. In [41], the recognition of online plug-in electric vehicles (PEV) has been provided with statistical modelling of the charging habits throughout a supervised classification method. Q-learning was used in the interaction between the electric vehicle and grid in [42] by investigating the grid-to-vehicle (G2V) charging and vehicle-to-grid (V2G) discharging approaches. Machine learning was developed in [43] to optimize a parameter space specifying the charging voltage and current profiles for batteries. The planning of the PEV load modelling was verified by fuzzy method, artificial neural network, Markov chain, and pdf-fitting method as stated in [44]. The driver's perception was expanded to enhance the comfort, safety, and efficiency of the driving, based on a vehicle-to-everything (V2X) system with AI [37]. Energy storage management systems between the lithium-ion battery and supercapacitors have been utilized to feed the vehicle's traction electric motor [45]. Optimal scheduling of networked microgrids, considering the penetration of EVs, was proposed efficiently based on a support vector machine (SVM) in [46]. A boost converter based on an artificial neural network (ANN) was used in the battery charger [24]. However, the mean absolute percentage error (MAPE) reached 0.282% and 0.307% in the training and testing, respectively. In addition to the introduction of AI in the EV market, DC-DC converter controllers based on NN supervised/unsupervised learning and reinforcement learning techniques are powerful tools concerning the noise and uncertainties [47][48][49][50]. AI networks were used to identify a black-box converter model in [51]. The neural network predictive controller (NNPC) that combined the advantages of both the NN and MPC was applied to the buck converter in [47], which investigated the accuracy during start-up and during the reference voltage variation. In [49], NNPC improved the transient characteristics of the digitally controlled buck converter. NNPC proved its efficiency, accuracy, and speed response concerning other advanced controllers in [3,52].
We can conclude that researchers used various methodologies to control the buck converter under various input and load conditions. Some of the studies presented in the literature are summarized in Table 1, where the performance and efficiency of the controller was investigated by substantial effective parameters, such as steady-state error, peak voltage, output ripple voltage, and settling time. In this study, a PV-EV standalone charging system was proposed based on a fully controlled DC-DC buck converter. The proposed methodology was directed to ensure very low battery output ripple voltage and charging current ripple. Hence, the contribution of this study can be summarized as: (a) Proposed the NNPC-LSTM controller that combined the advantages of the NN and MPC controllers and was supported by the LSTM model for fast-charging the lithiumion batteries.
(b) Utilized the LSTM network model in the offline forecasting of the PV output power, which was fed to the NNPC as training data. In addition, the LSTM was a flagger to the charging process if the PV output power was not sufficient for implementing the MSCC protocol.
(c) Investigated the system dynamic behavior during the charging process under various circumstances, while presenting the proposed NNPC-LSTM with respect to the FL controller and the conventional PID controller based on the MSCC protocol as a complement to our research in [20]; (d) Emphasized the superiority of the proposed controller during the lithium-ion battery charging process by an experimental implementation that was in good agreement with the simulated results.

Parasitic Buck Converter Model
The backbone of the EV charging process systems and electric vehicle charging stations is the DC-DC converters. In this study, the basic parasitic DC-DC buck converter was utilized to step down the output voltage of the RESs represented in the PV system, as shown in Figure 1. The modelling of the lithium-ion battery used was the RC second-order transient equivalent circuit model. This model represented the transient behavior of the polymer lithium-ion battery, as shown in Figure 1a. The equivalent circuit consisted of the open-circuit voltage OCV, which depended on the battery state of charge; internal resistances, including the ohmic internal resistance ( ), the electrochemical polarization internal resistance ( ) , and the concentration of the polarization internal resistance ( ); and lastly, the internal capacitances, such as the electrochemical polarization capacitance ( ) and the concentration polarization capacitance ( ). This model was proven to be the closest circuit model that could be used to explain the performance and behavior of lithium-ion batteries [20,60]. The values of the internal parameters corresponding to the battery state of charge (SOC) during an interval discharging pulse of 20 s at room temperature 25 °C are presented in Figure 1b-f, which were concluded from [20].
To describe the dynamic performance of the converter, the second-order differential equation of the parasitic DC-DC converter, in terms of the duty cycle, was introduced by the average model mentioned in [3] and expressed in the following equations and the graphical model in Figure 1g.
where is the average voltage on the diode, and are the inductor and capacitor internal resistances, respectively, is the measured voltage on the resistance , and is the renewable energy sources voltage.

Charging System Understudy
This study proposed an advanced dynamic charge controller for the lithium-ion battery through implementing a multistage charging current (MSCC) protocol based on the cuckoo optimization algorithm (COA) that was previously investigated in [19,20,61]. In the multistage charging currents protocol, the battery is charged by a multistage application of different currents, and the lifetime extends without degradation impact, compared with the constant current-constant voltage (CC-CV) methodology. The COA was implemented on an objective function used for the fast charging of the polymer lithium-ion battery with minimum energy consumption and a minimum charging interval time. The output charging process data of the algorithm represented in the different charging currents and their corresponding charging interval times were fed to the proposed charging system under study.
The controllers that were utilized in this study can be split into the proportional, integral, and derivative (PID) controllers; the fuzzy logic controller (FLC); and the artificial neural network predictive controller supported by the LSTM model (NNPC-LSTM). In addition to the aforementioned controllers, and due to the intermittency of the renewable energy sources (RES), long short-term memory methodology (LSTM) was used as the input-trained forecasted data to the NNPC controller, as shown in Figure 2.

PID Controller
The PID controller is one of the conventionally designed controller techniques used for DC-DC converters [53,62]. The proposed system was investigated in discrete times with a sampling period of 1ms. The process of selecting the controller parameters to ensure good performance was obtained by the automated tuning of the PID controller in the MATLAB/Simulink. Where the proportional parameter (P) was 0.007667, the integral parameter (I) was 3.37, and the derivative parameter (D) was −4.9. The proposed charging process using the PID controller is expressed as a graphical model in Figure 3a.

Fuzzy Logic Controller (FLC)
The concept of FLC was proposed from the fuzzy set theory, stated in [63]. FLC is a non-linear technique used in highly complex and non-linear systems as it does not require any mathematical model to control the system. It depends on the operator's experience to ensure sufficient rules for designing the fuzzy controller [64]. FLC has been used widely to control the DC-DC converters, as stated in [65][66][67]. FLC consists of three main stages: fuzzification, rule-based, and defuzzification, as shown in Figure 3b. The base rule of the DC-DC buck converter was proposed in [67,68]. The rule table of the proposed buck converter is shown in Table 2, where NB, NS, ZE, PS, and PB mean negative big, negative small, zero, positive small, and positive big, respectively. NNPC optimizes the plant's performance over a specific time horizon by calculating the control input. The first stage determines the forward dynamic behavior of the plant model, and it is called system identification. The plant model identification in this study represented in Figure 1b was used by the controller to predict the future performance of the system. The training signal was predicted through the error between the plant output and the NN output. The NN plant used the previous inputs and outputs to predict the future output values of the plant through backpropagation training, as shown in Figure  3c.
The controller's output charging currents were prevented to exceed the maximum constraints, as the input duty cycle was limited to the range from 0 to 1. In addition, the charging current was prevented to go beyond the 1A, where the network was trained offline in batch mode using the data collected from the proposed plant. The NNPC was developed based on the complete state-space represented model, as mentioned below.
In this study, the NNPC was supported with the long short-term memory model (LSTM) to forecast the PV panel's output voltage offline and independent from the instantaneous climate change of the PV panel, where all the data were predicted and fed to the system to train the model.

Long-Short Term Memory (LSTM) Model
Recently, researchers are forecasting the PV power through several approaches, categorized into statistical methods, physical methods, and artificial intelligence learning methods (AILMs) [69]. Statistical methods are dependent on the historical data and exclude points that are not conducive to these models. Physical methods investigate the characteristics of PV power generation without a large amount of historical data. AILMs utilize the mapping between input and output data and are used in power grids, energy consumption, pattern recognition, and power prediction [69]. To determine the power generated from the PV, solar radiation was estimated based on mathematical models supported by an artificial neural network (ANN). ANN was found to be more accurate when compared with the regression model, empirical regression model, empirical coefficient model, angstrom model, and fuzzy logic [70][71][72]. AI methods, especially the neural networks (NNs), are used excessively to manage the power market's operation based on precise load forecasting [73][74][75]. NNs are widely applied in forecasting because of their dependency on multilayer perceptron, previous data, and the non-linearity characteristic of the model [75]. Long short-term memory (LSTM) is considered a variation of recurrent neural network (RNN) and was originally developed by Hochreiter et al. [76]. LSTM has been applied in PV power prediction accurately by modelling the temporal changes in the PV data and forecasting the next step data [69]. However, the intermittency and randomness of the solar power cause unstable operations and control performance of the power grid. In addition, LSTM is typically implemented to capture the temporal patterns in monthly data and can estimate the power generation for any new site for which the weather information and terrain data are available, as in South Korea [77]. In [78], the LSTM was combined with wavelet transform (WT) to decompose the solar energy timeseries data into different frequency series for forecasting short-time output PV power. The core equations of the LSTM are expressed in Equations (6) to (11) [79] and are represented in Figure 4.
where , , , and are the output values of the forget gate, input gate, update gate, and output gate, respectively; ( , , , ) is the weight matrices; ( , , , ) is the bias vectors; is the memory cell; σ is the sigmoid activation function; ℎ −1 is the LSTM output value at time step t -1; and is the input data. Due to the intermittency of the RESs, especially PV systems, that causes difficulties and reduction in the real-time control performance, LSTM was implemented to predict the PV output power, voltage, and current accurately and fed to the NNPC with sufficient data to be used in training the model offline with minimal errors.

Theoretical and Experimental Analysis of the PID, FLC, and NNPC-LSTM Controllers
The parameters of the DC-DC buck converter that was used in the simulated and experimental investigation were = 10Ω, = 2.1 mH, = 0.0071Ω, = 470μF, = 0.117Ω; a switching frequency of 31 kHz; a lithium-ion battery of 1000 m.Ah with a nominal voltage of 3.7 V; and the nominal input voltage from RES being = 25V.
The PV solar panel had a rated maximum power of 100 W, rated voltage of 18 V, and rated current of 5.56 A.
To validate the proposed NNPC based on the LSTM method with respect to the PID and FL controllers, an Arduino UNO microcontroller board was integrated with MATLAB/Simulink. The experimental setup that was implemented is expressed in Figure  5.

Simulated Results
In this study, the reference trajectory duration of each controller was set as 0.4 s with a sampling time of = 1 ms, and it was changed randomly every 0.1 s. The results were scrutinized theoretically through the MATLAB/Simulink simulator program, where each training procedure took about 40 min to be simulated on a laptop Intel (R) Core (TM) i7-8550U CPU 1.80GHz with 8GB RAM.
The output from the MATLAB/Simulink program simulator is presented in Figure 6, where various scenarios were implemented in the dynamic charging process. Figure 6a presents the first scenario, where the input voltage was maintained constant at 25 V across the process, and the multistage charging currents, which are represented by / , were pronounced with very low variations, starting with 7.7 V, 5.6 V, and 8 V. It was shown that NNPC-LSTM had a very high-speed response, an enhanced settling time, and very low steady-state error with respect to the PID and FL controllers. In Figure 6b, the output charging current represented in / was maintained constant despite the variation in the input voltage of RES from 25 V to 12 V. It was observed that the NNPC-LSTM ensured the tracking of any change in the input voltage with the fastest response concerning the PID and FL controllers.

Experimental Validation
Before the validation of the proposed experimental setup and implementation of the NNPC supported by the LSTM in the training stage of the system, we investigated the climate and its impact on the PV output power and the importance of the LSTM in predicting the output power of the PV system.

PV Output Power Based on the Solar Climate and Module Characteristics
The daily average amount of the total solar radiation incident to the horizontal surface at the surface in El Shorouk, Cairo, Egypt (latitude: 30.1181 and Longitude: 31.6089) during the year 2020 was implemented as shown in Figure 7a. There was a significant variation in the insolation incident on the horizon surface during the year. To be more specific, a set of readings were implemented on a mono-crystalline solar module at the British University in Egypt (BUE) with a rated maximum power of 100 W, rated voltage of 18 V, and rated current of 5.56 A and were recorded by a PV system analyzer for 100 min on 17 December 2020, starting at 12:20:00 pm GMT. As shown in Figures 6c and 7b, the output power of the PV panel varied from one minute to another, reflecting the output current and voltage. The LSTM methodology in this research was responsible for two essential stages. The first stage was to predict the output power, voltage, and current of the PV panel to feed into the neural network predictive controller to train the model for an accurate and robust dynamic performance. The second stage was to give the precision characteristics' boundaries of the charging process. For example, in Figure 7c, the current reached 0.8 A at the minute counter 20. This limit should be noted as a feedback of a limitation of the charging process as stated in [20], or if the required charging current is higher than 0.8 A, the controller should complement the process by an alternative resource at this predetermined time.
In this study, the LSTM model was used to predict the PV output power through a training dataset of 34% and tested with 66% as shown in Figure 7d. The training dataset was considered to be 1/3 of the overall data, which revealed the effectiveness of the proposed network in predicting the PV output power; however, limited data were used in the training process. The root mean square error (RMSE) was used as a precision indicator of the PV output power estimation, which reached 5.0495 in this study and was an acceptable range according to the literature [69,81].

Experimental Analysis
In this subsection, a full experimental comparative study was investigated and proposed. Figure 8a reveals the performance of the charging process for various output charging currents, represented by the relation / . The NNPC-LSTM ensured that a quiet speed response reached 1 m/s with respect to the PID controller, which took 0.03 s to reach the desired charging required current during a constant input voltage of 25 V, and the FLC controller, which took only 0.02s.  Figure 8b presents the effectiveness of the NNPC-LSTM in maintaining the stability of the charging process, with a minimum steady-state error concerning the PID controller and FLC during the change in the input voltage from 25 V to 12 V. Finally, Figure 8c exposes the robustness and effectiveness of the proposed NNPC integration based on the LSTM method, which was used as training data for the NNPC and as a precise indicator of the boundaries of the charging process of the lithium-ion battery for different charging currents of 0.8 A, 0.5 A, and 0.8 A. In addition, during the charging process for any stage of charging, it was observed that the change in the OCV of the battery reached 1 mV voltage ripple and 1 ms settling time, as shown in Figure 8c.

Conclusions
This study presented a new artificial intelligence charging controller for the PV standalone off-board plug-in EVs. The charging point was controlled by the neural network predictive controller (NNPC) integrated with the long short-term memory network model (LSTM), which was applied to the DC-DC buck converters. In comparison to the conventional PID control and fuzzy logic controller (FLC), the NNPC-LSTM revealed better dynamic performance and robustness in various aspects. The NNPC-LSTM ensured high stability and a high-speed charging response while charging the small-scale lithiumion battery using the multistage charging currents (MSCC) protocol under variable input voltages. The battery terminal voltage ripple and charging current ripple were minimized to reach 1 mV and 1 mA, respectively. Due to the stochastic behavior of the PV system, the LSTM method was used with two main rules. The first rule was training the NNPC with the predicted PV output power based on a set of offline data. The second rule was estimating the characteristics of the charging process to make sure that the PV output power fulfilled the requirement of the process; otherwise, the system must be supplied from another source during a shortage of the PV power. The root mean square error (RMSE) obtained from using the LSTM reached 5.0495. The simulated and experimental investigation confirmed that the NNPC integrated with the LSTM model could track the predetermined reference and maintain the stability of the process under any condition.
The proposed controller could be extended and implemented on any DC-DC converter since the state-space model of the converter exists. In addition, the NNPC-LSTM could be scaled up and used for charging large-capacity lithium-ion batteries.