Estimation of State of Charge for Lithium-Ion Battery Based on Finite Difference Extended Kalman Filter

An accurate estimation of the state of charge (SOC) of the battery is of great significance for safe and efficient energy utilization of electric vehicles. Given the nonlinear dynamic system of the lithium-ion battery, the parameters of the second-order RC equivalent circuit model were calibrated and optimized using a nonlinear least squares algorithm in the Simulink parameter estimation toolbox. A comparisonwasmade between this finite difference extendedKalman filter (FDEKF) and the standard extendedKalman filter in the SOC estimation. The results show that the model can essentially predict the dynamic voltage behavior of the lithiumion battery, and the FDEKF algorithm can maintain good accuracy in the estimation process and has strong robustness against modeling error.


Introduction
In the context of countries vigorously promoting energy conservation and low carbon economy to solve energy crisis and mitigate global warming, the solar photovoltaic power generation is emerging as the technology of choice for energy-saving and environmentally sustainable transportation.It is suggested that the storage battery is second only to the photovoltaic modules as the most important part of solar photovoltaic system; thus its performance will directly affect the operational state and reliability of the system.It highlights the need to quickly and accurately estimate the state of charge (SOC) of the battery.A battery management system is required to ensure safe and reliable operation of the battery.One of its basic functions is to measure the SOC, which indicates the remaining charge of the battery so that the driver can be reminded to charge the battery prior to its depletion.
SOC is usually estimated indirectly by some measurable quantities [1].In recent years, many methods have been proposed to improve the SOC estimation.Among them, the ampere-hour integral (coulomb counting) method is the most simple and convenient one [2], but it requires a prior knowledge of initial SOC and suffers from accumulated errors from noise and measurement.The open circuit voltage (OCV) method is sufficiently accurate because there is a one-to-one correspondence between OCV and SOC, but it needs a long rest time and thus cannot be used in real time applications [3].A number of intelligent approaches have been developed in an attempt to achieve a more accurate SOC estimation, such as the neural network method and Kalman filter (KF) method [4].The neural network method can provide an accurate SOC estimation given an appropriate training dataset.However, the training process is very computationally intensive and at risk of over fitting, and the model performance strongly relies on the amount and quality of the training data, which could limit its application range.The KF method uses sample data (current, voltage, and temperature) to recursively calculate the minimum mean squared error estimate of true SOC, which can solve the problem of uncertain initial SOC and cumulative error.However, it is only suitable for linear system.Given the nonlinear nature of the dynamics of electrochemical cells, a linearization process is usually used to approximate the nonlinear system by a linear time varying system.The extended Kalman filter (EKF) is a nonlinear extension of the conventional KF, which has been developed particularly for systems having nonlinear dynamic models, using Taylor series expansions [5][6][7].The divergence of EKF is primarily due to the linearization error for ignoring high-order terms, and the accuracy of EKFbased SOC estimation is sensitive to the precision of the battery model.
We introduced an alternative nonlinear Kalman filtering technique known as finite difference extended Kalman filter (FDEKF) in this study and used the finite difference method instead of the Taylor series expansions to estimate the covariance matrix.It has theoretical advantages that manifest themselves in more accurate predictions and also strong robustness against modeling uncertainty by making full use of the error information generated by model linearization.
The remainder of this paper is arranged as follows.Section 2 describes a model structure and discusses how the parameters of this model can be automatically estimated using the Simulink parameter estimation, Section 3 briefs the EKF and deduces the FDEKF algorithm, Section 4 shows the simulation results of the proposed algorithm to the experimental data, Section 5 shows the experimental verification of the proposed algorithm on a test bench, and Section 6 concludes the paper.

