An Approach to State of Charge Estimation of Lithium-Ion Batteries Based on Recurrent Neural Networks with Gated Recurrent Unit

Abstract: State of charge (SOC) represents the amount of electricity stored and is calculated and used by battery management systems (BMSs). However, SOC cannot be observed directly, and SOC estimation is a challenging task due to the battery’s nonlinear characteristics when operating in complex conditions. In this paper, based on the new advanced deep learning techniques, a SOC estimation approach for Lithium-ion batteries using a recurrent neural network with gated recurrent unit (GRU-RNN) is introduced where observable variables such as voltage, current, and temperature are directly mapped to SOC estimation. The proposed technique requires no model or knowledge of the battery’s internal parameters and is able to estimate SOC at various temperatures by using a single set of self-learned network parameters. The proposed method is evaluated on two public datasets of vehicle drive cycles and another high rate pulse discharge condition dataset with mean absolute errors (MAEs) of 0.86%, 1.75%, and 1.05%. Experiment results show that the proposed method is accurate and robust.


Introduction
Compared with the fossil fuel-based energy, renewable energy has been more and more attractive because it is renewable and cannot be depleted, and it does not contribute to global warming or greenhouse effects. As the energy buffer in renewable energy systems, energy storage could increase the electric power efficiency of the customers and load shifting [1]. Lithium-ion batteries (LiB) have been the first choice of energy storage components [2] due to their advantages of the high energy density, long life cycle, and low self-discharge rate. LiB has a very high energy density, hence a great deal of energy can be stored in it due to the fact that electrodes of LiB are made of lightweight lithium, which is a highly reactive element. High energy density allows a 1 kg LiB to store the same amount of energy as 6 kg batteries made by lead-acid. Additionally, hundreds of charge and discharge cycles can be handled by LiB. Moreover, the charge lost by LiB is as low as 5% per month, whereas the Nickel-Metal Hydride (NIMH) battery has a 20% charge loss per month. Therefore, applications for portable electronics, electrified vehicles, and stationary energy storage are developing and are heavily dependent on LiB technology.
As one of the most important states to be tracked in a battery, state of charge (SOC) is defined as a ratio of the residual capacity to the maximum available capacity, which represents the amount of electricity stored. SOC not only provides reference information for the endurance of the battery but is also the basis of the battery management system (BMS) of the battery pack. BMS is beneficial to the

