Lithium Battery State-of-Charge Estimation Based on a Bayesian Optimization Bidirectional Long Short-Term Memory Neural Network

: State of charge (SOC) is the most important parameter in battery management systems (BMSs), but since the SOC is not a directly measurable state quantity, it is particularly important to use advanced strategies for accurate SOC estimation. In this paper, we ﬁrst propose a bidirectional long short-term memory (BiLSTM) neural network, which enhances the comprehensiveness of information by acquiring both forward and reverse battery information compared to the general one-way recurrent neural network (RNN). Then, the parameters of this network are optimized by introducing a Bayesian optimization algorithm to match the data characteristics of lithium batteries with the network topology. Finally, two sets of lithium battery public data sets are used to carry out experiments under different constant temperature and variable temperature environments. The experimental results show that the proposed model can effectively ﬁt the actual measurement curve. Compared with traditional long short-term memory network (LSTM) and BiLSTM models, the prediction accuracy of the Bayes-BiLSTM model is the best, with a root mean square error (RMSE) within 1%, achieving a better ability for capturing long-term dependencies. Overall, the model exhibits high accuracy, adaptability, and generalization for the SOC estimation of batteries with different chemical compositions.


Introduction
With the increasing severity of the global energy crisis and the environmental pollution caused by transportation energy consumption, the world's demand for efficient and clean energy is also increasing year by year. As a type of reusable, rechargeable battery, lithium batteries greatly reduce carbon emissions and chemical fuel consumption. In addition, due to the advantages of high energy density, low self-discharge rate, and long service life, lithium batteries are widely used in electric vehicles [1,2]. As one of the most important state quantities of lithium batteries, the SOC is not only an important parameter for measuring the remaining power of batteries but also an important index for ensuring the safety and service life of batteries [3]. Therefore, accurate lithium battery SOC estimation is currently a key problem to be solved.
The SOC is defined as the ratio of the remaining capacity to the nominal capacity of a battery [4], which is usually calculated by Equation (1). It should be noted that SOC is a state quantity that cannot be measured directly, and there are highly nonlinear relationships between the SOC and observable variables, such as voltage, current, temperature, and SOC under three different operating conditions. However, the structure of RNN is relatively shallow, and a typical RNN is unable to learn the intrinsic features of the measured data layer by layer upon encountering the extended sequence problem. To improve the capability of RNNs in handling sequential data, an LSTM, gated recurrent unit (GRU) structure can be added to RNN to solve the vanishing gradient phenomenon problem. Reference [18] proposed a method to accurately estimate lithium battery SOC by using LSTM and formed a single network that correctly estimated the SOC under different ambient temperature conditions by encoding the time-dependent term. Reference [19] estimated lithium-ion battery SOC based on a gated recurrent neural network (GRU-RNN) and established mapping relationships between the battery observable variables and SOC to achieve battery SOC estimation at different temperatures. In the literature [2], a gated recurrent neural network model with an activation functional layer (GRU-ATL) was proposed to estimate the battery charge state, and a stable and accurate SOC estimation performance was achieved by estimating the battery SOC online under different operating conditions without relying on the battery model. Reference [1] proposed a method combining a denoising auto-encoder (DAE) with a GRU to estimate lithium battery SOC. By reducing noise and increasing the dimension of battery measurement data to obtain useful data information and then using GRU-RNN for training, experimental results were obtained that showed that the proposed DAE-GRU had suitable robustness. All of these studies achieved suitable results for battery SOC estimation, but most of these studies only focus on the correlation of forward series data, while the correlation study of reverse series data acquisition is lacking. Reference [20] proposed an SOC estimation method combining multichannel convolution and bidirectional recurrent neural network (MCNN-BRNN) to sequentially estimate SOC by extracting multi-scale local robust features and using the BRNN to capture effective time-varying signals. This reduced the accumulation of errors and improved the overall estimation accuracy. Reference [21] proposed a stacked bidirectional long short-term memory (SBLSTM) model for estimating lithium battery SOC. This method captured the forward and reverse battery information through the bidirectional structure and improved the depth of the model by stacking the bidirectional structure, which further improved the estimation performance of the model. It is worth mentioning that the network setting of the model in this document is highly random. Artificially setting the super parameters of the network will not only increase the training cost of the model but also affect the prediction effect of the model. Therefore, the parameter adjustment of the model needs to be further resolved. In this paper, a Bayesian optimization-based bidirectional long short-term memory (Bayes-BiLSTM) neural network model is proposed for lithium battery SOC estimation. Compared with the unidirectional LSTM network, this model uses a bidirectional structure to summarize the temporal dependence of past and future contexts by capturing the forward and reverse battery information. In addition, compared with other methods, the proposed model also introduces a Bayesian optimization algorithm. The introduction of this optimization algorithm assists in finding the optimal network parameters to improve the network performance and compensates for the defect of manually setting the network parameters. In particular, this paper adopts the Bayesian optimization algorithm to optimize the parameters of the BiLSTM model. The optimization parameters include the number of hidden layer neurons I s , the maximum number of iterations MaxEpochs, the initial learning rate I r and the learning decline rate factor I rd f . Finally, this paper evaluates the effectiveness and applicability of the proposed method by conducting multiple sets of comparative experiments using two public lithium battery data sets, and the experimental results show that under different constant temperature and variable temperature environments, the proposed method has better accuracy, adaptability, and generalizability for the SOC estimation of different types of lithium batteries.
The rest of the paper is organized as follows: the second part details the LSTM, BiLSTM, and Bayes-BiLSTM models. The third part introduces the lithium battery data set and experimental procedure. The fourth part analyzes and discusses the experimental results. The fifth part comprises the conclusion of this paper.

