Extreme Learning Machine Using Bat Optimization Algorithm for Estimating State of Health of Lithium-Ion Batteries

: An accurate estimation of the state of health (SOH) of lithium-ion batteries is essential for the safe and reliable operation of electric vehicles. As a single hidden-layer feedforward neural network, extreme learning machine (ELM) has the advantages of a fast learning speed and good generalization performance. The bat algorithm (BA) is a swarm intelligence optimization algorithm based on bat echolocation for foraging. In this study, BA was creatively applied to improve the ELM neural network, forming a BA-ELM model, and it was applied to SOH estimation for the ﬁrst time. First, through Pearson and Spearman correlation analysis, six variables were determined as the input variables of the model. The actual remaining capacity of the battery was determined as the output variable. Second, BA was used to optimize the connection weights and bias in ELM to construct the BA-ELM model. Third, the battery data set was trained and tested with BA-ELM, ELM, Elman, back propagation (BP), radial basis function (RBF), and general regression neural network (GRNN) models. Five statistical error indicators, and the radar chart, scatter plot, and violin diagram were used to compare the estimation effects. The results show that the evaluation function of BA-ELM can converge quickly and effectively optimize the network model of ELM. The RMSE of the BA-ELM model was 0.5354%, and the MAE was 0.4326%, which is the smallest among the 6 models. The RMSE values of the other model were 2.27%, 3.53%, 3.07%, 3.86%, 3.24%, respectively, indicating the BA-ELM has good potential for future applications.


Introduction
Because of global warming, environmental pollution, energy shortages, and many other challenges, electric vehicles are becoming increasingly more popular as a green, efficient, and sustainable ideal transportation tool [1]. Lithium-ion batteries have become an ideal power source for electric vehicles because of their high energy density, long cycle life, and low self-discharge rate [2]. The batteries will age with repeated use, which will decrease the battery's charge and discharge capacity and the actual remaining capacity [3,4]. State of health (SOH) is a quantitative indicator used for evaluating the degree of battery aging. Generally, SOH is defined as the ratio of the actual remaining capacity of the battery to the rated capacity of the battery [5]. The accuracy estimation of the battery state of charge (SOC) and the cruising range of the electric vehicle both depend on the accurate estimation of the battery SOH [6]. In addition, aging batteries are more prone to thermal runaway [7]. Therefore, it is very important to evaluate reliable methods and strategies to accurately estimate the current remaining capacity and SOH of the battery.
At present, SOH estimation methods mainly include direct measurement-based estimation, model-based estimation, and data-based estimation. The direct measurement-based swarm intelligence techniques for the determination of the California bearing ratio of soils. The results of the hybrid model were better than other ELM-based models. To fully utilize the advantages of different algorithms, the development of a hybrid method for ELM and other optimization algorithms has become a new research direction.
On the other hand, BA is a swarm intelligence optimization algorithm based on bat echolocation for hunting [33]. As a metaheuristic algorithm used for searching for the global optimal solution, the BA provides a completely different solution to the optimization problem [34,35]. Yang et al. [36] proposed an enhanced adaptive BA for optimal energy scheduling in a microgrid system. Because of the different search mechanisms applied in the early and late search stages, the search performance improved. Shivaie et al. [37] developed a reliability-constrained cost-effective model to identify the optimal sizing of an autonomous hybrid renewable system. The bat search algorithm was used to obtain the final optimal solution. Based on a hybrid bat algorithm (BA)-harmony search algorithm technique, Peddakapu et al. [38] proposed a new two-degree freedom-tilted integral derivative with a filter controller for a two-area wind-hydro-diesel power system. A sensitivity analysis showed that the robustness of the controller was improved. Thus, the BA has global exploration and local exploitation capabilities, and it is entirely possible to use it to optimize the ELM model.
Based on the above discussion, the main contributions of this study are as follows:

1.
A globally optimized BA can be used to optimize the connection weights and bias of the ELM neural network. The BA-ELM model can be creatively constructed.