GRU-RNN for SOC Estimation
The recurrent neural network (RNN) was first put forward in the 1990s in the form of Elman and Jordan networks [35], which are also known as the "simple recurrent networks" (SRN). Different from the FNN, the RNN can use the internal state as the memory of the network. Therefore, the current state is jointly impacted by the current input and the previous state. This structure enables the RNN to deal with the time sequence problem by storing, remembering, and processing past complex signals for a period. RNNs have been widely used in natural language processing, time series forecasting, and system modeling. However, long time series and complex hidden layers may lead to gradients exploding and vanishing during back-propagation processes. This is called the long-term dependencies problem, and plenty of improved RNNs were proposed to solve the problem by designing the gating mechanism to control gradients information propagation. Among all the improved RNNs, the GRU-RNN is not only able to capture long-term sequential dependencies but also has a simple structure. Moreover, compared with other RNNs, it is more robust to vanishing gradients and needs less memory requirements. The illustration of the GRU-RNN cell is shown in Figure 1. Figure 1. Illustration of the gated recurrent unit memory cell. 1 t h  is the output of the previous hidden layer node, t x is input of the current hidden layer node, t h is the output of the current hidden layer node, t z and t r are the output of the update gate and the reset gate, respectively.
In Equation (1) to Equation (4), represents an element-wise multiplication; w is the weight parameter; b is the bias parameter;     is the gate activation function, which is set as sigmoid function and shown in Equation (5);   tanh  is the output activation function, which is set as tanh function and shown in Equation (6). The derivatives of sigmoid and tanh are the functions of the original function, thus the derivatives can be calculated by the original functions.
By introducing the above operations, the GRU-RNN can learn the long-term sequential dependencies. Only the forward propagation is required to obtain the SOC at each timestep during the testing stage. At the end of each forward propagation, the loss function L of the GRU-RNN is calculated as follows: 1 1 = n t t t L y y n     (7) where t y and t y are the real value and the estimated value at timestep t , respectively. n is the length of the sequence. Based on the gradient of the loss function, the GRU-RNN updates the weights and the biases by backward propagation. Since the GRU-RNN is a structure through time, it needs a different back propagation method, called the back propagation through time (BPTT), to train the network. Suppose that the intermediate variable t  is defined as: Figure 1. Illustration of the gated recurrent unit memory cell. h t−1 is the output of the previous hidden layer node, x t is input of the current hidden layer node, h t is the output of the current hidden layer node, z t and r t are the output of the update gate and the reset gate, respectively.
The forward propagation of the GRU-RNN is computed by Equations (1) to (4). Among these functions, Equation (1) represents the "update" operation of the GRU-RNN, Equation (2) and Equation (3) represent the "reset" operation of the GRU-RNN, and Equation (4) represents the "output" operation of the GRU-RNN.
In Equation (1) to Equation (4), represents an element-wise multiplication; w is the weight parameter; b is the bias parameter; σ(·) is the gate activation function, which is set as sigmoid function and shown in Equation (5); tanh(·) is the output activation function, which is set as tanh function and shown in Equation (6). The derivatives of sigmoid and tanh are the functions of the original function, thus the derivatives can be calculated by the original functions.
By introducing the above operations, the GRU-RNN can learn the long-term sequential dependencies.
Only the forward propagation is required to obtain the SOC at each timestep during the testing stage. At the end of each forward propagation, the loss function L of the GRU-RNN is calculated as follows: where y t and y t are the real value and the estimated value at timestep t, respectively. n is the length of the sequence. Based on the gradient of the loss function, the GRU-RNN updates the weights and the biases by backward propagation. Since the GRU-RNN is a structure through time, it needs a different back propagation method, called the back propagation through time (BPTT), to train the network. Suppose that the intermediate variable δ t is defined as: The errors in BPTT can be represented as Equation (9), and the errors passed to the upper layer can be represented as Equation (10).
where f (l−1) is the activation function of layer l − 1 neural network nodes, χ l−1 t is the weighted output of layer l − 1. δ z,t , δ r,t , δ h,t can be represented as: Gradients of weights and biases can be represented as: The forward propagation, the loss function calculation, and the error back propagation mentioned above constitute a complete training process of the GRU-RNN.
As shown in Figure 2, the inputs of the proposed GRU-RNN based SOC estimation method are the terminal voltage V t , the current I t , and the temperature T t of the battery at timestep t. The output of the GRU-RNN is the SOC t of the battery at timestep t. h t (1), h t (2), · · · , h t (k) are hidden layer nodes of the GUR-RNN, where k represents the number of hidden layer nodes and needs to be set in advance. The expansion diagram of a single hidden layer node in the GRU-RNN is shown in Figure 3. Hidden layer nodes take variables [V 1 , I 1 , T 1 ], . . . , [V T−1 , I T−1 , T T−1 ], [V T , I T , T T ] of time series t = 1, 2, · · · , T as inputs. The SOC t at t = T is the output. Other hidden layer nodes are in the same way. The errors in BPTT can be represented as Equation (9), and the errors passed to the upper layer can be represented as Equation (10). 1 , , , ht  can be represented as: Gradients of weights and biases can be represented as: The forward propagation, the loss function calculation, and the error back propagation mentioned above constitute a complete training process of the GRU-RNN.
As shown in Figure 2, the inputs of the proposed GRU-RNN based SOC estimation method are the terminal voltage t V , the current t I , and the temperature t T of the battery at timestep t . The output of the GRU-RNN is the SOC t of the battery at timestep t .

     
h h h k are hidden layer nodes of the GUR-RNN, where k represents the number of hidden layer nodes and needs to be set in advance. The expansion diagram of a single hidden layer node in the GRU-RNN is shown in Figure 3. Hidden layer nodes take variables     Figure 3. A single hidden layer node in the GRU-RNN unfolded in time.
The processes of the SOC estimation method based on the GRU-RNN are as follows: Step I: Normalize the testing dataset and divide them into a training set and a validation set.
Step II: Set the parameter of input layer nodes, hidden layer nodes, and output layer nodes of the GRU-RNN; select the form of activation functions, loss functions, and optimization algorithms [36].
Step III: Set the hyperparameters of the GRU-RNN including the timestep, sampling interval, batch size, and iteration. Initialize the weights and biases of the GRU-RNN.
Step IV: Select evaluation function and train the GRU-RNN with the training set. The training set consisting of voltage, current, temperature, and SOC measured values is fed into the initialized GRU-RNN and network parameters can be self-learned according to Equations (1) to (14).
Step V: Validate the effectiveness of the GRU-RNN for SOC estimation with the validation set. The validation set also consists of voltage, current, temperature, and SOC measured values. The voltage, current, and temperature measured values in the validation set are fed into the trained GRU-RNN to obtain SOC estimated values. By inputting the SOC measured values in the validation set and the SOC estimated values of the GRU-RNN into the evaluation function, the effectiveness of the GRU-RNN can be evaluated.

Testing Datasets of LiB
In this section, we present the testing data in detail, which are the keys to the GRU-RNN for SOC estimation. In practice, the operating conditions of LiBs are complex and changeable. Therefore, the testing conditions of LiBs should cover the operating conditions as far as possible. In order to satisfy the diversity of operating conditions, three testing datasets of LiBs were selected to verify the validity of the proposed method in this paper. The first two testing datasets are two public datasets, which were collected by testing Panasonic 18650PF battery cells [37] and Samsung 18650-20R battery cells [38] with a series of vehicle drive cycles at three different temperatures. The third testing dataset is a new dataset that was collected under high rate pulsed discharge conditions at three different temperatures.

