A Dual-Input Neural Network for Online State-of-Charge Estimation of the Lithium-Ion Battery throughout Its Lifetime

Online state-of-charge (SOC) estimation for lithium-ion batteries is one of the most important tasks of the battery management system in ensuring its operation safety and reliability. Due to the advantages of learning the long-term dependencies in between the sequential data, recurrent neural networks (RNNs) have been developed and have shown their superiority over SOC estimation. However, only time-series measurements (e.g., voltage and current) are taken as inputs in these RNNs. Considering that the mapping relationship between the SOC and the time-series measurements evolves along with the battery degradation, there still remains a challenge for RNNs to estimate the SOC accurately throughout the battery’s lifetime. In this paper, a dual-input neural network combining gated recurring unit (GRU) layers and fully connected layers (acronymized as a DIGF network) is developed to overcome the above-mentioned challenge. Its most important characteristic is the adoption of the state of health (SOH) of the battery as the network input, in addition to time-series measurements. According to the experimental data from a batch of LiCoO2 batteries, it is validated that the proposed DIGF network is capable of providing more accurate SOC estimations throughout the battery’s lifetime compared to the existing RNN counterparts. Moreover, it also shows greater robustness against different initial SOCs, making it more applicable for online SOC estimations in practical situations. Based on these verification results, it is concluded that the proposed DIGF network is feasible for estimating the battery’s SOC accurately throughout the battery’s lifetime against varying initial SOCs.


