MNN and LSTM-based Real-time State of Charge Estimation of Lithium-ion Batteries using a Vehicle Driving Simulator

Lithium-ion batteries (a type of secondary battery) are now used as a power source in many applications due to their high energy density, low self-discharge rates, and ability to store long-term energy. However, overcharging is inevitable due to frequent charging and discharging of these batteries. This may result in property damage caused by system shutdown, accident, or explosion. Therefore, reliable and efficient use requires accurate prediction of the battery state of charge (SOC). In this paper, a method of estimating SOC using vehicle simulator operation is proposed. After manufacturing the simulator for the battery discharge experiment, voltage, current, and dischargetime data were collected. The collected data was used as input parameters for multilayer neural network (MNN) and recurrent neural network–based long short-term memory (LSTM) to predict SOC of batteries and compare errors. In addition, discharge experiments and SOC estimates were performed in real time using the developed MNN and LSTM surrogate models. Keywords—Lithium-ion battery; state of charge; multilayer neural network; long short-term memory; vehicle driving simulator; real time


I. INTRODUCTION
With the recent occurrence of energy depletion and environmental pollution, research on eco-friendly and efficient energy sources is underway [1]. Recent developments in lithium-ion (Li-ion) batteries have yielded large energy density batteries with very low power losses (due to self-discharge) and longer life spans, making them the primary source of power for various electronic devices [2]. Secondary batteries, such as Li-ion batteries, also provide economic and environmental advantages over primary batteries used once and discarded. However, due to the nature of secondary battery operations (frequent charging and discharging), overcharging is a likely occurrence, in which case the electronic device may be shut down or risk an explosion [3]. Accurate identification and management of battery conditions are essential to solving these problems and ensuring efficient optimal usage and stability. A battery management system (BMS) helps manage energy efficiently and reliably when using secondary batteries. Related research has been recently undertaken as Li-ion battery applications continue to increase [4]. One of the parameters used in a BMS is the state of charge (SOC), an indicator of the remaining capacity of a battery, with 100% representing full capacity and 0% representing no capacity. It can also represent the state of health and the output performance of the battery [5]. Therefore, accurate prediction of SOC can help device users achieve better efficiency and reliability.
Methods for estimating SOC include open-circuit voltage (OCV), current calculation, and artificial neural network models. OCV is a method of estimating SOC by measuring voltages in open circuits where no current flows. However, it is difficult to achieve a real-time SOC estimation with this method due to the long stabilization time needed to attain equilibrium for accurate measurement [6]. The current accumulation method is easy to implement by randomly setting the initial SOC and then charging and discharging the battery to calculate the amount of change in the current. However, if the initial SOC setting deviates considerably from the expected value, the SOC error accumulates, making it difficult to estimate SOC accurately [7]. In this paper, The SOC was estimated using artificial neural networks. Artificial neural networks are implemented based on human brain structures and are used in various fields, such as pattern recognition, identification, and classification, and can efficiently learn the relationships between input and output parameters [8]. A battery SOC estimation using artificial neural networks does not require consideration of the battery's internal electrical and chemical properties. This method is advantageous for estimating nonlinear models and can operate on lowspecification processors [9] [10]. The artificial neural networks used in this paper are a multilayer neural network (MNN) and a recurrent neural network (RNN)-based long short-term memory (LSTM). An RNN is a neural network in which the previous learning information (history) influences the current learning [11]. It is structured in a chain format and is advantageous for predicting time-series data. However, as the amount of data increases, a gradient loss problem occurs; hence, an LSTM was employed to eliminate this challenge [12].
In this paper, a vehicle driving simulator has been built to estimate the SOC of Li-ion batteries based on the actual vehicle's output. After completing the production of the vehicle driving simulator, a Highway Fuel Economy Test (HWFET), a vehicle fuel efficiency test mode used by the U.S. Environmental Protection Agency, was applied to the motor driver in the simulator. Voltage, current, and discharge time data for the battery were collected according to the output of the simulator. The values were verified in real time and used as input parameters in the MNN and the LSTM for estimating the SOC.
*Corresponding Author www.ijacsa.thesai.org The composition of this paper is as follows. Section 2 describes the internal configuration and fabrication process of the vehicle driving simulator used in the battery discharge experiment. Section 3 introduces the proposed SOC estimation algorithm; MNN, one of the types of artificial neural networks used in this paper; and RNN-based LSTMs, and describes learning methods for SOC estimation. Section 4 describes the experimental process of the proposed algorithm, the number of input parameters, and the results of SOC estimation according to the MNN and the RNN used. Finally, Section 5 describes the conclusions of this study and plans for future studies.