The Panasonic 18650PF Dataset
The Panasonic 18650PF dataset [37] was collected by Department of Mechanical Engineering at McMaster University in Ontario, Canada. The Panasonic 18650PF battery cell has nominal voltage and a capacity of 3.6 V and 2.9 Ah, respectively. As shown in Figure 4, nine drive cycles, namely Cycle 1, Cycle 2, Cycle 3, Cycle 4, Supplemental Federal Test Procedure Driving Schedule (US06), the Highway Fuel Economy Test (HWFET), the Urban Dynamometer Driving Schedule (UDDS), the Los Angeles 92 (LA92), and Neural Network (NN) were applied to the same battery cell for 100% battery level at three different temperatures (0 °C , 10 °C , and 25 °C ). Among the nine drive cycles, US06, HWFET, UDDS, and LA92 were four common drive cycles of electric vehicles. US06 was a driving condition of electric vehicles with high acceleration. In the HWFET, electric vehicles were tested under 60 miles/hour. The UDDS was used for the driving conditions of light vehicles. The LA92 was developed for emission reduction. Cycles 1, Cycles 2, Cycles 3, Cycles 4, and NN were randomly mixed data composed of US06, HWFET, UDDS, and LA92. Voltage, current, capacity, and cell temperature were recorded in a 0.1-second interval, and more than five million data points were collected. A more detailed description can be found in reference [37], and the maximum values of currents were determined by the LiB operation conditions. The processes of the SOC estimation method based on the GRU-RNN are as follows: Step I: Normalize the testing dataset and divide them into a training set and a validation set.
Step II: Set the parameter of input layer nodes, hidden layer nodes, and output layer nodes of the GRU-RNN; select the form of activation functions, loss functions, and optimization algorithms [36].
Step III: Set the hyperparameters of the GRU-RNN including the timestep, sampling interval, batch size, and iteration. Initialize the weights and biases of the GRU-RNN.
Step IV: Select evaluation function and train the GRU-RNN with the training set. The training set consisting of voltage, current, temperature, and SOC measured values is fed into the initialized GRU-RNN and network parameters can be self-learned according to Equations (1) to (14).
Step V: Validate the effectiveness of the GRU-RNN for SOC estimation with the validation set. The validation set also consists of voltage, current, temperature, and SOC measured values. The voltage, current, and temperature measured values in the validation set are fed into the trained GRU-RNN to obtain SOC estimated values. By inputting the SOC measured values in the validation set and the SOC estimated values of the GRU-RNN into the evaluation function, the effectiveness of the GRU-RNN can be evaluated.

Testing Datasets of LiB
In this section, we present the testing data in detail, which are the keys to the GRU-RNN for SOC estimation. In practice, the operating conditions of LiBs are complex and changeable. Therefore, the testing conditions of LiBs should cover the operating conditions as far as possible. In order to satisfy the diversity of operating conditions, three testing datasets of LiBs were selected to verify the validity of the proposed method in this paper. The first two testing datasets are two public datasets, which were collected by testing Panasonic 18650PF battery cells [37] and Samsung 18650-20R battery cells [38] with a series of vehicle drive cycles at three different temperatures. The third testing dataset is a new dataset that was collected under high rate pulsed discharge conditions at three different temperatures.

The Panasonic 18650PF Dataset
The Panasonic 18650PF dataset [37] was collected by Department of Mechanical Engineering at McMaster University in Ontario, Canada. The Panasonic 18650PF battery cell has nominal voltage and a capacity of 3.6 V and 2.9 Ah, respectively. As shown in Figure 4, nine drive cycles, namely Cycle 1, Cycle 2, Cycle 3, Cycle 4, Supplemental Federal Test Procedure Driving Schedule (US06), the Highway Fuel Economy Test (HWFET), the Urban Dynamometer Driving Schedule (UDDS), the Los Angeles 92 (LA92), and Neural Network (NN) were applied to the same battery cell for 100% battery level at three different temperatures (0 • C, 10 • C, and 25 • C). Among the nine drive cycles, US06, HWFET, UDDS, and LA92 were four common drive cycles of electric vehicles. US06 was a driving condition of electric vehicles with high acceleration. In the HWFET, electric vehicles were tested under 60 miles/hour. The UDDS was used for the driving conditions of light vehicles. The LA92 was developed for emission reduction. Cycles 1, Cycles 2, Cycles 3, Cycles 4, and NN were randomly mixed data composed of US06, HWFET, UDDS, and LA92. Voltage, current, capacity, and cell temperature were recorded in a 0.1-second interval, and more than five million data points were collected. A more detailed description can be found in reference [37], and the maximum values of currents were determined by the LiB operation conditions.

The Samsung 18650-20R Dataset
The Samsung 18650-20R dataset [38] was collected by the Center for Advanced Life Cycle Engineering (CALCE) at University of Maryland. A 2.9-Ah, 3.2V Samsung 18650-20R cylindrical LiB was tested by four drive cycles-the Beijing Dynamic Stress Test (BJDST), the Federal Urban Driving Schedule (FUDS), US06, and the Dynamic Stress Test (DST). The current profiles of the drive cycles are shown in Figure 5. The maximum values of the currents were determined by the LiB operation conditions. All tests were performed for 80% battery level and 50% battery level at 0 °C, 25 °C , and 45 °C. The voltage, current, capacity, and cell temperature were recorded with a one second time step, and 1.4 million data points were collected. In contrast to the Panasonic 18650PF dataset, the data of charge, pause, and discharge in this dataset were recorded continuously.

The Samsung 18650-20R Dataset
The Samsung 18650-20R dataset [38] was collected by the Center for Advanced Life Cycle Engineering (CALCE) at University of Maryland. A 2.9-Ah, 3.2V Samsung 18650-20R cylindrical LiB was tested by four drive cycles-the Beijing Dynamic Stress Test (BJDST), the Federal Urban Driving Schedule (FUDS), US06, and the Dynamic Stress Test (DST). The current profiles of the drive cycles are shown in Figure 5. The maximum values of the currents were determined by the LiB operation conditions. All tests were performed for 80% battery level and 50% battery level at 0 • C, 25 • C, and 45 • C. The voltage, current, capacity, and cell temperature were recorded with a one second time step, and 1.4 million data points were collected. In contrast to the Panasonic 18650PF dataset, the data of charge, pause, and discharge in this dataset were recorded continuously.

