An adaptive state of charge estimator for lithium‐ion batteries

This study presents a data‐driven approach in conjunction with an adaptive extended Kalman filter (AEKF) to estimate lithium‐ion batteries' state of charge (SOC) online. The Thevenin battery model is used to evaluate the effects using battery voltage and current. The advantages of the Lagrange multiplier method are utilized to model the lithium‐ion battery. The Lagrange multiplier method continuously decreases the model error to adjust the Kalman gain of AEKF for accurate SOC estimation. Various current profiles such as hybrid pulse test, dynamic stress test, and Beijing dynamic stress test are used to verify the proposed approach's adaptability, robustness, and accuracy. It is observed that the proposed approach outperforms other methodologies (recursive least square–AEKF and forgetting factor recursive least square–AEKF) due to its high accuracy (mean average error of 0.32%). Additionally, the proposed approach exhibits robustness and high convergence speed despite deliberate erroneous initialization of parameters, thus indicating its applicability in online SOC estimation applications.


| INTRODUCTION
Research related to clean energy has become a hot topic for researchers to deal with environmental concerns in the last few decades. As a result, lithium-ion batteries have become increasingly popular due to their high demand as onboard energy storage systems for highpower applications such as electric vehicles, submarines, satellites, smart grids, and low-power applications such as cellphones and notebooks. [1][2][3] However, the safe operation of these batteries is a concern because it affects the efficiency and life cycle of the battery, leading to total failure in a few cases. 4,5 Therefore, an intelligent management system is required to ensure the reliable performance of lithium-ion batteries. Furthermore, the battery management system (BMS) should be capable of accurately measuring the state of health (SOH), state of charge (SOC), and state of power (SOP). 6 Nevertheless, precise SOC estimation is an insurmountable problem due to inappropriate management of the associated BMS equipment. 7,8 In recent years, various approaches have been reported for battery SOC estimation. 9 Based upon the literature, these methods can be categorized as follows: (i) direct measurement approaches; (ii) machine learning-based approaches; and (iii) model-based approaches. 10 (i) Direct measurement approaches: Direct SOC estimation can be further categorized as coulomb counting (CC) and open-circuit voltage (OCV) methods. In the CC method, the integration of battery current estimates the SOC if the initial SOC is known. This SOC measurement technique is simple and easy to implement. However, an inaccurate initial SOC causes uncorrectable estimation errors in online applications. 9 In the OCV method, a battery's relation between SOC and OCV can be developed using a fixed charge/discharge rate. 11 Although this method has relatively high accuracy, it requires sufficient relaxing time to measure the accurate value of OCV. Therefore, these methods cannot be utilized for online SOC estimation. (ii) Machine learning-based approaches: Machine learning methods use the relationship between input and output data to measure the SOC of lithium-ion batteries. These methods are referred as black-box models because they do not require an exact battery model for estimation. Several machine learning algorithms such as neural networks (NNs), 12,13 support vector machine (SVM), 14,15 and fuzzy logic controllers 16,17 have been used for SOC estimation. The accuracy of these methods is significantly dependent on the size of data used for training to build the model. However, an increase in training size increases the computational complexity of the model. (iii) Model-based approaches: In recent years, modelbased SOC estimation has gained significant attention from researchers. Various battery models such as the electrochemical model, 18 physical model, 19 and equivalent circuit models (ECMs) 20 have been reported. 21 In general, mathematical expressions are used to develop battery models. The ECM is the most preferred model due to its better adaptability and accuracy. 21 Additionally, the parameters of an ECM can be identified online 22 or offline. 23 However, the model parameters constantly change during real-time applications due to dynamic operational conditions and the battery's aging. Therefore, an online approach that can adapt to the dynamic changes in the battery is required. Several methods such as least squares, parameter regulator, 24 recursive least squares (RLS), 25 and variants of RLS fused with particle filter, 26 H-infinity filter, 27 and Kalman filter 24 have been reported for model identification and SOC estimation. A study 28 used a variant of particle filter (unscented particle filter) to estimate SOC. Additionally, in 28 the variable forgetting factor (FF) RLS was utilized to identify the parameters of the lithium-ion battery, and the SOC was estimated using an H-infinity filter. Although their methodology had high accuracy, the computational cost was significantly high. Therefore, to overcome this issue, the Kalman filter family has been widely adopted for SOC estimation. Li et al. 29 used variable FF-RLS conjunction with sigma point Kalman filter, and the resultant SOC estimation error was reduced to 0.68%. Plett proposed the utilization of an adaptive extended Kalman filter (AEKF) to estimate the SOC of lithium-ion batteries. 30 The performance of AEKF is significantly dependent on the identification of lithium-ion battery model parameters and the noise information. Additionally, dual AEKF has been utilized to evaluate the performance for SOC estimation. 31 The results demonstrated a mean absolute error (MAE) of 0.68% with a convergence speed of 690 s for the hybrid pulse current test. The accuracy of the model was considerably high; however, it required a long computational time.
Ali et al. 32 utilized the method of Lagrange multipliers to determine the model parameters, and the designed OCV estimator demonstrated an MAE and convergence speed of 0.94% and 81 s, respectively, at a constant discharge current. Therefore, it is crucial to utilize the advantages of the Lagrange multiplier method with AEKF for SOC estimation in a dynamic environment.
The main contribution of this studies are following: 1. The Lagrange multiplier method is employed to identify the first-order resistance-capacitance (RC) equivalent circuit battery model. 2. The EKF based adaptive estimator is designed to estimate the SOC of lithium-ion batteries. 3. The Lagrange multiplier method is utilized to reduce the error between modeled and measured output voltage online. The AEKF adaptively updated the noise covariance depending upon voltage error, resulting in improved SOC estimation accuracy. 4. Different types of dynamic profiles of a lithium-ion battery are used to validate the accuracy of the proposed approach. Additionally, a comparative analysis between the proposed and other reported datadriven approaches is also performed to show the superiority of the proposed approach.
The study is structured as follows: The lithium-ion battery model and its identification are described in Section 2. Sections 3 and 4 detail the SOC estimator design using AEKF and the proposed framework. The comparative analysis and results are discussed in Sections 5 and 6. Finally, the conclusions drawn from this study are summarized in Section 7.