II. VEHICLE DRIVING SIMULATOR
In this paper, a vehicle driving simulator has been created to determine the SOC change of the battery due to the actual vehicle output. The composition of the simulator is shown in Fig. 1.
The simulator is a two-wheel-drive vehicle consisting of a remote control (RC) car frame, four tires, two DC motors (rated voltage 12V and 6000 RPM), one motor driver (MDD3A), one Arduino pro-mini module, and one D.C. converter. The motor driver and Arduino pro-mini modules are devices designed to control the revolutions per minute (RPM) of the motor to be implemented according to the HWFET. It was applied as the driving cycle of the discharge experiment simulation, with the D.C. converter continuously adjusting the input voltage to the motor rated voltage of 12V. The HWFET, defined by the U.S. Environmental Protection Agency, is a test cycle to measure the fuel efficiency on a highway, as shown in Fig. 2.
Hyundai Motor's Avante Sports A.D. 16 model and 255/40/18 (cross-section width, flat ratio, wheel size) tire specifications were set as models to simulate precisely the actual vehicle speed. The motor's output in the simulator was controlled by the proposed motor driver for the HWFET after calculating the speed of the actual vehicle using the third gear ratio, tire specifications, and the motor RPM of the simulator. Fig. 3 shows a photograph of the built vehicle driving simulator. The simulator was fixed using steel frames and MC nylon board to prevent the simulator from moving or losing its balance due to motor vibration during the discharge experiment simulation.

A. Battery SOC Estimation Method
This paper proposes a method to estimate the SOC of a battery using a vehicle driving simulator, MNN, and LSTM. Fig. 4 illustrates the proposed battery SOC estimation algorithm. First, four fully charged batteries are connected in series and used as input voltage for the simulator. Next, the discharge experiment was conducted using a vehicle driving simulator. After the discharge experiment was completed, the measured voltage, current, and discharge-time data were sent to a PC using voltage and current sensors and the Arduino modules. After processing the transmitted data with different numbers of input parameters, Four MNN and LSTM models were developed respectively to estimate the SOC of each battery. www.ijacsa.thesai.org

B. Multilayer Neural Network
A MNN compensates for the shortcomings of perceptrons, which can only be learned limitedly because they consist only of linear functions, by adding one or more hidden layers between the input and output layers in the tomographic perceptrons. The MNN is shown in Fig. 5.
Single-layer perceptrons use the feedforward method to update weights. In MNN, feedforward and backpropagation are used, unlike a single-layer perceptron. Feedforward updates weights in the direction of the output layer at the input layer, but backpropagation is a method of reducing the error by updating weights in the direction of the input layer at the output layer. Backpropagation is divided into four stages; calculate output values using existing weights as a first step. Then, in two steps, a partial value of the error of each weight is subtracted from the existing weight. The next three steps are stage 2 for all weights. Finally, steps 1 through 3 are repeated for the given number of lessons. Fig. 6 illustrates the concept of a backpropagation [13]. Due to these MNN learning methods, they can be expressed more complexly than singlelayer perceptrons and are also advantageous for classification and numerical prediction.
The process of updating the weights of the backpropagation is shown in (1) through (5). First, the input and output values used to calculate net radio waves can be obtained from the following expressions.

= ∑
(1) where is the input value of the node j, is the weight of the i-th node entering the j-th node, ( + ) is the activation function, , is the output value of the previous node entering the i and j nodes, and θ is the input bias value. When updating weights with errors, the required values can be obtained in the following expressions: where l is the label value and X is the output value. Weights can be updated using the above obtained δ.
where t is the time index and η is the learning rate.