The Samsung 18650-20R Dataset
The Samsung 18650-20R dataset [38] was collected by the Center for Advanced Life Cycle Engineering (CALCE) at University of Maryland. A 2.9-Ah, 3.2V Samsung 18650-20R cylindrical LiB was tested by four drive cycles-the Beijing Dynamic Stress Test (BJDST), the Federal Urban Driving Schedule (FUDS), US06, and the Dynamic Stress Test (DST). The current profiles of the drive cycles are shown in Figure 5. The maximum values of the currents were determined by the LiB operation conditions. All tests were performed for 80% battery level and 50% battery level at 0 °C, 25 °C, and 45 °C. The voltage, current, capacity, and cell temperature were recorded with a one second time step, and 1.4 million data points were collected. In contrast to the Panasonic 18650PF dataset, the data of charge, pause, and discharge in this dataset were recorded continuously.

High Rate Pulse Discharge Condition Dataset Collection
To validate the GRU-RNN's ability for SOC estimation in extreme working conditions, a new dataset of an 18-Ah, 3.65V battery was collected in high rate pulse discharge conditions at the three different temperatures (0 • C, 10 • C, and 25 • C). Similar to the two datasets mentioned above, the test equipment included a host computer, a battery cycler, and a thermal chamber. The test execution steps are: 1) Set the temperature at 0 • C and charge the battery cell fully to 100% SOC using the CC (constant current)-CV (constant voltage) profile at 1 C rate; 2) rest the battery cell for 1 h and discharge the battery cell at a pulse current of 30 C with 0.5 s width every 0.6 s for 80 cycles; 3) rest the battery cell for 1 h and repeat Steps 1 through 2 for temperatures of 45 • C and 25 • C; 4) repeat Steps 1 through 3 two times to obtain three sets of data at each temperature. The voltage, current, capacity, and cell temperature of the discharge stage were recorded in a 0.01-second interval, and 90 thousand data points were collected. This dataset is called the high rate pulse condition dataset throughout the rest of the paper. The corresponding voltage and current profiles of the high rate pulse discharge conditions are shown in Figure 6. From Figure 6, we can observe a significant voltage drop, which is due to the internal resistance of the battery. The differences in temperature lead to differences in the internal resistance of the battery, which further leads to differences in voltage drops [39,40].

High Rate Pulse Discharge Condition Dataset Collection
To validate the GRU-RNN's ability for SOC estimation in extreme working conditions, a new dataset of an 18-Ah, 3.65V battery was collected in high rate pulse discharge conditions at the three different temperatures (0 °C , 10 °C , and 25 °C ). Similar to the two datasets mentioned above, the test equipment included a host computer, a battery cycler, and a thermal chamber. The test execution steps are: 1) Set the temperature at 0 °C and charge the battery cell fully to 100% SOC using the CC (constant current)-CV (constant voltage) profile at 1 C rate; 2) rest the battery cell for 1 h and discharge the battery cell at a pulse current of 30 C with 0.5 s width every 0.6 s for 80 cycles; 3) rest the battery cell for 1 h and repeat Steps 1 through 2 for temperatures of 45 °C and 25 °C ; 4) repeat Steps 1 through 3 two times to obtain three sets of data at each temperature. The voltage, current, capacity, and cell temperature of the discharge stage were recorded in a 0.01-second interval, and 90 thousand data points were collected. This dataset is called the high rate pulse condition dataset throughout the rest of the paper. The corresponding voltage and current profiles of the high rate pulse discharge conditions are shown in Figure 6. From Figure 6, we can observe a significant voltage drop, which is due to the internal resistance of the battery. The differences in temperature lead to differences in the internal resistance of the battery, which further leads to differences in voltage drops [39,40].

SOC Estimation Results
In this section, we present the experimental settings, evaluation criteria, and experimental results. Specifically, the Panasonic 18650PF dataset, the Samsung 18650-20R dataset, and the high-rate pulse discharge dataset are used to evaluate the performance of the GRU-RNN for SOC estimation in complex and changeable discharge conditions, mixed charge and discharge conditions, and extreme conditions, respectively.

Experimental Settings
We conduct our experiments on a desktop with Intel Core i7-8700k 3.2 GHz CPU, NVIDIA GeForce GTX 1070Ti (8 GB on-board memory) GPU and 16 GB RAM. The proposed method is implemented in Python and Keras, which uses a Tensorflow backend. Actually, the architecture of the

SOC Estimation Results
In this section, we present the experimental settings, evaluation criteria, and experimental results. Specifically, the Panasonic 18650PF dataset, the Samsung 18650-20R dataset, and the high-rate pulse discharge dataset are used to evaluate the performance of the GRU-RNN for SOC estimation in complex and changeable discharge conditions, mixed charge and discharge conditions, and extreme conditions, respectively.