LSTM Network
The models of traditional neural networks will only focus on the processing of information in the current moment and will not infer whether the processing of information in the previous moment will help in the next moment, and the problems of local minima, gradient disappearance, and gradient explosion are prevalent when performing model training. For example, the gradient disappearance generated by RNN during backpropagation can lead to the inability to capture long-term dependence [17]. LSTM networks effectively solve this problem. LSTM is a special implementation of RNN, which improves the implicit layer and introduces the concept of temporal order on top of RNN neural networks so that the output of one moment can have a direct impact on the input of the next moment.
The structure of the LSTM hidden unit is shown in Figure 1, which includes a forgetting gate f t , an input gate i t , an output gate o t , and a memory cell C t . The sigmoid layer determines which values need to be updated, and the tanh layer determines what new values to add. The transfer and control of information is achieved through three gates. The forgetting gate f t in the cell state transfer determines what information should be discarded. The input gate i t controls the decision of what new information to add to the "cell state". The output gate o t controls the storing of the information of the cell at the moment t to the hidden state of h t [21,22]; that is, the output is obtained. Equations (2)-(5) demonstrate the execution process of updating the internal unit by LSTM.
where w and b with subscripts represent the weight matrices and deviation vectors of the three gates; σ(· · · ) is a sigmoid activation function with a function value of a vector between (0,1) that acts as a gate, with 0 representing discard and 1 representing retention; tanh(· · · ) normalizes the values to between (−1,1) and is used to update the internal cells and cell outputs, and s t is a vector of candidate values created after the tanh layer. In the whole information flow, the process of cell state from C t−1 to C t is similar to a conveyor belt, and the cell update rule from C t−1 to C t is as follows: (a) Select the part of old cell information forgotten through the "forgetting gate", multiply the old state with f t , and discard the information determined to be discarded. (b) Add the candidate cell information s t through the "input gate" and then add i t × s t to obtain the cell state C t as in Equation (6).
The output of the LSTM cell is calculated by Equation (7):