Introduction
Rechargeable lithium-ion batteries have been widely used in electric vehicles (EVs), energy storage systems, etc., due to their merits of a low self-discharge rate, high power density, a long lifespan, etc. [1][2][3][4]. For a steady-state operation of batteries, the online SOC estimation throughout its lifetime plays a key role in the battery management system. On the one hand, from the perspective of user experience, the online SOC estimation of the batteries is an important promise that predicts the remaining driving range of EVs, which is meaningful in reducing the range anxiety of drivers [5,6]. On the other hand, from the perspective of battery management, the online SOC estimation also helps to avoid over-charge and over-discharge of the batteries, thus ensuring a high level of safety and reliability. For these reasons, the online SOC estimation of lithium-ion batteries has been a hot research topic in past decade.
As introduced in the literature [7][8][9], the lithium-ion battery's SOC estimation approaches are mainly divided into four categories, which include the ampere-hour integral (AHI) methods [10][11][12], the open-circuit voltage (OCV)-based methods [13][14][15], the modelbased methods, and the data-driven methods. The former two methods are relatively simple and easy to operate, but at the expense of uncontrollable SOC estimation error. For instance, the AHI methods obtain the battery's SOC by integrating the battery current efficiency, a GRU layer was developed by Cho et al. in 2014 [38]. Generally, the GRU layer can be formulated as: where X t ∈ R µ×1 , h t−1 ∈ R ν×1 represent the inputs at timestep t; h t ∈ R hs×1 is the output at timestep t; and z t , r t , h t are the outputs of the update gate, reset gate, and candidate state, respectively, and w iz ∈ R hs× f s , w hz ∈ R hs×hs , w ir ∈ R hs× f s , w hr ∈ R hs×hs , w in ∈ R hs× f s , w hn ∈ R hs×hs , b z ∈ R hs×1 , b r ∈ R hs×1 , and b n ∈ R hs×1 are the parameters of the update gate, reset gate, and candidate state that need to be trained. The µ is the number of features in the input X t and the hyperparameter ν is the number of features in the output h t . The schematic structure of the GRU is illustrated in Figure 2. The update gate z t determines the dependencies between the current output h t and the previous output h t−1 or candidate state h t . Additionally, a small z t close to 0 indicates a high dependency between h t and h t . The reset gate r t determines how much the previous output h t−1 is used to calculate candidate state h t . Those gates help the GRU layer to avoid the problem of gradient vanishing and therefore ensure its capability to learn long-term dependencies from sequential data.  [38]. Generally, the GRU layer can be formulated as: where ∈ ℝ × , ℎ ∈ ℝ × represent the inputs at timestep ; ℎ ∈ ℝ × is the output at timestep ; and , , ℎ are the outputs of the update gate, reset gate, and candidate state, respectively, and ∈ ℝ × , ∈ ℝ × , ∈ ℝ × , ∈ ℝ × , ∈ ℝ × , ∈ ℝ × , ∈ ℝ × , ∈ ℝ × , and ∈ ℝ × are the parameters of the update gate, reset gate, and candidate state that need to be trained. The is the number of features in the input and the hyperparameter is the number of features in the output ℎ .The schematic structure of the GRU is illustrated in Figure 2. The update gate determines the dependencies between the current output ℎ and the previous output ℎ or candidate state ℎ . Additionally, a small close to 0 indicates a high dependency between ℎ and ℎ . The reset gate determines how much the previous output ℎ is used to calculate candidate state ℎ . Those gates help the GRU layer to avoid the problem of gradient vanishing and therefore ensure its capability to learn long-term dependencies from sequential data.  By the merits introduced above, the GRUs are employed in this work to provide SOC estimations. In addition, to take the battery's SOH into account, a fully connected (FC) layer, as formulated by Equation (2), is added in between the GRU layers to compose a new dual-input neural network (i.e., a DIGF network), as illustrated in Figure 3.   [38]. Generally, the GRU layer can be formulated as: where ∈ ℝ ×1 , ℎ −1 ∈ ℝ ×1 represent the inputs at timestep ; ℎ ∈ ℝ ℎ ×1 is the output at timestep ; and , , ℎ ′ are the outputs of the update gate, reset gate, and candidate state, respectively, and ∈ ℝ ℎ × , ℎ ∈ ℝ ℎ ×ℎ , ∈ ℝ ℎ × , ℎ ∈ ℝ ℎ ×ℎ , ∈ ℝ ℎ × , ℎ ∈ ℝ ℎ ×ℎ , ∈ ℝ ℎ ×1 , ∈ ℝ ℎ ×1 , and ∈ ℝ ℎ ×1 are the parameters of the update gate, reset gate, and candidate state that need to be trained. The is the number of features in the input and the hyperparameter is the number of features in the output ℎ .The schematic structure of the GRU is illustrated in Figure 2. The update gate determines the dependencies between the current output ℎ and the previous output ℎ −1 or candidate state ℎ ′ . Additionally, a small close to 0 indicates a high dependency between ℎ and ℎ ′ . The reset gate determines how much the previous output ℎ −1 is used to calculate candidate state ℎ ′ . Those gates help the GRU layer to avoid the problem of gradient vanishing and therefore ensure its capability to learn long-term dependencies from sequential data.  By the merits introduced above, the GRUs are employed in this work to provide SOC estimations. In addition, to take the battery's SOH into account, a fully connected (FC) layer, as formulated by Equation (2), is added in between the GRU layers to compose a new dual-input neural network (i.e., a DIGF network), as illustrated in Figure 3. By the merits introduced above, the GRUs are employed in this work to provide SOC estimations. In addition, to take the battery's SOH into account, a fully connected (FC) layer, as formulated by Equation (2), is added in between the GRU layers to compose a new dual-input neural network (i.e., a DIGF network), as illustrated in Figure 3.
where x f c ∈ R α×1 , out f c ∈ R β×1 is the input and output of the FC layer, and w f c ∈ R β×α are the parameters of the layer that need to be trained. In addition, α is the number of features in the input x f c , and hyperparameter β is the number of features in the output out f c . Considering that the battery's SOC is within 1, the hyperbolic tangent function tan h() is employed as the activation function of the FC layer.
where ∈ ℝ × , ∈ ℝ × is the input and output of the FC layer, and ∈ ℝ × are the parameters of the layer that need to be trained. In addition, is the number of features in the input , and hyperparameter is the number of features in the output . Considering that the battery's SOC is within 1, the hyperbolic tangent function tanh () is employed as the activation function of the FC layer. As shown in Figure 3, the proposed DIGF network consists of 5 layers in total, including 3 GRU layers (i.e., layers 1, 2, 4) and 2 FC layers (i.e., layers 3, 5). Referring to the sensitivity analysis in [30], the hyperparameters of each layer in the DIGF network are determined and listed in Table 1. The battery's SOC at timestep of cycle is then estimated by two types of inputs, including the measurements ( ) and the battery's SOH ( ), which are arranged by Equation (3).
where , are the voltage and current measurements at timestep of cycle , and is the SOH of the battery at cycle − 1. It is noted that, as it is not likely to obtain an accurate estimation based on few measurements at the beginning of the cycle , the is employed for the SOC estimation at cycle as the battery SOHs obtained As shown in Figure 3, the proposed DIGF network consists of 5 layers in total, including 3 GRU layers (i.e., layers 1, 2, 4) and 2 FC layers (i.e., layers 3, 5). Referring to the sensitivity analysis in [30], the hyperparameters of each layer in the DIGF network are determined and listed in Table 1. The battery's SOC at timestep t of cycle k is then estimated by two types of inputs, including the measurements (In 1 t ) and the battery's SOH (In 2 t ), which are arranged by Equation (3).
where V k t , I k t are the voltage and current measurements at timestep t of cycle k, and SOH k−1 is the SOH of the battery at cycle k − 1. It is noted that, as it is not likely to obtain an accurate SOH k estimation based on few measurements at the beginning of the cycle k, the SOH k−1 is employed for the SOC estimation at cycle k as the battery SOHs obtained from two adjacent cycles are quite close. In our study, this SOH k−1 value is obtained based on the measurements from the cycle k − 1 by an another convolutional neural network model we have developed in [39]. In summary, the proposed DIGF network can be formulated as follows:

SOC Estimation Procedure
The procedure for obtaining the SOC estimation by using the proposed DIGF network contains three steps, i.e., data preprocessing, DIGF network training, and SOC estimation, as illustrated in Figure 4. from two adjacent cycles are quite close. In our study, this value is obtained based on the measurements from the cycle − 1 by an another convolutional neural network model we have developed in [39]. In summary, the proposed DIGF network can be formulated as follows: where (), (), () are the functions of the GRU layers that have been illustrated in Equation (1); (), () are the functions of the FC layers that have been illustrated in Equation (2); , , , are the outputs of layer 1, layer 2, layer 3, layer 4, respectively; and the is the output of the DIGF network at timestep .

SOC Estimation Procedure
The procedure for obtaining the SOC estimation by using the proposed DIGF network contains three steps, i.e., data preprocessing, DIGF network training, and SOC estimation, as illustrated in Figure 4.   (7) Weights updation with Adam optimizer Achieve the specified epochs?
Trained neural network

Data Preprocessing
Firstly, to minimize the effect of different sampling frequencies, the voltage and current measurements are interpolated quadratically in terms of equidistant discharged capacities with an increment of dq. The dq is calculated by Equation (5): where C 0 is the battery's rated capacity, and N is equal to 120 in this paper. Next, a scaling normalization, shown by Equation (6), is performed on all interpolated voltage and current data to improve the stability of the DIGF network and to speed up the training process as well [40].
where x i train is the unnormalized current/voltage in the training dataset, and x i , x i norm are the unnormalized and normalized discharge voltage/current in the training or testing datasets, respectively.

DIGF Network Training
As the Adam optimizer is capable of handling sparse gradient problems and is easy to implement where the default hyperparameters perform well on most problems [41], it is employed to iteratively update the parameters of the proposed DIGF network in the training process. The formulation of the Adam optimizer is summarized in Equation (7).
where θ n represents all the parameters of the DIGF network at iteration n; L n (θ n−1 ) is the loss function in terms of θ n−1 , calculated by the mean square error (MSE) equation shown in Equation (8); β 1 and β 2 are the decay rates; η is the learning rate; and is a constant term. The values of β 1 , β 2 , η, are set to 0.9, 0.999, 1 × 10 −3 , 1 × 10 −7 , respectively, according to the literature [41].
in which M is the number of samples in the training dataset, and SOC e,j , SOC m,j are the experimental and estimated SOC, respectively.

SOC Estimation
After the DIGF network is well trained, the online SOC estimation of a new battery can be achieved based on its measurements of the voltage, current, and SOH. Before being imported to the DIGF network, the measured voltage and current data also need to be preprocessed by interpolation and normalization. Then, the root mean square error (RMSE) criteria [42] shown in Equation (9) are used to evaluate the standard deviation of the error between the experimental and the estimated SOC values at every cycle, in order to qualify the accuracy of the proposed DIGF network: where L is the total number of the estimated SOCs in each cycle.