2.
The relevant data of the battery can be analyzed by Pearson and Spearman correlation; thus, the data can be determined scientifically and reasonably. 3.
Through a convergence analysis of the BA algorithm, the optimization effect can be further evaluated. 4.
Through a comparison of BA-ELM, ELM, BP, Elman, RBF, and GRNN, the effectiveness of the proposed model and the performance of SOH estimation can be comprehensively evaluated.
The structure of this paper is arranged as follows: Section 2 provides an overview of the standard ELM and BA algorithms. Section 3 describes the data acquisition and processing related to the battery charge and discharge test. Section 4 provides detailed information about the BA-ELM model. Section 5 reports a comparison with another 5 neural network models. Section 6 provides conclusions and future work directions.

ELM
Huang et al. [39] first proposed relevant theories and applications of ELM in 2006. The structure of the classic ELM model is mainly composed of an input layer, a hidden layer, and an output layer, as shown in Figure 1. The input layer has n neurons, i.e., n input variables x. The output layer has m neurons, i.e., m output variables y. The hidden layer has l neurons. ω ij represents the connection weight between the i-th neuron in the input layer and the j-th neuron in the hidden layer. β jk represents the connection weight between the j-th neuron in the hidden layer and the k-th neuron in the output layer. g(·) is the activation function, b is the bias of the hidden layer, X is the input matrix, Y is the output matrix, and the number of training samples is Q. The main steps of the ELM algorithm are shown in Table 1.

Algorithm of ELM
Step 1: The number of neurons in the input layer n, hidden layer l, and output layer m are determined separately. The connection weight ω between the hidden layer and the input layer and the bias b of the hidden layer are randomly set.
Step 2: The activation function of the hidden layer neurons g(x) is determined, then the hidden layer output matrix H is calculated.
Step 3: The connection weight β between the output layer and the hidden layer is calculated by the formula β = H + Y T . where: The output Y of the ELM neural network can be calculated using Equation (4):

Algorithm of ELM
Step 1: The number of neurons in the input layer n, hidden layer l, and output layer m are determined separately. The connection weight ω between the hidden layer and the input layer and the bias b of the hidden layer are randomly set.
Step 2: The activation function of the hidden layer neurons g(x) is determined, then the hidden layer output matrix H is calculated.
Step 3: The connection weight β between the output layer and the hidden layer is calculated by the formula β = H + Y T . where: The output Y of the ELM neural network can be calculated using Equation (4): where H is the hidden layer output matrix of the ELM neural network, as shown in Equation (5): The connection weight β between the output layer and hidden layer can be calculated using the least squares solution of Equation (6): The solution can be expressed as follows: The estimation of SOH based on the neural network algorithm is a new artificial intelligence method. As a single hidden-layer feedforward neural network, ELM has the advantages of a fast learning speed, high calculation efficiency, and good generalization performance. However, during the establishment of ELM, the number of hidden layer neurons is not fixed, and the connection weight and threshold are randomly set, which may cause the battery SOH estimation to be inaccurate. To overcome these shortcomings, we tried to use the BA optimization algorithm to improve the SOH estimation performance of ELM.

BA
Bats emit ultrasonic waves through their mouths. When the ultrasonic waves encounter prey or obstacles, they reflect back to form an echo, which is received by the bat's ears. The bat relies on these echoes for accurate positioning, which allows it to fly freely and hunt accurately in a completely dark environment, as shown in Figure 2. Interestingly, the wavelength of the ultrasonic waves emitted by bats is very close to the size of the prey. Inspired by this fact, Yang first proposed the theory and basic framework of the BA in 2010 [40]. BA is a heuristic algorithm used for searching for the global optimal solution. The main steps of BA are shown in Table 2, where x * is the current global optimal solution.

The Pseudo Code of Bat Algorithm
Step 1: Initialize parameter settings, including the population size n, initial impulse loudness A0, initial impulse emission rate r0, maximum frequency Qmax, minimum