Bidirectional LSTM Network
LSTM improves the gradient disappearance or explosion problem that occurs in traditional RNNs due to its complex gated memory mechanism and outperforms other recurrent architectures in dealing with sequential tasks with long-term dependencies. However, it is worth noting that the LSTM structure can only use positive dependencies, and some useful information will be filtered in the long-term gated memory chain. To solve this problem, this paper adopts a bidirectional LSTM, which consists of two LSTM layers in different directions, two independent LSTM layers, one for inputting the forward sequence and the other for inputting the reverse sequence. The structure of the BiLSTM is shown in Figure 2. This structure makes up for the lack of information in LSTM, can better capture contextual long-term dependencies in sequence tasks, and can facilitate more accurate predictions.
The input data of this model are selected as two parameters, voltage and current, and the input sequence = , consists of voltage and current with t as the time step, and the output sequence is SOC . In Equation (8), ℎ ⃗ , ℎ ⃗ , and ℎ ⃗ denote the hidden layer neuron nodes for the forward propagation of the model, and in Equation (9), ℎ ⃖ , ℎ ⃖ , and ℎ ⃖ denote the hidden layer neuron nodes for the reverse propagation of the model. Then, the forward and reverse implied state outputs of the BiLSTM are connected and fed into the same fully connected layer, and the output implied layer state is considered as input using the fully connected layer. Its dimensionality reduction is calculated with the activation function of the sigmoid function, and the final output is the predicted charge state. The SOC estimation of the model output is shown in Equation (10).

Bidirectional LSTM Network
LSTM improves the gradient disappearance or explosion problem that occurs in traditional RNNs due to its complex gated memory mechanism and outperforms other recurrent architectures in dealing with sequential tasks with long-term dependencies. However, it is worth noting that the LSTM structure can only use positive dependencies, and some useful information will be filtered in the long-term gated memory chain. To solve this problem, this paper adopts a bidirectional LSTM, which consists of two LSTM layers in different directions, two independent LSTM layers, one for inputting the forward sequence and the other for inputting the reverse sequence. The structure of the BiLSTM is shown in Figure 2. This structure makes up for the lack of information in LSTM, can better capture contextual long-term dependencies in sequence tasks, and can facilitate more accurate predictions.
The input data of this model are selected as two parameters, voltage and current, and the input sequence x t = {v t , I t } consists of voltage and current with t as the time step, and the output sequence is SOC t . In Equation (8), and ← h t+1 denote the hidden layer neuron nodes for the reverse propagation of the model. Then, the forward and reverse implied state outputs of the BiLSTM are connected and fed into the same fully connected layer, and the output implied layer state is considered as input using the fully connected layer. Its dimensionality reduction is calculated with the activation function of the sigmoid function, and the final output is the predicted charge state. The SOC estimation of the model output is shown in Equation (10).
where h f denotes the output of the fully connected layer, w 0 denotes the weight matrix, and b 0 denotes the deviation of the output regression layer.
where ℎ denotes the output of the fully connected layer, denotes the weight matrix, and denotes the deviation of the output regression layer.

SOC Estimation Based on Bayes-BiLSTM
Some hyperparameters of the BiLSTM model control the generalization of the network structure. If the number of neurons in the hidden layer is too small, the information acquisition required by the sample training process cannot be satisfied; if the number is too large, overfitting will occur, resulting in a decrease in the generalization ability of the network. The number of iterations is the number of times that the data in the training set is trained in the network, and the setting of the maximum number of iterations is the termination condition of the optimization algorithm; there is also an optimal value for the setting of the initial learning rate. If this value is too large, the model will not converge, or the model will not converge. The convergence rate is too slow. The learning decline rate