Experimental Settings
We conduct our experiments on a desktop with Intel Core i7-8700k 3.2 GHz CPU, NVIDIA GeForce GTX 1070Ti (8 GB on-board memory) GPU and 16 GB RAM. The proposed method is implemented in Python and Keras, which uses a Tensorflow backend. Actually, the architecture of the GRU-RNN is very simple, and the GRU-RNN consists of one input layer, one hidden layer, one full connection layer, and one output layer. The nodes of the input layer, the hidden layer, the full connection layer, and the output layer are set as 3, 1000, 50 and 1, respectively. Specifically, the full connection layer transforms the multiple output of the hidden layer into a single SOC value. After setting up the structure of the neural network and the loss function, the network needs to be trained to obtain parameters. The training is a process of minimizing the loss function. Adam is an adaptive optimizer used for minimizing the loss function. The Adam optimizer dynamically adjusts the variations of parameters by using the first-order and second-order matrix estimation of gradients. The parameters of the network are optimized using the Adam optimizer [41] with a learning rate of 0.0001, the first-order momentum attenuation coefficient β 1 of 0.9, the second-order momentum attenuation coefficient β 2 of 0.999, and mini-batches of size 72. In addition, the timestep and the iteration are initialized as 1000 and 100 and then discussed in Section 4.3.3.
Appropriate data normalization can make the training processes of the GRU-RNN more efficient and robust. Moreover, data normalization can remove the negative effect that improves the convergence rate. In this paper, data are normalized to the range [−1,1], as shown in Equation (15) x where x max and x min are the maximum and the minimum values of data; x represents initial data, and x norm represents the data after normalization.

Evaluation Criteria
In order to evaluate the accuracy of the GRU-RNN for SOC estimation of battery, the mean absolute error (MAE) and maximum error (MAX) are used for evaluation criteria below.
where y t and y t are the real value and the estimated value at timestep t, respectively. n is the length of the sequence.

SOC Estimation under Changeable Discharge Conditions
In this section, the performance of the GRU-RNN for SOC estimation is validated with the Panasonic 18650PF dataset. In these experiments, the effect of single-temperature, multi-temperature, size of training sets, and hyperparameters are discussed. Additionally, some comparisons of SOC estimation between the GRU-RNN and the RNN are made in this section. For the Panasonic 18650PF dataset, the data of Cycle 1, Cycle 2, Cycle 3, Cycle 4, and NN are used for training the GRU-RNN, and the data of US06, HWFET, UDDS, and LA92 are used for validating.

SOC Estimation Trained on Single-Temperature Data
In this experiment, we split the Panasonic 18650PF dataset into three subsets depending on the three different temperatures. The GRU-RNN can self-learn network parameters by the Adam optimizer, which frees researchers from establishments of battery models and identifications of parameters. Then, three single-temperature data are used to evaluate the performance of the GRU-RNN individually. The SOC estimation curves trained on single-temperature data are shown in Figure 7, and quantitative results are shown in Table 1. In each subgraph of Figure 7, the first row displays the estimated curves, and the second row displays the estimated error curves.    By simple calculation with the results from Table 1, the average MAE and MAX of SOC estimation results are 1.24%, 1.36%, and 1.08%, and 6.16%, 6.37%, and 10.64% at 0 • C, 10 • C, and 25 • C, respectively. Therefore, the average MAE and MAX of SOC estimation results at three ambient temperatures are 1.22% and 10.64%, which proves that the GRU-RNN can directly characterize the non-linear relationships between voltage, current, temperature, and SOC without the battery model, and the proposed model achieves satisfactory performance in estimating SOC for the single-temperature data.

SOC Estimation Trained on Multi-Temperature Data
In the last experiment, the performance of the GRU-RNN is evaluated with single-temperature data. However, the network parameters learned with the training set at 0 • C could not be used for SOC estimation with the validation set at 10 • C or 25 • C Therefore, it needs to learn a set of network parameters for the data at each temperature, which seriously increases computational complexity and memory consumption. To address this problem, in this experiment, we utilize the whole training dataset at 0 • C, 10 • C, and 25 • C to train one GRU-RNN and validate this network in HWFET, LA92, UDDS, and US06 at 0 • C, 10 • C, and 25 • C The estimation curves are shown in Figure 8. The quantitative results are shown in Table 2. It could be concluded that the average MAE and MAX of SOC estimation results are 0.99%, 0.96%, and 0.63%, and 7.59%, 4.79%, and 3.08% at 0 • C, 10 • C, and 25 • C, respectively. The experiment results prove that the GRU-RNN can achieve SOC estimation in various operating conditions with only a set of network parameters. Obviously, the high temperatures result in a low MAE and a low MAX due to reason that the performance of battery increases with the increase in temperature at ambient temperatures. This is because when the ambient temperature approaches room temperature (25 • C), the battery has excellent cycle stability. Compared with the estimation results at single temperature, the average MAE decreases from 1.22% to 0.86%, and the MAX decreases from 10.64% to 7.59% due to the increasing diversity of the training set. For the following experiments, the network parameters are trained with multi-temperature data. ambient temperatures are 1.22% and 10.64%, which proves that the GRU-RNN can directly characterize the non-linear relationships between voltage, current, temperature, and SOC without the battery model, and the proposed model achieves satisfactory performance in estimating SOC for the single-temperature data.

SOC Estimation Trained on Multi-Temperature Data
In the last experiment, the performance of the GRU-RNN is evaluated with single-temperature data. However, the network parameters learned with the training set at 0 °C could not be used for SOC estimation with the validation set at 10 °C or 25 °C Therefore, it needs to learn a set of network parameters for the data at each temperature, which seriously increases computational complexity and memory consumption. To address this problem, in this experiment, we utilize the whole training dataset at 0 °C, 10 °C, and 25 °C to train one GRU-RNN and validate this network in HWFET, LA92, UDDS, and US06 at 0 °C, 10°C, and 25°C The estimation curves are shown in Figure  8. The quantitative results are shown in Table 2. It could be concluded that the average MAE and MAX of SOC estimation results are 0.99%, 0.96%, and 0.63%, and 7.59%, 4.79%, and 3.08% at 0 °C, 10°C, and 25 °C, respectively. The experiment results prove that the GRU-RNN can achieve SOC estimation in various operating conditions with only a set of network parameters. Obviously, the high temperatures result in a low MAE and a low MAX due to reason that the performance of battery increases with the increase in temperature at ambient temperatures. This is because when the ambient temperature approaches room temperature (25°C ), the battery has excellent cycle stability. Compared with the estimation results at single temperature, the average MAE decreases from 1.22% to 0.86%, and the MAX decreases from 10.64% to 7.59% due to the increasing diversity of the training set. For the following experiments, the network parameters are trained with multi-temperature data.