The Pseudo Code of Bat Algorithm
Step 1: Initialize parameter settings, including the population size n, initial impulse loudness A 0 , initial impulse emission rate r 0 , maximum frequency Q max , minimum frequency Q min , max number of iterations N, and fitness evaluation function Fitness (x).
Step 2: While (t < the max number of iterations) Calculate the frequency Q i , location S i , speed V i , and fitness value Fitness i of each bat.
Step 3: If (rand > r i ) 1. Obtain an optimal solution BestS in this iteration. 2. Calculate the local solutions around the optimal solution.
Step 4: End if Produce new solutions by change randomly Step 5: if (rand < A i and Fitness (x i ) < Fitness (x * )). 1. Accept the new solutions. 2. Decrease the impulse loudness A i and increase the impulse emission rate r i .
Step 6: End if Sort all bats and obtain the optimal solution BestS in this iteration.
Step 7: End while The flight frequency of the bat can be obtained using Equation (9), where rand ∈ [0, 1] is a random vector obtained from a uniform distribution. According to the sound wave calculation formula, the speed is the multiplication of the wavelength and the frequency. Thus, the flying speed of the bat can be obtained using Equation (10). The position of the bat can be obtained using Equation (11). f min represents the bat with the smallest fitness; BestS is the position corresponding to the bat with the smallest fitness, i.e., the current best position, where α and γ are constants; A is the loudness; and r is the pulse emission rate: The BA changes the frequency randomly, providing a good global exploration and optimization ability. The local exploitation capabilities are enhanced by varying the loudness and pulse emission rate. The BA uses tuning technology to control the dynamic behavior of the bat population. The fitness function is used to compare the pros and cons of each bat's location. Survival of the fittest in a bat colony is likened to an iterative process of replacing poorer feasible solutions with good feasible solutions. The characteristics of the BA provide a completely different solution to the optimization problem. Therefore, we tried to use the BA algorithm to optimize the connection weights and bias in the ELM model.

Data Acquisition
In this study, the battery data set obtained from the NASA Prognostic Center of Excellence (PCoE) was used for related research [41]. The B6 lithium-ion battery of NASA has a rated capacity of 2 Ah. The battery was charged and discharged at room temperature, and the data, such as the voltage, current, and battery temperature, were collected. First, the battery was charged in the 1.5 A constant current mode until the battery voltage reached 4.2 V. Then, the battery was continuously charged in a constant voltage mode until the charging current dropped to 20 mA. Next, the battery was discharged in the 2A constant current mode until the voltage dropped to 2.5 V. As the battery was repeatedly charged and discharged, the available capacity of the battery decayed. The experiment was stopped when the actual battery capacity dropped from 2 to 1.2 Ah.
We further sorted out the data of the eight variables in the experiment, namely, the constant current charging time T I , constant voltage charging time T V , total charging time T total,charge , battery voltage change at charging ∆V charge , total discharge time T total,discharge , battery temperature change during discharge ∆Temp discharge , battery voltage change at discharge ∆V discharge , and the actual remaining capacity of battery C aged . The relationship between the actual remaining capacity and number of cycles is shown in Figure 3.

Data Processing
To determine the input data of the neural network more scientifically and reasonably, we first drew the scatter figures between the 7 variables of the battery and the actual remaining capacity, and added a confidence ellipse to the scatter figure, where the confidence level of the ellipse was 95%, as shown in Figures 4-10. Then, the eight variables of the battery were analyzed for the Pearson and Spearman correlation analyses. The coefficient of Pearson assesses the linear correlation between two variables while the coefficient of Spearman assesses the monotonic relationship between two variables. Taking the two variables of X and Y as examples, the coefficient of Pearson could be obtained using Equation (14), and the coefficient of Spearman could be obtained using Equation (15), where di is the difference of the rank of the i-th data pair, and N is the number of samples. Table 3 shows the judgment criteria between the degree of correlation and the correlation coefficient. The results are shown in Table 4.