| Lithium-ion battery modeling
A reliable and accurate battery model should be selected to analyze and estimate the dynamic behavior of the lithium-ion battery. Several studies have compared various types of battery models 21 ; it has been observed that ECMs have better adaptability and accuracy. In this study, a first-order RC model was selected to handle the tradeoff between complexity and accuracy. 33 Figure 1 shows the lithium-ion battery model adopted for this study.
Here, U U , , o l and I l are the battery OCV, terminal/load voltage, and load current, respectively. R R , , x y and C y are the lithium-ion battery inner resistance, polarization/ diffusion resistance, and polarization/diffusion capacitance, respectively. Furthermore, U x and U y are the voltage across R x and polarization branch, respectively. Therefore, the following equations can be utilized to describe the lithium-ion battery model 33 : The zero-order hold (ZOH) method can be utilized to discretize the above equations. Upon applying Laplace transformation to Equation (2), we obtain the following: By substituting the U (0) = 0, y Equation (3) becomes By applying inverse Laplace where t Δ is the sampling time and τ is the time constant of R y and C y .
The First order battery model used in this study Upon applying inverse z-transform, we obtain Similarly, after discretization, Equation (1) becomes

| Lithium-ion battery model identification using lagrange multiplier method
In this section, the online Lagrange multiplier-based approach is derived for battery model identification. By using Equations (12) and (13), we obtain By (15) and rearranging it, Equation (16) can be derived as: where: The following can be utilized to identify the battery parameters: For battery model identification, the above equation becomes where The main aim is to compute the weight vector (Θ) to satisfy all the data points with minimal fluctuation. Therefore, the error k (ΔΘ ( )) between two adjacent weight vectors k k (Θ ( )andΘ ( − 1)) should be minimized.
For all data points, Equation (20) can be written as The error between the modeled and actual values is represented by ε. The Lagrange multiplier method can define the cost function in the optimization environment for the above problem. 34 For the battery model, the above-mentioned cost function can be defined as In the above equation, λ k ( ) is the Lagrange multiplier and can be computed as Using the above equations, Equation (25) becomes To determine the minimum values, the first derivative of the above cost function (for its weight vector) is set to 0. Now, By substituting all the values in Equation (28), it becomes A controlling parameter ψ ( ) can be introduced in Equation (31) for application in the adaptive algorithm; this parameter is also known as the forgetting factor.
Using Equation (22), Equation (32) becomes In some cases, the determinant of k k Φ( )Φ ( ) T becomes zero; therefore, a small number μ ( ) in relation to data can be added to avoid such circumstances. 35 Figure 2 shows the working framework of the Lagrange multiplier method.