Modeling for the LiFePO 4 Battery and Parameter Identification Method
2.1.Lithium-Ion Battery Model.The commonly used battery models include the electrochemical model and equivalent circuit model (ECM) [8].The electrochemical models describe the electrochemical reactions in the electrodes and electrolyte in a mathematical way, which can achieve high accuracy.However, they typically deploy partial differential equations with a large number of unknown parameters.Due to the intensive computation involved, these models are often used for battery performance analysis and battery design.ECMs have been developed especially for the purpose of vehicle power management control and battery management system development and have less parameters, such as the Rint model [9], Thevenin model [10], and PNGV model [11].
Literature [12] gives a comparative study of these ECMs for lithium-ion batteries.Due to the complicated polarization characteristics of battery, it is suggested that models with more parallel RC networks connected in series should have a much higher accuracy [13].Clearly, the higher the order is, the more complicated the model becomes.Therefore, considering the details in the model is a tradeoff between accuracy and complexity.In this paper, a second-order RC model is considered, as shown in Figure 1.
Here  oc is the open circuit voltage,   is the terminal voltage of the battery,   is the outflow current,  0 is the ohmic resistance of the connectors, electrodes and electrolyte, and the two sets of parallel resistor-capacitor elements connected in series   ,   , and   ,   are the mass transport effects and double-layer effects, respectively.Commonly, the time constants of the two dynamics differ by at least an order of magnitude.

Parameter Identification.
The model parameters need to be accurately estimated from the test data to establish a battery model with good performance.In this paper, the model is parameterized using a semiautomatic process that can satisfy the constraints on the optimized parameters.This process uses a number of measured data sets under a variety of conditions.The parameters are optimized by minimizing the error between measured and simulated results using the nonlinear least squares algorithm in the Simulink parameter estimation toolbox.The battery model can be established in Simulink based on the second-order RC model, as shown in Figure 2.

SOC Estimation
3.1.EKF-Based SOC Estimation.In order to use EKF methods for battery SOC estimation, the cell should be modeled in a discrete-time state-space form.Specifically, we model the nonlinear battery system by a state equation and an output equation below: where   is the system state vector at discrete-time index , vector   is the measured system input at time , and   is unmeasured "process noise" that affects the system state.The output of the system is   and V  is measurement noise.(⋅, ⋅) and (⋅, ⋅) are (possibly nonlinear) functions, determined by the particular cell model used.
At each time step, (  ,   ) and (  ,   ) are linearized by a first-order Taylo -series expansion.The model can be rewritten as where, The state of the ECM in Figure 1 is set to be SOC.  and   are the voltage across the RC network, the input of the model is the current   , and the output is the terminal voltage   .Thus, the dynamic ECM could be described in state space as where  is the cell coulombic efficiency,  is the inter-sample period,   is the cell capacity,   () is the current at time index  which is negative at charge and positive at discharge,   and   are the time constants of the  1  1 and  2  2 circuit, and Both   and V  are assumed to be mutually uncorrelated white Gaussian random processes, and the statistical characteristics are as follows: where both   and   are positive definite symmetric matrices, and   is the Kronecker function.The OCV corresponds to a certain SOC, which can be identified by the nonlinear characteristic curve  oc (SOC()) [14].The hysteresis effect, which is beyond the scope of this paper, can cause the discharging curve to stay below the charging curve for the same amount of SOC.Obviously, the relationship between OCV and SOC is nonlinear.The EKF approach is to linearize the equations at each sample point using Taylor series expansions.The specific steps are as follows.
Define   = [SOC()   ()   ()]; the superscripts " -" and "̂" indicate the prior and posterior estimation, respectively.We linearize the nonlinear state and output equations around the present operating point using Taylor series expansions, and ignore the second-and higher-order terms Initialization is Recursive calculation is