C. Long Short-Term Memoryn
The LSTM is an RNN-based neural network developed to improve the gradient loss problem as the distance between the learning data increases. Fig. 7 shows the structure of an LSTM, consisting of three gates and one cell state.
Equations (6)-(11) describe the process of the LSTM operation. First, the forget gate uses sigmoid functions to keep or discard previous and current learning data while the input gate stores the values to be updated in the cell state using the sigmoid and other activation functions. It then updates the cell state by adding the resulting values of the forget gate and input gate. Finally, the output gate determines the final output value by multiplying the current and previous data with the value from the sigmoid function, the value obtained by the cell state, and the value obtained using the activation function [14].   (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 12, No. 8, 2021 63 | P a g e www.ijacsa.thesai.org where ℎ −1 is the previous data, is the current data, w and b are the weights and biases, is the value of the previous and current data, and ̃ are the values of the sigmoid and the activation functions, is the updated value of the cell state, is the value of the output gate, and ℎ is the final output value.

A. Experimental Process
In this research, a battery discharge experiment was conducted using a vehicle driving simulator. The equipment used in the discharge experiment included four Li-ion batteries (rated capacity 1300 mAh), a power supply, a battery chamber (to ensure fire safety due to the strong reactivity of lithium ions [15]), a vehicle driving simulator, voltage and current sensors, and an Arduino module. Fig. 8 shows the equipment used for the discharge experiment and the experimental environment.
The battery charging and discharging experiments were conducted by connecting the four batteries in series. As expected in series connections, the same amount of current flows through each circuit. However, frequent charging and discharging may result in charge imbalances depending on the electrical and chemical characteristics of the battery and the battery operating environment [16]. Therefore, this experiment used a cell balancing module to equalize the voltage of the four batteries during charging and discharging. The sequence of experiments for estimating each battery's SOC is as follows: First, by defining a SOC of 100% (full capacity), the four batteries were fully charged at constant voltages of 4.2 volts via a power supply. Next, the batteries were kept for a stabilization period of about an hour to overcome charge imbalances. The discharge experiment was then conducted using the four batteries as input voltages for the vehicle driving simulator. Fig. 9 shows a voltage graph of changes during one cycle discharge experiment for each battery. The x-axis is the number of samples, and the y-axis is the voltage of each battery. The number of samples per cycle is between 2000 and 2200. One cycle of the discharge experiment is defined as from the beginning of the discharge experiment to the point when some of the four batteries are discharged and the vehicle driving simulator is shut down. The above steps were then repeated to obtain the voltage, current, and discharge-time data for 10 cycles. The discharge-time data used in this experiment is time data that accumulates from the beginning to the end of the discharge experiment.  These data were later transferred to a PC and then used as input parameters for the MNN and LSTM to estimate the SOC of each battery (Python, TensorFlow, and Keras package were used for learning). To obtain the SOC to be used as the training label for the MNN and LSTM, four fully discharged batteries were charged individually and then any initial SOC was specified. The current data acquired by the discharge experiment are then computed using the current calculation method. The current calculation method is presented as Where SOC(t) stands for SOC at time t, I(t) stands for current at time t, SOC(0) stands for initial SOC, and C stands for battery rated capacity.
Using MNN and LSTM, four models were developed that use different input parameters. The learning structure of MNN and LSTM used in this document is shown in Fig. 10 and 11. www.ijacsa.thesai.org  One discharge time data was added to each of the four MNN models and four LSTM models constructed using 2, 3, 4, and 5 values for voltage (V) and current (I) data. In Fig. 10 and 11, the input parameter (T) represents the time from the beginning to the end of the discharge experiment, and voltage and current data are sampled once every two seconds of the discharge experiment. The four MNN models all have the same hidden layer structure, consisting of two layers. The first node count was 128, the second node count was 64, and the sigmoid was used as an activation function. There was one node in the output layer and the model was trained using 15000 epochs. The four LSTM models all have the same hidden layer structure, consisting of three LSTM layers. The first node count was 150, the second node count was 100, the third node count was 50, and the sigmoid was used as an activation function. There was one node in the output layer and the model was trained using 5000 epochs.

B. Experimental Result
In this paper, The SOC was estimated by adding different numbers of voltage and current data and one discharge-time parameter to MNN and LSTM. The SOC errors of each estimated battery using MNN are presented in Table Ⅰ and Fig. 12. The models were named according to the number of input parameters employed: 5-input (two voltages, two currents, one discharge time), 7-input (three voltages, three currents, one discharge time), 9-input (four voltages, four currents, one discharge time), and 11-input (five voltages, five currents, and one discharge time). Each battery's error function was estimated using the mean absolute error (MAE) and is given as where is the number of data to be calculated, y is the estimated value of SOC, and ̂ is the predicted value using the current loading method and MNN or LSTM.
The SOC error estimated by the 5-input model showed that all four batteries had errors between 1% and 2%. The SOC error of the 9-input and 11-input models resulted in less than 1% errors on some batteries. The SOC error of the 11-input model is relatively smaller than that of the other models. The least estimated error (0.83%) among the four models was Battery 3 on the 9-input model. Consequently, the SOC estimation performance of 9 and 11 input models is considered to be superior to that of other models. The SOC error of each estimated battery using LSTM is presented in Table Ⅱ and Fig. 13.  The SOC error estimated by the all models showed that all had errors below 2%. The SOC error of the 7~11-input models resulted in less than 1% errors on some batteries. The SOC error of the 11-input model is relatively smaller than that of the other models. The least error (0.61%) was Battery 1 on the 11input model. Consequently, it is judged that the SOC estimation performance of 11 input models is superior to that of other models. Figs. 14 through 17 graph the SOC estimation results of the MNN models and LSTM models (Estimated Result of Battery 1). "Estimation" label and "Calculation" label in Fig. 14    Using the LSTM in Table Ⅱ, the estimated error of MNN in Table Ⅰ was compared, and the estimated error of MNN in 5input model was relatively small compared to LSTM. However, in other models with 7 to 11 inputs, LSTM's estimation performance can be determined to be superior to MNNs because the estimation error of LSTM was small.
According to Chemali et al. [17], the results obtained using LSTM showed an error of 0.573% at a fixed temperature of 10℃. The model with the smallest error in this paper was the LSTM 11-input model, with a SOC error of 0.61% for Battery 1, which was larger than that of Chemali et al. However, in the work by Chemali et al., the error in an environment with ambient temperature of 25℃ was 0.774%, indicating that the error in this work was smaller. Discharge experiments using the LSTM models in this work for SOC prediction in battery SOC estimation were made in real time. Fig. 18 shows a screen that uses the LSTM model to make real-time estimates. Real-time estimates were made using 7 inputs and 9 inputs, with the estimation errors shown in Table Ⅲ. The estimation results show that the error in real-time estimation is relatively higher than that shown in Table Ⅲ. It is judged that the error increased due to the influence of noise generated during real-time estimation. However, it was confirmed that real-time SOC evaluation using the learning model is possible.

V. CONCLUSION
In this study, we built a vehicle driving simulator to monitor changes in battery SOC when driving an actual vehicle and then applied the HWFET (cycle mode) to conduct discharge experiments. The SOC was estimated based on the obtained voltage, current, and discharge-time data using the vehicle driving simulator. We used that data as input parameters for the MNN and LSTM. We used four MNN and four LSTM models and compared the estimation errors of each model by adding two, three, four, or five voltages and currents and one discharge-time parameter. The SOC error of the four MNN models was less than 2%. Among the MNN models, the 9-input and 11-input models have errors of less than 1% in some batteries. The SOC estimation results of the LSTM model showed an estimation error of less than 2% for all four models and an overall error of less than 1% for the 7-input model and 11-input model. Estimation results from both MNN and LSTM show that the estimation error of the 11-input model is small compared to other models. Moreover, the SOC error results of LSTM were relatively small compared to MNN except for the 5-input model. Therefore, it was determined that the SOC estimation performance of LSTM was superior to that of MNN. Discharge experiments were conducted in real time using the 7-input LSTM model and 9-input LSTM model that were established for SOC estimation and SOC was estimated.
The discharge experiment was conducted using Li-ion batteries as input voltages for the vehicle driving simulators by checking and acquiring voltage and current data variations, which were expected to be applicable when driving an actual vehicle.
Further studies will consider conducting a discharge experiment by applying another driving cycle test, the Federal Test Procedure 75 (FTP-75) for city driving test used by the U.S. Environmental Protection Agency, to the vehicle driving simulators. The data obtained through the discharge experiments would be used as input parameters for MNN and LSTM to compare the SOC estimation and errors.