SOC Estimation Based on Bayes-BiLSTM
Some hyperparameters of the BiLSTM model control the generalization of the network structure. If the number of neurons in the hidden layer is too small, the information acquisition required by the sample training process cannot be satisfied; if the number is too large, overfitting will occur, resulting in a decrease in the generalization ability of the network. The number of iterations is the number of times that the data in the training set is trained in the network, and the setting of the maximum number of iterations is the termination condition of the optimization algorithm; there is also an optimal value for the setting of the initial learning rate. If this value is too large, the model will not converge, or the model will not converge. The convergence rate is too slow. The learning decline rate factor is that after the model performs multiple iterations, the model will multiply the initial learning rate by this factor according to the current situation to reduce the learning rate to obtain the best convergence effect of the model [23,24]. To match the network model structure with the data, improve the network training speed, and improve the network performance, it has become a new challenge to determine the optimal parameters of BiLSTM. Bayesian optimization can combine past evaluation results to obtain better results with fewer iterations. In parameter combination optimization problems, this optimization method is widely used because it can quickly and accurately find the optimal solution of hyperparameters [25]. This paper adopts the idea of Bayesian optimization and realizes the overall optimization of hyperparameters based on the BiLSTM network to further improve the efficiency of lithium battery SOC estimation. The model structure is shown in Figure 3. factor is that after the model performs multiple iterations, the model will multiply the initial learning rate by this factor according to the current situation to reduce the learning rate to obtain the best convergence effect of the model [23,24]. To match the network model structure with the data, improve the network training speed, and improve the network performance, it has become a new challenge to determine the optimal parameters of BiLSTM. Bayesian optimization can combine past evaluation results to obtain better results with fewer iterations. In parameter combination optimization problems, this optimization method is widely used because it can quickly and accurately find the optimal solution of hyperparameters [25]. This paper adopts the idea of Bayesian optimization and realizes the overall optimization of hyperparameters based on the BiLSTM network to further improve the efficiency of lithium battery SOC estimation. The model structure is shown in Figure 3. As a global optimization algorithm, the Bayesian optimization algorithm estimates the posterior distribution of the objective function by using Bayes' theorem and then selects the next combination of hyperparameters to be sampled based on this distribution. The method uses the sampling results of the previous sampling points to continuously refine the objective function until the globally optimal hyperparameters are found. That is, the next evaluation is performed only after the completion of one evaluation, which is able to find the near-optimal solution with less evaluation cost [25]. The proposed model is set to χ = , , ⋯ as a set of hyperparameter combinations, and Equation (11) is the hyperparameter combination selection representation of the model. * = min ∈ ( ) (11) As a global optimization algorithm, the Bayesian optimization algorithm estimates the posterior distribution of the objective function by using Bayes' theorem and then selects the next combination of hyperparameters to be sampled based on this distribution. The method uses the sampling results of the previous sampling points to continuously refine the objective function until the globally optimal hyperparameters are found. That is, the next evaluation is performed only after the completion of one evaluation, which is able to find the near-optimal solution with less evaluation cost [25]. The proposed model is set to χ = x 1 , x 2, · · · x n as a set of hyperparameter combinations, and Equation (11) is the hyperparameter combination selection representation of the model. (11) where x * denotes the optimized hyperparameter combination and f (x) is the minimization objective function with respect to the hyperparameter x. The Bayes' theorem used in the Bayesian optimization process is shown in Equation (12).
where f denotes the unknown objective function; D denotes the set of observations,