Data Processing
To determine the input data of the neural network more scientifically and reasonably, we first drew the scatter figures between the 7 variables of the battery and the actual remaining capacity, and added a confidence ellipse to the scatter figure, where the confidence level of the ellipse was 95%, as shown in Figures 4-10. Then, the eight variables of the battery were analyzed for the Pearson and Spearman correlation analyses. The coefficient of Pearson assesses the linear correlation between two variables while the coefficient of Spearman assesses the monotonic relationship between two variables. Taking the two variables of X and Y as examples, the coefficient of Pearson could be obtained using Equation (14), and the coefficient of Spearman could be obtained using Equation (15), where d i is the difference of the rank of the i-th data pair, and N is the number of samples. Table 3 shows the judgment criteria between the degree of correlation and the correlation coefficient. The results are shown in Table 4.
Analyzing Figures 4-10 and Table 4, the coefficients of Spearman corresponding to T I , T total,discharge , and ∆Temp discharge are all positive. This shows that the relationship between these three variables and the available remaining capacity monotonically increased. The coefficients of Spearman corresponding to T V , T total,charge , ∆V charge , and ∆V discharge are all negative, indicating that the relationship between these four variables and the available remaining capacity monotonically decreased. In Figure 4, the ratio of the long axis to the short axis of the confidence ellipse corresponding to T I is the largest, and the coefficients of Pearson and Spearman are the largest. This indicates that the linear correlation between T I and the actual remaining capacity is the largest, and the monotonic correlation is the strongest. The absolute value of the Pearson and Spearman coefficients of T total,charge is the smallest, and the ratio of the major axis to the minor axis of the confidence ellipse corresponding to T total,charge is the smallest, indicating that the correlation between T total,charge and the actual remaining capacity is the smallest.
Taking the two variables of X and Y as examples, the coefficient of Pearson could be obtained using Equation (14), and the coefficient of Spearman could be obtained using Equation (15), where di is the difference of the rank of the i-th data pair, and N is the number of samples. Table 3 shows the judgment criteria between the degree of correlation and the correlation coefficient. The results are shown in Table 4.
According to the absolute value of Pearson's correlation coefficient, the order of linear correlation can be expressed as follows: According to the absolute value of Spearman's correlation coefficient, the order of monotonic correlation is as follows: Through a comparative analysis, the variable T total,charge with the lowest correlation was eliminated. The constant current charging time T I , constant voltage charging time T V , battery voltage change at charging ∆V charge , total discharge time T total,discharge , battery temperature change during discharge ∆Temp discharge , and battery voltage change at discharge ∆V discharge were determined as the input variables of the model. The actual remaining capacity of the battery C aged was determined as the output variable.
In this study, the values of the six input variables have different dimensional ranges. For example, the min value of ∆V discharge is 0.2; the max value of T V is 9800; the difference between the two is 49,000 times. The large gap will oscillate the neural network model back and forth when the gradient is updated, and affect the final accuracy of the model. Therefore, Equation (16) was used to uniformly process the values of the 6 input variables and converted them into an interval of [−1, 1], where y min and y max are the minimum and maximum values of y. In all the samples, 70% of the data were randomly selected for training, and the remaining 30% for testing:

The Proposed Model
In this study, we proposed a BA-ELM model and applied it to estimate battery SOH for the first time. The process of SOH estimation based on the BA-ELM model is shown in Figure 11. The pseudo code of BA-ELM is shown in Table 5. The main steps are as follows: S1: Battery charge and discharge test. The lithium-ion battery was charged and discharged at room temperature. The specific test process is described in Section 3.1.
S2: Obtain the battery data and analyze the correlation.
(1). The data of the eight variables in the test were sorted. The sample data were normalized to the same dimension range: 70% of the data were randomly selected for training, and the remaining 30% was tested. (2). Through Pearson and Spearman correlation analysis, T I , T V , T total,discharge , ∆Vcharge, ∆Temp discharge , and ∆ Vdischarge were determined as the input variables of the model, and C aged was determined as the output variable.
S3: The global exploring ability of the BA was used to optimize the output connection weight, input connection weight, and bias b of the hidden layer of the ELM.
(1). Initialize the parameter of BA. The test data set was tested in the BA-ELM to estimate the actual battery capacity.
In the parameter initialization of BA, n = 10, A 0 = 0.9, r 0 = 0.9, Q max = 1, Q min = 0, α = 0.9, γ = 0.9, the max number of iterations N was 5000. The fitness function of the bat is the objective function, expressed by the root MSE (RMSE) of Equation (17), where T is the output of the training set, G is the sample size, and Y can be calculated using Equation (18):  Figure 11. Algorithmic process of BA-ELM. Figure 11. Algorithmic process of BA-ELM.