FDEKF-Based SOC Estimation.
There are two problems for EKF in SOC estimation: (1) when the higher-order terms of Taylor series expansions are not negligible, the linearization process will cause significant errors to the system or even make the filter unstable and divergent; and (2) Jacobian matrix needs to be calculated at every sample time, thereby leading to a multiplication of the calculation amount for complicated system.FDEKF is another iterative minimum mean variance error estimator, which has a higher precision than the first-order Taylor series expansions by applying finite difference method and is applicable for all nonlinear functions.Schei first conceived the thought of finite difference [15].It uses polynomial approximations obtained with a Sterling interpolation formula for the derivation of state estimators for nonlinear systems.The estimators perform better than that based on Taylor approximations.Nevertheless, the implementation is significantly simpler as no derivatives are required.A nonlinear function  = () is assumed and approximated by the interpolation formula where ℎ is the interval length, and  is assumed to be analytic; then the full Taylor series expansion of ( 13) is The first two terms on the right hand side of (15) are independent of the interval length ℎ and are recognized as the first two terms of the Taylor series expansion of .The "remainder" term given by the difference between (15) and the first-order Taylor approximation is controlled by ℎ and will in general deviate from the higher order terms of the Taylor series expansion.In some sense, certain interval lengths may make the remainder term close to the higher order terms of the full Taylor series.The procedure of FDEKF algorithm is given below.
First we introduce the following four square Cholesky factorizations: The factorization of the noise covariance matrices  and  can be made in advance.S  and Ŝ are updated directly during application of the filter.
Then we calculate the partial derivative of the nonlinear function by the first-order polynomial approximation Let the th column of S  be denoted Ŝ, ; (19) can be derived just as (18) (1) Estimates of the prior variance (2) Estimates of the posterior gain matrix and posterior variance We use ( 20)-( 21) to replace ( 9), (10), and (11), which comprises the full FDEKF.

Results and Discussions
To verify the effectiveness and performance of the FDEKF, we applied the identification and SOC estimation algorithms to the experimental data obtained on the LP2770102AC lithiumion battery.This is a lithium iron phosphate battery that can be used in portable high power devices, grid stabilization energy storage, and electric vehicles and hybrid electric vehicles.Its nominal capacity is 12.5 Ah and nominal voltage is 3.3 V.For the tests, we used a DigatronMCT 30-05-40 cell cycler with a measurement accuracy of ±5 mV for voltage and ±50 mA for current.The battery temperature was kept at room temperature (20 ± 2 ∘ C) throughout the experiment.
In this section, we first estimated the values of ECM parameters using an iterative numerical optimization algorithm implemented by Simulink parameter estimation and then compared the FDEKF-based and EKF-based SOC estimation.

Pulse Test.
The battery was fully charged so that SOC = 100%, and then the constant-current discharge pulse test was performed (18 min discharging and 60 min resting).The discharge lasted 790 min, and the sample time was 1 s. Figure 3 shows the terminal current and voltage of the battery.

Initial Estimation.
The parameters   ,  0 ,   ,   ,   , and   needed to be identified.The initial values of model parameters should be assigned before running the optimization algorithm.The upper and lower bounds of the model parameters were selected through trial and error.In our initial attempt, six parameters were estimated, and their maximum and minimum values were given a broad range.An initial guess for each parameter was chosen based on prior experimentation with the model.Table 1 shows the parameters estimated and their constraints.

Model Evaluation.
The current and voltage data were used as the input to the identification algorithm described in Section 2. The second-order RC model in Figure 2 was run until the optimization process was terminated.The measured and simulated terminal voltages are shown in Figure 4(a), and the errors between them are shown in Figure 4(b).It is evident that the model can essentially predict the dynamic voltage behavior of the lithium-ion battery from SOC = 0.1 to SOC = 1, with an error of 50 mV.However, the performance of the model is deteriorated when the battery runs out, with an error of 150 mV.The trajectories of the optimization variables after 9 iterations are shown in Figure 4(c).In order to guarantee the global optimal parameters, we choose sum of squares for error (SSE) as the cost function, and the curve is shown in Figure 4(d) We used the dynamic stress test (DST) data to validate the accuracy of the model.Single DST working condition includes 14 steps and it is repeated five times; the process is as follows: (1) 20 A charge for 420 seconds, (2) rest for 30 seconds, (3) 10 A charge for 120 seconds, (4) 10 A discharge for 120 seconds, (5) 4 A charge for 300 seconds, (6) 20 A discharge for 120 seconds, (7) 10 A charge for 120 seconds, (8) 4 A discharge for 180 seconds, (9) 40 A charge for 23 seconds, (10) 10 A discharge for 120 seconds, (11) 4 A charge for 300 seconds, (12) 40 A discharge for 60 seconds, (12) 20 A charge for 120 seconds, (13) 4 A discharge for 120 seconds, and (14) rest for 30 seconds. Figure 5 shows that the model can quickly and accurately track the real-time voltage of the battery, with an error of less than 0.1 V.