Influences of Hyperparameters on GRU-RNNs for SOC Estimation
In this sub-section, we analyze the impact of the hyperparameters of the GRU-RNN on the detection results, which specifically include timestep and iteration. In detail, the timestep represents the depth in time of the input layer of the GRU-RNN, and the iteration is the number of the GRU-RNN's training cycles. In the experiments, various values of timestep and iteration are applied, and the SOC estimation results in the forms of MAX and MAE are calculated.
The values of the timestep are set as 250, 500, and 1000, respectively, and other network hyperparameters are consistent with those in Section 4.1. The training times of the GRU-RNN are 12,641 s, 25,012 s, and 51,732 s, respectively. It can be found that the training time is proportional to the value of the timestep. The estimated results are shown in Figure 9 and Table 3. It can be observed that the performance of the GRU-RNN increases with the timestep. Here, the reason is that the input layer of the networks with larger depths in time can learn longer term dependencies of the historical data, which is consistent with the long term dependencies of battery SOC.

Influences of Hyperparameters on GRU-RNNs for SOC Estimation
In this sub-section, we analyze the impact of the hyperparameters of the GRU-RNN on the detection results, which specifically include timestep and iteration. In detail, the timestep represents the depth in time of the input layer of the GRU-RNN, and the iteration is the number of the GRU-RNN's training cycles. In the experiments, various values of timestep and iteration are applied, and the SOC estimation results in the forms of MAX and MAE are calculated.
The values of the timestep are set as 250, 500, and 1000, respectively, and other network hyperparameters are consistent with those in Section 4.1. The training times of the GRU-RNN are 12,641 s, 25,012 s, and 51,732 s, respectively. It can be found that the training time is proportional to the value of the timestep. The estimated results are shown in Figure 9 and Table 3. It can be observed that the performance of the GRU-RNN increases with the timestep. Here, the reason is that the input layer of the networks with larger depths in time can learn longer term dependencies of the historical data, which is consistent with the long term dependencies of battery SOC.

Influences of Hyperparameters on GRU-RNNs for SOC Estimation
In this sub-section, we analyze the impact of the hyperparameters of the GRU-RNN on the detection results, which specifically include timestep and iteration. In detail, the timestep represents the depth in time of the input layer of the GRU-RNN, and the iteration is the number of the GRU-RNN's training cycles. In the experiments, various values of timestep and iteration are applied, and the SOC estimation results in the forms of MAX and MAE are calculated.
The values of the timestep are set as 250, 500, and 1000, respectively, and other network hyperparameters are consistent with those in Section 4.1. The training times of the GRU-RNN are 12,641 s, 25,012 s, and 51,732 s, respectively. It can be found that the training time is proportional to the value of the timestep. The estimated results are shown in Figure 9 and Table 3. It can be observed that the performance of the GRU-RNN increases with the timestep. Here, the reason is that the input layer of the networks with larger depths in time can learn longer term dependencies of the historical data, which is consistent with the long term dependencies of battery SOC.  Another experiment is performed to measure the impact on the estimation results of different values of iteration. In detail, the values of iteration are set as 20, 40, 60, 80, and 100, respectively, and other network hyperparameters are consistent with those in Section 4.1. The training times of the GRU-RNN are 9979 s, 20,575 s, 29,623 s, 40,982 s and 51,732 s, respectively. Additionally, it can be found that the training time is proportional to the value of iteration. The estimated curves and the corresponding bar graph of the estimation results are shown in Figure 10 and Figure 11. It is immediately observable that the more iteration is exposed, the better the accuracy is. The MAE decreases from 1.46% to 0.86% and the MAX decreases from 11.23% to 7.59% when the values of iteration increase from 20 to 100. This is mainly because the value of iteration increases, thus the training data sets are randomly reused by the GRU-RNN, which increases the diversity of training samples.  Another experiment is performed to measure the impact on the estimation results of different values of iteration. In detail, the values of iteration are set as 20, 40, 60, 80, and 100, respectively, and other network hyperparameters are consistent with those in Section 4.1. The training times of the GRU-RNN are 9979 s, 20,575 s, 29,623 s, 40,982 s and 51,732 s, respectively. Additionally, it can be found that the training time is proportional to the value of iteration. The estimated curves and the corresponding bar graph of the estimation results are shown in Figures 10 and 11. It is immediately observable that the more iteration is exposed, the better the accuracy is. The MAE decreases from 1.46% to 0.86% and the MAX decreases from 11.23% to 7.59% when the values of iteration increase from 20 to 100. This is mainly because the value of iteration increases, thus the training data sets are randomly reused by the GRU-RNN, which increases the diversity of training samples.     the GRU-RNN is trained on one to five mixed drive cycles at various temperatures. Accordingly, the sizes of the training data are three, six, nine, 12, and 15, respectively. The other network hyperparameters are consistent with those in Section 4.1. For display purposes, only the estimated curves with sizes of three, nine, and 15 are shown in Figure 12.