Experimental Data
A batch of test data of LiCoO 2 batteries, provided by the Center of Advanced Life Cycle Engineering at the University of Maryland, were employed to verify the performance of the proposed DIGF network for SOC estimation throughout the battery's lifetime [43,44]. These data consist of the test results under room temperature from five batteries (named CS2-33, CS2-34, CS2-35, CS2-36, CS2-37, respectively) with rated capacity of 1.1 Ah. During the experiment, all the batteries were charged under a constant current-constant voltage (CC-CV) charging mode and discharged with a constant current. In a CC-CV charging cycle, the battery is first charged with a constant current until its voltage reaches the maximum charge voltage; then, it is charged under a constant voltage. Then, the constant voltage charging stage is terminated when the charge current tapers down to the end-ofcharge current. In the discharging cycle, the battery is discharged with a constant current until its voltage drops to the discharge cut-off voltage. The detailed information on the batteries and the test conditions is listed in Table 2. The experimental data of batteries CS2-33, CS2-34, CS2-35, CS2-36 are used for training the proposed DIGF network, whereas the experimental data of CS2-37 are utilized for validation. According to the definition, the benchmark SOC and SOH are calculated by the Equations (10) and (11), respectively.
where I k t is the discharge current at cycle k; t end is the duration of the whole cycle k; C k is the battery capacity at cycle k; C 0 is the rated capacity of the battery; and SOC k t is the SOC of the battery at time t of cycle k. As the failure threshold of the lithium-ion batteries used in EVs is generally defined as 0.8 of its SOH [45], the lifetime of the battery is determined by the period when its SOH decreases down to 0.8 in this work. As a result, the SOH fading curves before 0.8 of all five of the batteries are shown in Figure 5.

Results and Discussion
For comparison purposes, another two RNN networks (i.e., the LSTM neural network [29] and the GRU neural network [30]) that only take time-series voltage, current, and temperature as inputs are also employed for the SOC estimations. Considering that the batteries in practice are most likely to start discharging with initial SOCs between 70% and 100% [46], the additional dataset consists of discharge cycles with initial SOCs of 90%, 80%, and 70%, which are created by truncating the experimental data of each cycle of the training batteries. Thus, the LSTM, GRU, and DIGF networks are trained with a training dataset that consists of discharge cycle with initial SOCs of 100%, 90%, 80%, and 70%, as shown in Figure 6. Each network is independently trained 10 times, with the consideration of the effects of the random initialization of the network parameters on the SOC estimations. For a comprehensive comparison between the performances of the three networks for the SOC estimation throughout the battery's lifetime, the boxplot of RMSEs of the SOC estimations for battery CS2-37 over a lifetime in terms of different initial SOCs are shown in Figure 7. According to Figure 7, the DIGF network achieves the best performance in SOC estimations in both the median and the maximum RMSEs in most scenarios, compared to the LSTM and GRU networks. In addition, it also shows a much more stable median RMSE of SOC estimations compared to the LSTM and GRU networks, indicating a stronger robustness against the initial SOCs. The above two observations prove the superiority of the DIGF network in the SOC estimations of a battery over its lifetime.

Results and Discussion
For comparison purposes, another two RNN networks (i.e., the LSTM neural network [29] and the GRU neural network [30]) that only take time-series voltage, current, and temperature as inputs are also employed for the SOC estimations. Considering that the batteries in practice are most likely to start discharging with initial SOCs between 70% and 100% [46], the additional dataset consists of discharge cycles with initial SOCs of 90%, 80%, and 70%, which are created by truncating the experimental data of each cycle of the training batteries. Thus, the LSTM, GRU, and DIGF networks are trained with a training dataset that consists of discharge cycle with initial SOCs of 100%, 90%, 80%, and 70%, as shown in Figure 6. Each network is independently trained 10 times, with the consideration of the effects of the random initialization of the network parameters on the SOC estimations.