| State of charge
The SOC of the lithium-ion battery can be described as the ratio of current to the total available capacities. In mathematical form, SOC can be written as and η are the current SOC, initial SOC, capacity, and Columbic efficiency of the lithium-ion battery. After discretization, Equation

| SOC estimation using adaptive extended Kalman filter
In this study, AEKF was utilized for online SOC estimation of the lithium-ion battery. The discrete-time state-space model of the battery can be described using Equations (1), (2), and (36). 36 The aforementioned system can be represented in state-space forms as For SOC estimation, AEKF filter design ω k ( ) and ν k ( ) are the unmeasured process and measurement noises, respectively. 30,37,38 Upon adding the noises, the nonlinear model becomes y k g x k u k ν k ( ) = ( ( ), ( )) + ( ).
After initializing the state vector x ( ) o and covariance error P ( ) o , the state variables and error covariance are updated with time using the following equations: Additionally, the Kalman gain is computed using the following equation: The following equation is used to update the state variables: x k x k K k e k ( + 1) =ˆ( ) ( ) + ( ), . The error covariance is updated using the following equation: The following equations represent the adaptive adjustment process:

| PROPOSED APPROACH
The complete framework of the proposed approach, comprising the Lagrange multiplier method and AEKF, is shown in Figure 3. The lithium-ion battery measurements (voltage and current) are utilized to identify and update the lithium-ion battery parameters using the Lagrange multiplier method, as discussed in Section 2.2. The OCV-SOC lookup table is used to estimate the OCV, and the error between measured and modeled terminal voltage was fed to the adaptive filter to update the noise covariance, resulting in an improved SOC estimation accuracy. In this study, MATLAB® 2021 is used to perform the processing and analysis.

| Lithium-ion battery test under HPPC
To develop the relationship between SOC and OCV, the HPPC test is utilized. First of all, the battery is fully charged up to 100% SOC using the constant current constant voltage (CCCV) method. The discharge current of 1A is applied for the interval of 10 min, and then an interrupt of 20 min is applied to the battery to achieve its equilibrium state in resting mode. The open-circuit voltage is measured against the SOC value of the lithium-ion battery. Figure 4 shows the behavior of terminal voltage during the HPPC experiment for a single cycle. After applying almost 12.5 cycles of hybrid pulses, the lithium-ion battery gets fully discharged to 0% SOC, as depicted in Figure 4. Next, all the points of OCV against each SOC are measured and utilized to make a Lookup table to drive the OCV-SOC relationship.
After that, the battery terminal voltage and measured current are utilized to identify the model parameters using the proposed approach. Figure 5 shows the identified model parameters using the proposed approach (for the HPPC test).
In Figure 5, after a rest of 20 min, an abrupt change in the battery parameters (ohmic resistance and polarization branch) can be observed because the discharge current is applied at that instant. The resistances values increased slowly due to the variation in the SOC. However, the rapid increase in the value is observed at low values of SOC, also discussed by Xiong et al. 38 After computing the online battery parameters, results of the modeled terminal voltages and estimated SOC, and the  Figure 6A-C, respectively.
Various performance indicators such as root mean square error (RMSE), maximum error (ME), and MAE are used to illustrate the results. Table 1 presents the comparative analysis of the proposed approach with the most commonly used model-based approaches such as RLS-AEKF 41 and FF-RLS-AEKF. 42,43 It is important to note that the proposed methodology only has an MAE of 0.033 V for terminal voltage. The RMSE of only 0.41% is observed during the complete discharge of the battery, whereas the RLS-AEKF and FF-RLS-AEKF show the SOC RMSE of 0.98% and 0.75%, respectively. It shows that the proposed approach almost reduces the error by 0.24% as compared to FF-RLS-AEKF.

| Lithium-ion battery test under DST and BJDST
For further validation of the proposed approach, the SOC estimation accuracy of two dynamic current profiles of DST and BJDST is also checked. The identification and estimation results of both the tests are presented in Figures 7A-C and 8A-C. The comparative analysis of the proposed approach and other methodologies against DST and BJDST profiles are presented in Tables 2 and 3,  respectively. After carefully analyzing the performances of all the approaches against DST and BJDST, it can be seen that the proposed approach outclasses the RLS-AEKF and FF-RLS-AEKF. The RMSE of only 0.49 and 0.41 is observed for SOC estimation using the proposed approach against DST and BJDST, respectively. Furthermore, the proposed approach is applied to estimate the SOC with inaccurate initial SOC to check the convergence speed and adaptability. The proposed approach shows high convergence speed, as shown in Figure 9A,B.