Influences of the Size of Training Data on GRU-RNN for SOC Estimation
In order to analyze the influences of the training data size on the GRU-RNN for SOC estimation, we record the estimation result of the GRU-RNN trained on different sizes of mixed drive cycles. In detail, the GRU-RNN is trained on one to five mixed drive cycles at various temperatures. Accordingly, the sizes of the training data are three, six, nine, 12, and 15, respectively. The other network hyperparameters are consistent with those in Section 4.1. For display purposes, only the estimated curves with sizes of three, nine, and 15 are shown in Figure 12.
The corresponding bar graphs of the estimation results are shown in Figure 13. It is immediately observable that, in this case, the performance of the GRU-RNN increases with the sizes of training data. It should also be noted that the GRU-RNN can achieve a MAE below 1.5% when training is conducted on nine or more training data. This means the proposed GRU-RNN is robust for SOC estimation when the training data is inadequate.  The corresponding bar graphs of the estimation results are shown in Figure 13. It is immediately observable that, in this case, the performance of the GRU-RNN increases with the sizes of training data. It should also be noted that the GRU-RNN can achieve a MAE below 1.5% when training is conducted on nine or more training data. This means the proposed GRU-RNN is robust for SOC estimation when the training data is inadequate.

Comparisons between GRU-RNN and RNN
In order to demonstrate the advantages of the adopted GRU-RNN, we replace the GRU-RNN with an original RNN. The same network architecture as the GRU-RNN is adopted by the RNN for a fair comparison. The training times of the RNN and the GRU-RNN are 30,152 s and 51,732 s, respectively. The GRU-RNN takes a longer time to train the network parameters than the RNN due to a more complex structure, as shown in Figure 1. Figure 14 compares the performance of the RNN and the GRU-RNN. It is clear that, compared with the RNN (blue curve), the GRU-RNN (red curve) has smaller SOC errors. The detailed comparison results are shown in Table 4. It can be seen that the GRU-RNN outperforms the RNN in both the MAE and the MAX. The GRU-RNN is more suitable than the RNN for SOC estimation with long-term dependencies. The SOC of LiBs is a sequence that increases over time, and the historical sequences have influence on the current sequences. In order to accurately estimate the current SOC of LiBs, as many historical sequences as possible should be taken into account. The RNN cannot deal with long sequences well because of exploding gradient and vanishing gradient. However, the GRU-RNN can realize the control of the current input and the historical state by GRU, as introduced in Section 2.

Comparisons between GRU-RNN and RNN
In order to demonstrate the advantages of the adopted GRU-RNN, we replace the GRU-RNN with an original RNN. The same network architecture as the GRU-RNN is adopted by the RNN for a fair comparison. The training times of the RNN and the GRU-RNN are 30,152 s and 51,732 s, respectively. The GRU-RNN takes a longer time to train the network parameters than the RNN due to a more complex structure, as shown in Figure 1. Figure 14 compares the performance of the RNN and the GRU-RNN. It is clear that, compared with the RNN (blue curve), the GRU-RNN (red curve) has smaller SOC errors. The detailed comparison results are shown in Table 4. It can be seen that the GRU-RNN outperforms the RNN in both the MAE and the MAX. The GRU-RNN is more suitable than the RNN for SOC estimation with long-term dependencies. The SOC of LiBs is a sequence that increases over time, and the historical sequences have influence on the current sequences. In order to accurately estimate the current SOC of LiBs, as many historical sequences as possible should be taken into account. The RNN cannot deal with long sequences well because of exploding gradient and vanishing gradient. However, the GRU-RNN can realize the control of the current input and the historical state by GRU, as introduced in Section 2.

Comparisons between GRU-RNN and RNN
In order to demonstrate the advantages of the adopted GRU-RNN, we replace the GRU-RNN with an original RNN. The same network architecture as the GRU-RNN is adopted by the RNN for a fair comparison. The training times of the RNN and the GRU-RNN are 30,152 s and 51,732 s, respectively. The GRU-RNN takes a longer time to train the network parameters than the RNN due to a more complex structure, as shown in Figure 1. Figure 14 compares the performance of the RNN and the GRU-RNN. It is clear that, compared with the RNN (blue curve), the GRU-RNN (red curve) has smaller SOC errors. The detailed comparison results are shown in Table 4. It can be seen that the GRU-RNN outperforms the RNN in both the MAE and the MAX. The GRU-RNN is more suitable than the RNN for SOC estimation with long-term dependencies. The SOC of LiBs is a sequence that increases over time, and the historical sequences have influence on the current sequences. In order to accurately estimate the current SOC of LiBs, as many historical sequences as possible should be taken into account. The RNN cannot deal with long sequences well because of exploding gradient and vanishing gradient. However, the GRU-RNN can realize the control of the current input and the historical state by GRU, as introduced in Section 2.

SOC Estimation under Mixed Charge-Discharge Conditions
In order to validate the performance of the proposed GRU-RNN for SOC estimation in whole working states of battery, we evaluate the performance of the proposed method on the Samsung 18650-20R dataset, in which the data of charge, pause, and discharge are recorded continuously. A detailed description of the Samsung 18650-20R dataset can be found in Section 3.2. Two sets of data at each ambient temperature under FUDS, US06, and BJDST are used in this experiment. Half of the data are used for training, and the other half are used for validating.
The SOC estimation curves are calculated and compared with the measured SOC estimation curves in Figure 15. The curves are similar but slightly differ from each other. The quantitative results are shown in Table 5 with a total average MAE of 1.75% and a maximum MAX of 7.04%. This proves that the GRU-RNN can accurately estimate the SOC under mixed charge-discharge conditions.