Results and Discussion
For comparison purposes, another two RNN networks (i.e., the LSTM neural network [29] and the GRU neural network [30]) that only take time-series voltage, current, and temperature as inputs are also employed for the SOC estimations. Considering that the batteries in practice are most likely to start discharging with initial SOCs between 70% and 100% [46], the additional dataset consists of discharge cycles with initial SOCs of 90%, 80%, and 70%, which are created by truncating the experimental data of each cycle of the training batteries. Thus, the LSTM, GRU, and DIGF networks are trained with a training dataset that consists of discharge cycle with initial SOCs of 100%, 90%, 80%, and 70%, as shown in Figure 6. Each network is independently trained 10 times, with the consideration of the effects of the random initialization of the network parameters on the SOC estimations. For a comprehensive comparison between the performances of the three networks for the SOC estimation throughout the battery's lifetime, the boxplot of RMSEs of the SOC estimations for battery CS2-37 over a lifetime in terms of different initial SOCs are shown in Figure 7. According to Figure 7, the DIGF network achieves the best performance in SOC estimations in both the median and the maximum RMSEs in most scenarios, compared to the LSTM and GRU networks. In addition, it also shows a much more stable median RMSE of SOC estimations compared to the LSTM and GRU networks, indicating a stronger robustness against the initial SOCs. The above two observations prove the superiority of the DIGF network in the SOC estimations of a battery over its lifetime. For a comprehensive comparison between the performances of the three networks for the SOC estimation throughout the battery's lifetime, the boxplot of RMSEs of the SOC estimations for battery CS2-37 over a lifetime in terms of different initial SOCs are shown in Figure 7. According to Figure 7, the DIGF network achieves the best performance in SOC estimations in both the median and the maximum RMSEs in most scenarios, compared to the LSTM and GRU networks. In addition, it also shows a much more stable median RMSE of SOC estimations compared to the LSTM and GRU networks, indicating a stronger robustness against the initial SOCs. The above two observations prove the superiority of the DIGF network in the SOC estimations of a battery over its lifetime. To further explore the performance of the three networks against different initial SOCs, the curves of the SOC estimations for battery CS2-37 under the initial SOCs of 95%, 90%, 85%, 80%, 75%, and 70% at cycle 200 are shown in Figure 8. It can be seen that the large error of the estimated SOCs by the LSTM and GRU networks is majorly concentrated at the first few steps, with all of the initial SOCs from 95% to 70%. As mentioned before, these two networks only take the measurements of the discharge voltages and currents as inputs. However, at the early stage of each discharge cycle, the imported voltage and current data are not sufficient for the LSTM and GRU networks to provide accurate SOC estimations, whereas, owing to the additional input of the SOH, the DIGF network is capable of significantly reducing the SOC estimation error in the early stage of each discharge cycle, and therefore shows stronger robustness against different initial SOCs. To further explore the performance of the three networks against different initial SOCs, the curves of the SOC estimations for battery CS2-37 under the initial SOCs of 95%, 90%, 85%, 80%, 75%, and 70% at cycle 200 are shown in Figure 8. It can be seen that the large error of the estimated SOCs by the LSTM and GRU networks is majorly concentrated at the first few steps, with all of the initial SOCs from 95% to 70%. As mentioned before, these two networks only take the measurements of the discharge voltages and currents as inputs. However, at the early stage of each discharge cycle, the imported voltage and current data are not sufficient for the LSTM and GRU networks to provide accurate SOC estimations, whereas, owing to the additional input of the SOH, the DIGF network is capable of significantly reducing the SOC estimation error in the early stage of each discharge cycle, and therefore shows stronger robustness against different initial SOCs.

Conclusions
A DIGF network combining three GRU layers and two FC layers is proposed in this paper for the SOC estimation of lithium batteries over their lifetime. Compared to other RNNs which only take time-series measurements as inputs, the DIGF network employs the battery's SOH as well as improving the accuracy of the SOC estimations. The experimental results of a batch of LiCoO2 batteries show that the proposed DIGF network is feasible for providing satisfying SOC estimations with stronger robustness against different initial SOCs for batteries throughout their lifetimes. Owing to these advantages given above, it is speculated that this proposed DIGF network has great potential for use in online SOC estimation for lithium-ion batteries in practice with a large range of SOHs and initial SOCs.

Conclusions
A DIGF network combining three GRU layers and two FC layers is proposed in this paper for the SOC estimation of lithium batteries over their lifetime. Compared to other RNNs which only take time-series measurements as inputs, the DIGF network employs the battery's SOH as well as improving the accuracy of the SOC estimations. The experimental results of a batch of LiCoO 2 batteries show that the proposed DIGF network is feasible for providing satisfying SOC estimations with stronger robustness against different initial SOCs for batteries throughout their lifetimes. Owing to these advantages given above, it is speculated that this proposed DIGF network has great potential for use in online SOC estimation for lithium-ion batteries in practice with a large range of SOHs and initial SOCs.