| DISCUSSION
As discussed earlier, the safe operation of lithium-ion batteries significantly affects the reliability and durability of various electrical appliances. SOC indicator is an essential part of BMS to protect the lithium-ion battery from deep discharge/overcharge conditions. Therefore, an accurate SOC estimation approach is crucial. 9 A previous study, 32 which used the Lagrange multiplier method without a filter, demonstrated promising results with an MAE and ME of 0.94% and 1.5%, respectively. This study utilized the advantages of the Lagrange multiplier method with EKF to enhance the SOC estimation accuracy. It is evident from Figure 5 that the model parameters have a relationship with the SOC, which indicates that the commonly used nonadaptive models cannot evaluate the variation under working conditions and battery aging. Despite the erroneous initialization, the proposed approach robustly adapted to the variations and converged quickly (see Figure 5). Based on the model identification, it can be assumed that the proposed approach exhibits similar robustness against the variations of other parameters (temperature and battery aging). In Figure 6A, The results of modeled and measured terminal voltages are compared. The error profile shows the maximum error of 0.14 V during the whole cycle. An RMSE value of 0.041 V was observed for the entire cycle. It occurred because the Lagrange multiplier method continuously minimized the value of k ΔΘ ( ). Based on battery model parameters identification, the AEKF continuously adjusted the SOC values to reduce the terminal voltage error (as shown in Figure 6B,C). The difference between the estimated and reference SOC is low, resulting in accurate OCV estimation (see Table 1). Therefore, the error in terminal voltage can be reduced by adjusting the Kalman gain, and the identified battery model parameters updated the Kalman gain. In Table 1, it is observed that the SOC estimation MAE of the proposed approach is 0.44% compared with that of RLS-AEKF (0.92%) and FF-RLS-AEKF (0.71%). The maximum noted error was 0.89%, and it occurred at the end of the cycle because of the abrupt change in the OCV values, also reported in. 44 T A B L E 3 Comparison of the proposed approach with RLS-AEKF and FF-RLS-AEKF for BJDST Parameters Furthermore, to prove the adaptability and reliability of the proposed approach, DST and BJDST are also performed. Figures 7A-C and 8A-C illustrate the results of the proposed approach against the DST and BJDST current profiles, respectively. The proposed approach demonstrated a similar performance against DST and BJDST, as shown for the HPPC test (see Tables 2 and 3). An RMSE value of 0.49% and 0.41% was observed against the DST and BJDST profiles, respectively. Thus, the proposed approach outperformed other algorithms with an RMSE value approximately two times lower than the RLS-AEKF for the DST profile (see Table 2). The low value of MAE/RMSE indicated that the proposed approach accurately evaluated the parameters of the lithium-ion battery model and measured its SOC with high accuracy. The proposed approach shows the high accuracy and adaptability in the presence of inaccurate initial SOC value. The proposed approach converges the limit of ±1% estimation error within the 30-time step, as shown in Figure 9A,B. In the future, the OCV estimation error induced due to data insufficiency or environment variation in the OCV-SOC lookup table can be addressed.
Furthermore, it robustly converged despite the erroneous initialization in a few steps. The proposed approach results and comparisons show high accuracy in the dynamic environment compared to RLS-AEKF and FF-RLS-AEKF. Hence, the proposed approach is suitable for online SOC estimation in BMS design for online applications such as cell phones, notebooks, pads, and electric vehicles.

| CONCLUSION
In this study, an online Lagrange multiplier data-driven approach was developed to improve the lithium-ion battery modeled terminal voltage prediction accuracy. Battery measurements (voltage and current) are utilized to identify the model parameters. After online model identification, the AEKF continuously adjusted the SOC value to reduce the modeled and measured terminal voltage error by adjusting its Kalman gain. This study uses three different testing current profiles (HPPC, DST, and BJDST) to evaluate and validate the model's effectiveness, robustness, and adaptability. The comparison analysis (with RLS-AEKF and FF-RLS-AEKF) indicated that the proposed approach had an MAE value that was twice lower than that of RLS-AEKF for all current profiles. In addition, the proposed approach demonstrated a maximum RMSE value of 0.49% in DST, thereby indicating its applicability in online SOC estimation.