SOC Estimation under Mixed Charge-Discharge Conditions
In order to validate the performance of the proposed GRU-RNN for SOC estimation in whole working states of battery, we evaluate the performance of the proposed method on the Samsung 18650-20R dataset, in which the data of charge, pause, and discharge are recorded continuously. A detailed description of the Samsung 18650-20R dataset can be found in Section 3.2. Two sets of data at each ambient temperature under FUDS, US06, and BJDST are used in this experiment. Half of the data are used for training, and the other half are used for validating.
The SOC estimation curves are calculated and compared with the measured SOC estimation curves in Figure 15. The curves are similar but slightly differ from each other. The quantitative results are shown in Table 5 with a total average MAE of 1.75% and a maximum MAX of 7.04%. This proves that the GRU-RNN can accurately estimate the SOC under mixed charge-discharge conditions.

SOC Estimation under High Rate Pulse Discharge Conditions
The last experiment is conducted under high rate pulse discharge conditions with the high rate pulse discharge condition dataset to validate the GRU-RNN's ability for SOC estimation under extreme conditions. A set of data for each temperature is used for training, and another set of data for each temperature is used for validating. The SOC estimation curves and the corresponding quantitative results are shown in Figure 16 and Table 6, respectively. It is clear that the GRU-RNN achieves excellent results with MAE = 1.05% and MAX = 2.22% on the high rate pulse discharge condition dataset, which indicates the feasibility and validity of this method.

SOC Estimation under High Rate Pulse Discharge Conditions
The last experiment is conducted under high rate pulse discharge conditions with the high rate pulse discharge condition dataset to validate the GRU-RNN's ability for SOC estimation under extreme conditions. A set of data for each temperature is used for training, and another set of data for each temperature is used for validating. The SOC estimation curves and the corresponding quantitative results are shown in Figure 16 and Table 6, respectively. It is clear that the GRU-RNN achieves excellent results with MAE = 1.05% and MAX = 2.22% on the high rate pulse discharge condition dataset, which indicates the feasibility and validity of this method.  In summary, the proposed SOC estimation approach for LiBs using the GRU-RNN has been evaluated in complex and changeable discharge conditions, mixed charge and discharge conditions, and extreme conditions by the Panasonic 18650PF dataset, the Samsung 18650-20R dataset, and the high-rate pulse discharge dataset. The MAEs of the experiment results are 0.86%, 1.75%, and 1.05%, and the MAXs are 7.59%, 7.04%, and 2.22%. This proves that the proposed method has good abilities in accuracy and robustness. In addition, the GRU-RNN can self-learn network parameters by the Adam optimizer, which frees researchers from the establishments of battery models and identifications of parameters.

Conclusions
In this work, an accurate and robust SOC estimation approach is developed for LiBs. The  In summary, the proposed SOC estimation approach for LiBs using the GRU-RNN has been evaluated in complex and changeable discharge conditions, mixed charge and discharge conditions, and extreme conditions by the Panasonic 18650PF dataset, the Samsung 18650-20R dataset, and the high-rate pulse discharge dataset. The MAEs of the experiment results are 0.86%, 1.75%, and 1.05%, and the MAXs are 7.59%, 7.04%, and 2.22%. This proves that the proposed method has good abilities in accuracy and robustness. In addition, the GRU-RNN can self-learn network parameters by the Adam optimizer, which frees researchers from the establishments of battery models and identifications of parameters.

Conclusions
In this work, an accurate and robust SOC estimation approach is developed for LiBs. The proposed strategy is based on a machine learning framework and leverages the GRU-RNN to establish the nonlinear mapping relation between the observable variables and SOC. Both the qualitative and the quantitative results on three challenging datasets prove the feasibility and advantages of the proposed method. Two public datasets of vehicle drive cycles and another high rate pulse discharge condition dataset are used to evaluate the performance of the GRU-RNN for SOC estimation in complex and changeable discharge conditions, mixed charge and discharge conditions, and extreme conditions, respectively. In addition, the following works are accomplished in this paper: (a) the proposed GRU-RNN method can directly characterize the non-linear relationships between voltage, current, temperature, and SOC without battery models; (b) the proposed GRU-RNN method is proven to have the ability to estimate SOC at various temperatures by using a single set of network parameters; (c) the proposed GRU-RNN method is proven to self-learn network parameters without requiring a great deal of work to hand-engineer and parameterize; (d) the influences of the GRU-RNN hyperparameters and training data size on the performance for SOC estimation are analyzed. The experimental results demonstrate the performance of the GRU-RNN increases with the hyperparameters such as timestep and iteration as well as the training data size. The increase of timestep represents the increase of sequence span during the GRU-RNN training, and the increase of iteration represents the increase of diversity of the GRU-RNN training samples. It is also proven that the model still has high estimation accuracy, even though the amount of data is small; (e) the comparison results between the RNN and the GRU-RNN show that the GRU-RNN can achieve a higher accuracy and overcome the problem of long-term dependencies in the RNN. In summary, the proposed SOC estimation method for LiBs based on the GRU-RNN has been widely validated and achieved good results. To extend this work, the future plan might entail conducting battery lifetime experiments to obtain battery aging data for evaluating the accuracy of the proposed method after a large number of cycles and optimizing the datasets for testing with complete mission profiles. In addition, future work will design the proposed method in the prototype hardware implementation for the BMS.