The Pseudo Code of BA-ELM
Step 1: Data acquisition and data processing.
Step 2: Generate the training set and the test set.
Step 3: Initialize the parameters of BA, including the population size n, initial impulse loudness A 0 , initial impulse emission rate r 0 , maximum frequency Q max , minimum frequency Q min , the max number of iterations N, and fitness evaluation function Fitness (x).
Step 4: While (t < the max number of iterations) Calculate the frequency Q i , location S i , speed V i , fitness value Fitness i of each bat.
Step 5: If (rand > r i ) 1. Obtain an optimal solution BestS in this iteration. 2. Calculate the local solutions around the optimal solution.
Step 6: End if Produce new solutions by change randomly Step 7: If (rand < A i and Fitness (x i ) < Fitness (x * )). 1. Accept the new solutions. 2. Decrease the impulse loudness A i and increase the impulse emission rate r i .
Step 8: End if Sort all bats and obtain the optimal solution BestS in this iteration.
Step 9: End while and accept the optimal output connection weight β.
Step 10: Determine the input connection weight ω and the bias b. Obtain the network structure of BA-ELM Step 11: Estimate the actual battery capacity using the BA-ELM model.

Results
To analyze the optimization effect of the BA, we drew the evaluation function, impulse loudness, and impulse emission rate diagrams, as shown in Figures 12-14. The evaluation function is f min , representing the bat with the smallest current fitness level, and it was obtained using Equation (8). In this study, the bat's velocity is a vector. Therefore, we propose a new concept, i.e., the average velocity modulus length v . We first calculated the velocity modulus length of each bat, as shown in Equation (19), where D is the dimension of the vector. Then, the current average velocity modulus length of all the bats was calculated, as shown in Equation (20), where n is the number of bats. The relationship between the average velocity modulus length and number of iterations is shown in Figure 15.
By analyzing Figure 12, we found that the value of the evaluation function dropped significantly. When the number of iterations was 1650, the evaluation function tended to converge, indicating that the BA achieved the expected effect of optimization. In Figures 13 and 14, we can find that the impulse loudness A i decreased during the iteration and reached the minimum at about 1100 iterations. The impulse emission rate r i increased and reached the maximum at about 18 iterations. Figure 15 shows that the average velocity modulus length of bats increased during the iteration. Combined with Figure 12, it can be concluded that the smaller the evaluation function, the better the position of the bat, and the closer the bat is to the position of the prey, the greater the bat's velocity modulus. This is consistent with the fact that the closer the hunter is to the prey, the faster the hunter's reaction speed is in nature. Figure 16 shows the test error result of the actual remaining capacity of the battery. The estimated error of the actual remaining capacity estimated by BA-ELM is less than 0.02 Ah, and the maximum error is less than 1%. velocity modulus length of each bat, as shown in Equation (19), where D is the dimens of the vector. Then, the current average velocity modulus length of all the bats w calculated, as shown in Equation (20), where n is the number of bats. The relations between the average velocity modulus length and number of iterations is shown in Fig  15.

Discussion
To

Discussion
To further evaluate the estimation accuracy of the C aged of the BA-ELM model, we constructed neural network models of ELM, BP, Elman, RBF, and GRNN. The estimated error of the C aged , RMSE, mean absolute error (MAE), mean absolute percentage error (MAPE), MAX error (MAX), and MIN error (MIN) were used to compare the estimated accuracies of six models. The results are shown in Figures 17-19 and Tables 6 and 7.