Verification of SOC Estimation Algorithm.
We then applied the experimental data obtained in Section 4.1 to implement the standard EKF and the FDEKF.The experimental SOC values were computed by the battery testing   system and acted as a reference for the SOC estimates.The SOC estimation results are shown in Figure 6.
Figure 6(a) shows that the two estimators can trace the reference SOC, but with different accuracy.It also shows that the maximum absolute estimation error is 7% for EKF and 2% for FDEKF, with an improvement of 71%.
To evaluate the comprehensive performance of the two filters in the quantitative analysis, we define the root mean square error (RMSE) and single mean computation time  cost as   In order to confirm the robustness of FDEKF, we performed another two tests with changing current and DST data using the parameters in Table 2, which incorrectly identified the ECM and compared the performance of EKF and FDEKF in perturbations of the system parameters.The SOC estimation results are shown in Figures 7 and 8, respectively.It shows that the EKF-based estimator has a poor performance, with a maximum absolute error of 14%, while the FDEKFbased estimator can correctly trace the reference SOC, with a maximum absolute error of 4%.Thus, there is a substantial improvement (70%).The comparison results show that the FDEKF-based method provides better performance in the SOC estimation under modeling error.connected battery cells at the same time.AT90CAN128 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC structure.ACS750SCA-050 can convert the charge/discharge current into 0-2.5 V voltage signal and its error is less than 1%.TMS320F2812 can receive the voltage data of each cell from the AT90CAN128 with CAN communication and then uses the FDEKF algorithm to calculate SOC in real time, which is displayed on the computer screen.This test bench can be extended, as shown in Figure 10.

Experiments and Online Test
We tested the single battery under DST working condition on this test bench using the EKF and FDEKF algorithms.Table 3 shows that both simulation and experimental errors increase over time.This is probably because the ECM parameters are estimated offline, and all of them are single constant and no adjustments are made for the changes of battery SOC.

Conclusions
In this study, we proposed a robust and powerful realtime SOC estimator for the lithium-ion batteries, and the parameters of the second-order ECM were estimated using the nonlinear least squares algorithm.This new linearization technique for SOC estimation is known as the finite difference extended Kalman filter.Compared to the EKF method, the FDEKF method is able to track the real-time SOC more quickly and accurately with the accurate model.When the model parameters change, it also has stronger robustness against modeling uncertainties and maintains good accuracy in the estimation process.

Figure 1 :
Figure 1: Equivalent circuit of second-order RC model.

Figure 3 :
Figure 3: Terminal current/voltage curves by constant-current discharge pulse.

Figure 5 :
Figure 5: The results of model validation with DST data.

Figure 6 :
Figure 6: Comparison of SOC estimation and error curve of constant-current discharge pulse.

Figure 7 :
Figure 7: Comparison of SOC estimation and error curve of changing-current discharge pulse.

Figure 8 :
Figure 8: Comparison of SOC estimation and error curve of DST data with EKF and FDEKF.

5. 1 .
Test Bench.The test bench is shown in Figure 9, which consists of a DigatronMCT 30-05-40 cell cycler, a voltage acquisition unit LTC6803-4, a high speed MCU AT90CAN128, a Hall current sensor ACS750SCA-050 and a core data processor TMS320F2812.The Digatron MCT 30-05-40 can charge/discharge five battery packs according to the designed program, with a maximum voltage of 30 V and maximum charge/discharge current of 40 A, and its voltage measurement accuracy is ±5 mV and current measurement accuracy is ±50 mA.LTC6803-4 can measure up to 12 series

Table 2 :
Comparison of SOC estimation. is the time step, x is the estimated SOC at step ,   is the true SOC at step ,   cost is the computation time at step , and  is the sampling number.The results in Table 2 clearly indicate that FDEKF is superior to EKF in both estimation accuracy and algorithm complexity.

Table 3 :
Comparison of the simulated and experimental SOC results.