Battery Data Set
To verify the effectiveness of the proposed model, two public data sets of lithium batteries are used for evaluation, and the main specifications of the two batteries are shown in Table 1. The first data set is the INR 18650-20R data set, which was constructed by the Center for Advanced Life Cycle Engineering (CALCE) at Columbia University [26]. Each battery data contains parameters such as time, current, voltage, temperature, and capacity. In this experiment, the battery INR 18650-20R was tested at three different ambient temperatures (0

Battery data set
To verify the effectiveness of the proposed model, two public data sets of lithium batteries are used for evaluation, and the main specifications of the two batteries are shown in Table 1. The first data set is the INR 18650-20R data set, which was constructed by the Center for Advanced Life Cycle Engineering (CALCE) at Columbia University [26]. Each battery data contains parameters such as time, current, voltage, temperature, and capacity. In this experiment, the battery INR 18650-20R was tested at three different ambient temperatures (0 °C, 25 °C, 45 °C) by performing four dynamic driving cycles under different operating conditions, including the dynamic stress test (DST), Federal Urban Driving Program (FUDS), US06, and the Beijing dynamic stress test (BJDST). Figure 4 reflects the current and voltage distributions recorded in the FUDS test at 45 °C, which includes the charging, discharging, and suspending phases of the battery, where positive currents indicate the state of charge and negative currents indicate the state of discharge.  The second data set is the path-dependent battery degradation data set provided by the Information Office of the Battery Laboratory of Oxford University [27]. The experiment was conducted on lithium-ion 18650 NCA batteries, and the experimental temperature was set at 24 °C. The data set contains four sets of long-term degradation data, each containing three 18650 NCA cells, electrochemical impedance spectroscopy EIS data, and half-cell data. The half-cell data were obtained by constructing half-cells from the elec-  The second data set is the path-dependent battery degradation data set provided by the Information Office of the Battery Laboratory of Oxford University [27]. The experiment was conducted on lithium-ion 18650 NCA batteries, and the experimental temperature was set at 24 • C. The data set contains four sets of long-term degradation data, each containing three 18650 NCA cells, electrochemical impedance spectroscopy EIS data, and half-cell data. The half-cell data were obtained by constructing half-cells from the electrode materials collected from the original 18650 NCA batteries and tested at C/24.

Experimental Process
The experimental process of this study is shown in Figure 5. different magnitudes and magnitude units, the existing numerical differences will affect the training speed and training effect of the model. Therefore, to eliminate the influence of scale between the indicators, it is necessary to normalize the data samples to ensure the accuracy and generalization ability of the model. Moreover, the normalized data set is divided. Specifically, the discharge stage data of the three working conditions of FUDS, US06, and BJDST in the first data set are used as the training set, and the DST discharge stage data are used as the test set. The mapminmax function maps the measured values to the [0,1] interval, as shown in Equation (13) where * is the normalized data; x is the actual measurement data, and and are the minimum and maximum values in the actual measurement data.
(2) Model building: The BiLSTM model consists of an input layer, a dual LSTM layer, a dropout layer, a fully connected layer, and an output layer. To explore the impacts of different parameter settings on the model estimation performance, this paper constructs different parameter settings for SOC estimation and specifically discusses the impacts of different hidden layer neuron numbers on the model in Section 4.1. In the Bayes-BiLSTM model, for optimizing the parameter range settings, the parameter setting in reference [28] is used and combined with the training test, and the value range is continuously narrowed according to the accuracy. The parameter ranges include the number of neurons in the hidden layer ∈ 64,128 , the maximum number of iterations ℎ ∈ 20,200 , the initial learning rate ∈ 0.0001,0.1 , and the learning decline rate factor ∈ 0.1,1 . (1) Data pre-processing: Data pre-processing is the basis for building the network model. Since the obtained battery data indicators of voltage, current, and SOC have different magnitudes and magnitude units, the existing numerical differences will affect the training speed and training effect of the model. Therefore, to eliminate the influence of scale between the indicators, it is necessary to normalize the data samples to ensure the accuracy and generalization ability of the model. Moreover, the normalized data set is divided. Specifically, the discharge stage data of the three working conditions of FUDS, US06, and BJDST in the first data set are used as the training set, and the DST discharge stage data are used as the test set. The mapminmax function maps the measured values to the [0,1] interval, as shown in Equation (13): where x * is the normalized data; x is the actual measurement data, and x min and x max are the minimum and maximum values in the actual measurement data.
(2) Model building: The BiLSTM model consists of an input layer, a dual LSTM layer, a dropout layer, a fully connected layer, and an output layer. To explore the impacts of different parameter settings on the model estimation performance, this paper constructs different parameter settings for SOC estimation and specifically discusses the impacts of different hidden layer neuron numbers on the model in Section 4.1. In the Bayes-BiLSTM model, for optimizing the parameter range settings, the parameter setting in reference [28] is used and combined with the training test, and the value range is continuously narrowed according to the accuracy. The parameter ranges include the number of neurons in the hidden layer I S ∈ [64, 128], the maximum number of iterations MaxEpochs ∈ [20,200], the initial learning rate I r ∈ [0.0001, 0.1], and the learning decline rate factor I rd f ∈ [0.1, 1].
(3) Model training: In model training, Adam is used as the model optimization algorithm, and the mean absolute error is used as the loss function, as shown in Equation (14). Finally, the hyperparameters obtained from Bayes optimization are used to complete the training of the model.
(4) Performance evaluation: On the one hand, to evaluate the generalization of the model, a second data set is used for validation testing in Section 4.5; on the other hand, to evaluate the accuracy of the model for estimating the effect of lithium battery SOC, three metrics are used to evaluate the performance of the model, including the mean absolute percentage error (MAPE), root mean square error (RMSE), and mean absolute error (MAE).
where n is the measurement data time-series length andŷ t and y t are the estimated and actual measured values of the battery SOC at moment t, respectively. Experiment description: All experiments are carried out in the CPU simulation environment of MATLAB 2019. The computer processor is an Intel i5-4590 3.30 GHz, and the memory is 8.0 GB DDR3.

SOC Estimation under Different Hidden Layer Units
In a bidirectional LSTM, the number of hidden layer neurons determines the width of the model; if this number is too small, the amount of information acquisition required for the sample training process cannot be met; if this number is too large, overfitting will occur, leading to a decrease in the generalization ability of the network. In this section, different BiLSTM models are constructed to evaluate the effect of the number of hidden layer neurons on the estimation accuracy of the model. The setting regarding the number of hidden layer units in recurrent neural networks is usually performed using multiple consecutive powers of 2 [21]. In this section, five BiLSTM models with 16, 32, 64, 128, and 256 implied layers are constructed, and the maximum number of iterations is set to 2000. Table 2 summarizes the comparison results of the five different structural models. As seen from the table, with the increase in the number of hidden layer neurons, the estimation accuracy is the highest when the number of hidden layer neurons is 64 compared with the other models; when the number of hidden layer neurons is 128, the estimation accuracy starts to decrease.  , and (f) represent the corresponding errors. Moreover, it can be seen from the figure that the curve of the estimation results is relatively smooth at room temperature; but the degree of fitting with the actual measurement curve is relatively poor, and the estimation accuracy is low; when the temperature is too high or too low, especially at the end of the discharge, the curve of the model estimation result is relatively steep, but the overall fitting degree with the actual measurement curve is suitable. This instability is due to the strong nonlinear polarization of the lithium battery at the end of discharge and the fact that the dynamic characteristics inside the battery also become more complex at lower temperatures, with a lag in the battery response, which in turn leads to an increase in the error. Therefore, to obtain a higher estimation accuracy, we can tentatively determine that the optimal number of implied layer neurons should be between [64,128].

SOC Estimation of Improved Circulation Blocks at Different Temperatures
The Bayesian optimization algorithm is used to improve the circulation block and to verify the effectiveness of the proposed strategy. This section estimates the optimized

SOC Estimation of Improved Circulation Blocks at Different Temperatures
The Bayesian optimization algorithm is used to improve the circulation block and to verify the effectiveness of the proposed strategy. This section estimates the optimized  Table 3 shows all of the MAE, MAPE, and RMSE after improving the circulation block, and the results show that the average absolute error of the estimation accuracy is within 1.2%. The estimation results and errors of the model at 45 • C are shown in Figure 7. The RMSE and MAPE of the circulation block are 0.89% and 6.56%, respectively, which are 0.41% and 21.49% higher than those of the BiLSTM model with 64 implied layer cell counts in Section 4.1, respectively. Figures 8 and 9 represent the estimation results and errors at 25 • C and 0 • C, respectively. As shown in the figures, the model estimates slightly deviate from the true SOC value and fluctuate around it because the polarization of the cell becomes progressively more severe as the temperature decreases. However, overall, compared with those of the model before optimization, the RMSE and MAPE of the model at 25 • C are increased by 0.8% and 14.31%, respectively, and the RMSE and MAPE of the model at 0 • C are increased by 0.5% and 24.08%, respectively. The loop block exhibits high accuracy and stability at different constant temperatures.  Table 3 shows all of the MAE, MAPE, and RMSE after improving the circulation block, and the results show that the average absolute error of the estimation accuracy is within 1.2%. The estimation results and errors of the model at 45 °C are shown in Figure 7. The RMSE and MAPE of the circulation block are 0.89% and 6.56%, respectively, which are 0.41% and 21.49% higher than those of the BiLSTM model with 64 implied layer cell counts in Section 4.1, respectively. Figures 8 and 9 represent the estimation results and errors at 25 °C and 0 °C, respectively. As shown in the figures, the model estimates slightly deviate from the true SOC value and fluctuate around it because the polarization of the cell becomes progressively more severe as the temperature decreases. However, overall, compared with those of the model before optimization, the RMSE and MAPE of the model at 25 °C are increased by 0.8% and 14.31%, respectively, and the RMSE and MAPE of the model at 0 °C are increased by 0.5% and 24.08%, respectively. The loop block exhibits high accuracy and stability at different constant temperatures.

SOC Estimation in a Variable Temperature Environment
The experimental results in the previous section show that the proposed Bayes-BiLSTM can achieve accurate battery SOC estimation at different constant temperatures. In fact, the lithium-ion battery's internal temperature is continuously changing during the whole operation, and the temperature has a very important influence on the battery, especially in the battery SOC estimation, which is a key factor that cannot be ignored regardless of the model adopted. Therefore, it is necessary to evaluate the estimation performance of the proposed method under a variable temperature environment. We selected some data corresponding to three different temperatures of 45 °C, 25 °C, and 0 °C under each working discharge in the first data set to form a new variable temperature environment data set; the data of the three DST, US06, and FUDS working conditions were used for model training, and the data of BJDST working conditions were used for model testing. Table 4 shows the results based on the variable temperature environment, and it can be seen that, through training, the estimation error of the model is small even in a variable temperature environment, and the MAE is controlled within 1%. Figure 10 shows the estimation results of the model based on the new data set, and it is obvious that the estimation curve of the proposed strategy can better fit the actual measurement curve, showing suitable fitting ability.

SOC Estimation in a Variable Temperature Environment
The experimental results in the previous section show that the proposed Bayes-BiLSTM can achieve accurate battery SOC estimation at different constant temperatures. In fact, the lithium-ion battery's internal temperature is continuously changing during the whole operation, and the temperature has a very important influence on the battery, especially in the battery SOC estimation, which is a key factor that cannot be ignored regardless of the model adopted. Therefore, it is necessary to evaluate the estimation performance of the proposed method under a variable temperature environment. We selected some data corresponding to three different temperatures of 45 • C, 25 • C, and 0 • C under each working discharge in the first data set to form a new variable temperature environment data set; the data of the three DST, US06, and FUDS working conditions were used for model training, and the data of BJDST working conditions were used for model testing. Table 4 shows the results based on the variable temperature environment, and it can be seen that, through training, the estimation error of the model is small even in a variable temperature environment, and the MAE is controlled within 1%. Figure 10 shows the estimation results of the model based on the new data set, and it is obvious that the estimation curve of the proposed strategy can better fit the actual measurement curve, showing suitable fitting ability.

Comparison of Different Methods
To verify the superiority of the proposed method, different methods are used for onetime battery SOC estimation, including a comparison of three strategies, LSTM, BiLSTM, and Bayes-BiLSTM. To ensure the fairness of the comparison experiments, both the first data set and the same training and test sets are used for evaluation, where the LSTM model and BiLSTM model have the same implied layer structure, and the number of implied layer neurons is set to 64; Adam is the model optimization algorithm, and the mean absolute error is used as the loss function. Figure 11 shows the accuracy comparison of

Comparison of Different Methods
To verify the superiority of the proposed method, different methods are used for onetime battery SOC estimation, including a comparison of three strategies, LSTM, BiLSTM, and Bayes-BiLSTM. To ensure the fairness of the comparison experiments, both the first data set and the same training and test sets are used for evaluation, where the LSTM model and BiLSTM model have the same implied layer structure, and the number of implied layer neurons is set to 64; Adam is the model optimization algorithm, and the mean absolute error is used as the loss function. Figure 11 shows the accuracy comparison of the one-time estimation results of different methods at 45 • C, and each method shows a suitable fitting ability. Table 5 shows the results of hyperparameters after Bayesian Optimization of the BiLSTMnetwork. Figure 12 shows the error of battery SOC estimation under different methods. In the whole estimation period, the error of the proposed method is relatively stable; that is, the error is the smallest. As seen in Table 6, compared with LSTM and BiLSTM, the Bayes-BiLSTM model has the best prediction accuracy and achieves a better ability to capture long-term dependencies.

Comparison of Different Methods
To verify the superiority of the proposed method, different methods are used for onetime battery SOC estimation, including a comparison of three strategies, LSTM, BiLSTM, and Bayes-BiLSTM. To ensure the fairness of the comparison experiments, both the first data set and the same training and test sets are used for evaluation, where the LSTM model and BiLSTM model have the same implied layer structure, and the number of implied layer neurons is set to 64; Adam is the model optimization algorithm, and the mean absolute error is used as the loss function. Figure 11 shows the accuracy comparison of the one-time estimation results of different methods at 45 °C, and each method shows a suitable fitting ability. Table 5 shows the results of hyperparameters after Bayesian Optimization of the BiLSTMnetwork. Figure 12 shows the error of battery SOC estimation under different methods. In the whole estimation period, the error of the proposed method is relatively stable; that is, the error is the smallest. As seen in Table 6, compared with LSTM and BiLSTM, the Bayes-BiLSTM model has the best prediction accuracy and achieves a better ability to capture long-term dependencies.

Experiments on the Generalizability of the Models
To evaluate the generalization of the model, a second lithium battery data set wa used for SOC estimation. In this experiment, we chose to study the discharge phase of th

Experiments on the Generalizability of the Models
To evaluate the generalization of the model, a second lithium battery data set was used for SOC estimation. In this experiment, we chose to study the discharge phase of the half-cell in the second data set. In the experiment with a total discharge time of up to 25 h, a total of 92,422 sets of battery data were recorded every 1 s; for the model, a greater amount of data is not necessarily better. Too much data will not only increase the training time but also sometimes cause the deterioration of the model. Therefore, we obtain a set of battery data every 50 s, including three parameters of half-cell voltage, current, and SOC; after completing the data screening, 90% of the data set is used for model training, and 10% is used for model testing. After training, it can be seen from Figure 13 that the model achieves a satisfactory effect on the half-cell SOC estimation. Specifically, the MAE is 0.65%, the RMSE is 0.79%, and the overall error is controlled within 1%. This experiment further verifies that the model shows high accuracy and adaptability for the SOC estimation of batteries with different chemical compositions.

Conclusions
In this paper, we propose a method for lithium battery state-of-charge estimation based on Bayesian optimized bidirectional long-and short-term memory neural networks. The proposed method breaks the mold of traditional RNN studies that have been

Conclusions
In this paper, we propose a method for lithium battery state-of-charge estimation based on Bayesian optimized bidirectional long-and short-term memory neural networks. The proposed method breaks the mold of traditional RNN studies that have been using only forward dependencies and further summarizes the temporal dependencies in the context of lithium battery sequence data by adding reverse dependencies. This study uses two publicly available lithium battery data sets, the CALCE data set, and the Oxford pathdependent battery degradation data set, and establishes mapping relationships between the observable voltage, current, and temperature variables of the battery and the battery SOC through the data provided by the data sets. The training results of different network models and a combination of previous experiences are used to determine the parameter intervals of the network, and then a Bayesian optimization algorithm is introduced to obtain the optimal parameters of the network. Through a large number of comparative experiments, including battery SOC estimation under different constant temperatures, a variable temperature environment, and different methods, the experimental results show that the proposed Bayes-BiLSTM model has a suitable fitting ability, and the SOC of batteries with different chemical compositions is estimated with higher accuracy and adaptability.
Future work will focus on verifying the applicability of the model for battery SOC estimation based on the collected data by adding a battery testing experimental platform; furthermore, the structure of the proposed model will be further improved to enhance its battery SOC estimation accuracy in low-temperature environments.  Data Availability Statement: Data were obtained from the Center for Advanced Life Cycle Engineering (CALCE) at Columbia University [26] and the path-dependent battery degradation data set provided by the Information Office of the Battery Laboratory of Oxford University [27].