Discussion
To      To further compare the performance of the six models on various error indicators, we sorted them according to the pros and cons of each indicator. Furthermore, we assigned 6 points for ranking first, 5 points for ranking second, and so on, with 1 point assigned for ranking sixth. The higher the score of a certain model on a certain error index, the better the performance of the algorithm on this error index. The results are shown in Table 8. We drew the radar chart of the 5 error indicators for the 6 models, and the results are shown in Figure 20. The shadow area covered by the BA-ELM model is the largest while the shadow area covered by BP and RBF is smaller. According to the total score of the five error indicators, the results of all models are as follows: BA-ELM (28) > ELM (21) > Elman (15) = GRNN (15) > BP (13) > RBF (12).  The predictive results of all models are illustrated in Figure 21a-f in the form of scatter plots and determination coefficients. It can be seen from the scatter plots that the BA-ELM provides less scattered estimates. Compared to other models, the fit line equation of BA-ELM is closer to the exact line (y = x), with a higher determination coefficient. It is followed by the ELM, BP, and Elman models. RBF and GRNN provide poor estimates while these two models also have lower determination coefficients of 0.9819 and 0.9883, respectively. The predictive results of all models are illustrated in Figure 21a-f in the form of scatter plots and determination coefficients. It can be seen from the scatter plots that the BA-ELM provides less scattered estimates. Compared to other models, the fit line equation of BA-ELM is closer to the exact line (y = x), with a higher determination coefficient. It is followed by the ELM, BP, and Elman models. RBF and GRNN provide poor estimates while these two models also have lower determination coefficients of 0.9819 and 0.9883, respectively.
(a) (b)  In Figure 22, from the violin diagrams, the BA-ELM model demonstrates its advantage by having a distribution that is a more similar distribution to the actual capacity as compared to other models. The data in the BA-ELM model is the most concentrated. A small amount of data in the ELM and RBF models, respectively, is far from the actual value. The median in the BP model is on the high side. A graphical comparison justifies the results obtained using the statistical indicators presented in the previous tables. Based on the above discussion, it can be concluded that compared with the other five models, the BA-ELM model has a better performance and can accurately  In Figure 22, from the violin diagrams, the BA-ELM model demonstrates its advantage by having a distribution that is a more similar distribution to the actual capacity as compared to other models. The data in the BA-ELM model is the most concentrated. A small amount of data in the ELM and RBF models, respectively, is far from the actual value. The median in the BP model is on the high side. A graphical comparison justifies the results obtained using the statistical indicators presented in the previous tables. Based on the above discussion, it can be concluded that compared with the other five models, the BA-ELM model has a better performance and can accurately estimate the actual remaining capacity and SOH of the battery.

Conclusions
This study creatively established the BA-ELM model, i.e., by simulating the echolocation hunting behavior of bats, searching for the global optimal solution, and optimizing the output connection weight, input connection weight, and value of bias of the ELM. This model was also used for the first time in the field of SOH estimation of lithium-ion batteries. Six neural network models of ELM, BP, Elman, RBF, GRNN, and BA-ELM were constructed, and the actual available capacity of the battery was estimated and compared through the test set.
The following conclusions can be derived based on the results and application: 1. The relevant data of the battery can be analyzed by Pearson and Spearman correlation. The training time of the neural network model can be reduced by removing input variables with a low absolute value of Pearson's and Spearman's correlation coefficient. 2. The value of the evaluation function dropped significantly using BA. The convergence speed was fast. The BA achieved the expected effect of optimization. We proposed a new concept, i.e., the average velocity modulus length. The bat's velocity modulus became larger during the iteration. This is consistent with the fact in nature. 3. The main advantages of the proposed BA-ELM model include a fast learning speed and high SOH estimation accuracy. The BA-ELM provided less scattered estimates, and its fit line equation was closer to the exact line (y = x) with a higher determination coefficient compared to other models. The connection weight and threshold of ELM were randomly set, which may cause the battery SOH estimation to be inaccurate. A globally optimized BA can be used to optimize the connection weights and bias of the ELM neural network.

Conclusions
This study creatively established the BA-ELM model, i.e., by simulating the echolocation hunting behavior of bats, searching for the global optimal solution, and optimizing the output connection weight, input connection weight, and value of bias of the ELM. This model was also used for the first time in the field of SOH estimation of lithium-ion batteries. Six neural network models of ELM, BP, Elman, RBF, GRNN, and BA-ELM were constructed, and the actual available capacity of the battery was estimated and compared through the test set.
The following conclusions can be derived based on the results and application: 1.
The relevant data of the battery can be analyzed by Pearson and Spearman correlation. The training time of the neural network model can be reduced by removing input variables with a low absolute value of Pearson's and Spearman's correlation coefficient.

2.
The value of the evaluation function dropped significantly using BA. The convergence speed was fast. The BA achieved the expected effect of optimization. We proposed a new concept, i.e., the average velocity modulus length. The bat's velocity modulus became larger during the iteration. This is consistent with the fact in nature.

3.
The main advantages of the proposed BA-ELM model include a fast learning speed and high SOH estimation accuracy. The BA-ELM provided less scattered estimates, and its fit line equation was closer to the exact line (y = x) with a higher determination coefficient compared to other models. The connection weight and threshold of ELM