Joint Estimation of the Electric Vehicle Power Battery State of Charge Based on the Least Squares Method and the Kalman Filter Algorithm

Xiangwei Guo 1,2,3, Longyun Kang 1,2,*, Yuan Yao 1,2, Zhizhen Huang 1,2 and Wenbiao Li 1,2 1 New Energy Research Center of Electric Power College, South China University of Technology, Guangzhou 510640, China; gxw8611@163.com (X.G.); HeinzYao@outlook.com (Y.Y.); hzz465288@yahoo.com (Z.H.); epangelo@mail.scut.edu.cn (W.L.) 2 Guangdong Key Laboratory of Clean Energy Technology, South China University of Technology, Guangzhou 510640, China 3 College of Electrical Engineering and Automation, Henan Polytechnic University, Jiaozuo 454000, China * Correspondence: lykang@scut.edu.cn; Tel.: +86-137-2809-8863


Introduction
In an electric vehicle, the power battery State of Charge (SOC), an important parameter of the battery state, is used to directly reflect the remaining capacity of the battery and provide a basis for the formulation of an optimal energy management strategy for the vehicle control system.An inaccurate SOC will result in a reduced performance of the vehicle and lead to potential damage to the battery system; therefore, it is critical to develop algorithms that can accurately estimate the battery SOC in real time.
An accurate estimation of the SOC is important to prolong the battery life and improve the performance of the electric vehicle [1,2].However, because the battery is a strongly nonlinear and time-variable system, in practical applications it is hard to measure the SOC directly due to its complicated electrochemical processes and the influence of various factors [3].At present, the most common methods of estimation [4][5][6][7][8] can be roughly divided into two main categories.
One main category is based on the relationship between energy conservation and the physical properties of the battery.For example, the most commonly used methods in this category include the open circuit voltage method and the ampere-hour integral method, among others, in which the battery charge and discharge current or the open circuit voltage are used to calculate the residual capacity of the battery.
The open circuit voltage method, when used alone, can only be applied to an electric vehicle in a non-moving state.It cannot provide a real time dynamic estimation and is therefore usually used to provide a rough SOC initial value for other methods.
The ampere-hour integral method calculates the accumulated charge of the battery during charging or discharging and among other advantages, it is economical and easy to conduct.However, when it is applied in electric vehicles, the following main problems result: (1) the SOC initial value must be obtained by other methods; (2) a higher current measurement accuracy is needed, because the accuracy of the SOC estimation is largely determined by the current measurement accuracy; and (3) the accumulative errors cannot be eliminated, and as the charging or discharging time increase, the accumulative errors may get out of control.
Another main category of methods for SOC estimation is by first establishing a mathematical model of the battery, and then the battery SOC can be estimated indirectly based on the established model, the measured charge or the discharge current, and the terminal voltage.Common methods in this category include the neural network and the Kalman filter (KF) methods, among others.
The neural network method utilizes a complex nonlinear system, i.e., a neural network, which is composed of a large number of simple neurons with extensive connections.The neural network can automatically induce, organize and study the collected data to obtain the inner rules of these data.The neural network also has the ability to map a nonlinear system and thus can better reflect the dynamic characteristics of a battery.The disadvantage of the neural network method is that a large amount of data is needed for training, and the SOC estimation accuracy is greatly influenced by the training methods and the training data.
The main idea behind the Kalman filter method is to make an optimal estimation of the minimum mean square sense of the dynamic system states.This method has strong error correction ability and requires a highly accurate battery model.When the KF method is used to estimate the SOC, the general mathematical form of the battery model can be expressed as:

State equation:
( Observation equation: ( where uk is the input of the system, including the battery current, residual capacity, battery temperature, among other variables, and yk is the output of the system, which usually indicates the terminal voltage of the battery.The most difficult challenge of the KF method is determining the state equation and the observation equation.In this paper, using the second-order RC circuit as the equivalent model of the power battery, the online parameters of the circuit model are identified and the SOC is estimated based on the least squarea (LS) method with a forgetting factor and adaptive unscented Kalman filtering (AUKF).The comparison of these two algorithms is given, and a novel joint estimation algorithm of the power battery SOC based on the LS and the KF is proposed.The joint algorithm has the characteristics of a high estimation precision and good convergence to the initial value error.Furthermore, the advantages of the proposed algorithm are demonstrated by simulation experiments.
The structure of this paper is arranged as follows: in Section 1, the most commonly used methods for SOC estimation are introduced, and the proposed method of this paper is briefly described.In Section 2, the proposed equivalent circuit structure is determined.Dynamic parameter identification and model verification of battery model are described in Section 3. In Section 4, the AUKF algorithm is presented.In Section 5, using the LS with a forgetting factor and the AUKF algorithm to jointly estimate the power battery SOC, the advantages of the proposed algorithm is demonstrated by simulation experiments.Finally, in Section 6, the research results of this paper are summarized, and future research directions are provided.

Building the Battery Model
Generally, a good battery model provides an accurate description of the dynamic and static characteristics of the battery, has a relatively simple model structure making analysis and calculations easy and is not difficult to implement for a project.Currently, four main equivalent circuit models, i.e., the Rint model, Thevenin model, PNGV model, and a multi-order RC circuit model, are widely used in electric vehicle simulation [9][10][11][12][13].
The first three models have simple structures but low precision performances.In the multi-order RC circuit model, as the model order increases, the model precision will increase.However, with increasing model order, the model will not be pragmatic due to its computational complexity.
Thus, this article uses the second-order RC equivalent circuit as the battery model, as shown in Figure 1. Figure 2 shows the terminal voltage response of a 2.6 Ah Sanyo ternary lithium battery after completing a discharge cycle.  2 is due to the influence of the ohmic resistance R. 3. RC loop circuit: Two links of a resistor and a capacitor superpose to simulate battery polarization [14], which is used to simulate the process voltage stabilization after discharge.The region ② of Figure 2 shows the change in voltage influenced by the RC loop circuit.
Equation (3) shows the function relation of the equivalent circuit model in Figure 1: ( We can then discretize Equation ( 3) and solve the state equation as follows: , ,

Identification and Verification of Dynamic Parameters of the Battery Model
Figure 3 shows the flow chart for identifying the dynamic parameters and verifying the model.According to Figure 3, based on the LS with a forgetting factor, the dynamic parameters of an actual battery is identified and the established model is verified, in combination with the corresponding relation of the battery OCV and the SOC.

OCV-SOC Calibration Experiment
In this paper, the discharge experiment, conducted at a constant temperature (25 ) under intermittent discharge conditions with constant current and capacity, calibrates the OCV-SOC curve with 0.  The corresponding relationships between OCV and SOC were recorded for x = 2, 3, 4, 5, 6, 7.5, 10, respectively.Figure 5 shows the different OCV-SOC relationships with sixth order polynomial fittings.From Figure 5, when the SOC is above 10%, all the relationships seem to be superposed.This indicates that at the same temperature and the same SOH, any of the curves can be chosen to represent the OCV-SOC relationship.However, a smaller current leads to a smaller change of the battery characteristics.The 0.2 C constant current intermittent discharging OCV-SOC relationship is selected as the reference curve, and the open circuit voltage of the battery as a function of SOC can be represented by Equation (7): where a1 to a7 are coefficients obtained by the sixth order polynomial fitting giving b1 = −34.72,b2 = 120.7,b3 = −165.9,b4 = 114.5,b5 = −40.9,b6 = 7.31, and b7 = 3.231.

Application of LS with a Forgetting Factor
From Formulas (4) and ( 5), the Laplace equation for the battery model can be deduced: Therefore: where τ is the time constant of Rs, Cs, and is the time constant of Rp, Cp.
Using bilinear transform to discretize Equation ( 9), where a1, a2, a3, a4, a5 are the corresponding constant coefficients.Formula (9) can then be converted to a differential equation: where I(k) and y(k) indicate the system input and output, respectively, and subsequently gives: If we assume the k moment sensor sampling error is e(k), then: and expanding φ (k) to N-dimensional, where k = 1, 2, 3…N+ n, n = 2, the following equation is deduced: ( Next, taking the criterion Equation θ : ) and considering the least squares method is to take the θ minimum: which gives: The above equations constitute a one-time least square calculation.However, for the actual system, a one-time calculation does not give an estimated value close to the true value.Thus, a recursive least square method is introduced: where θ is the system-estimated reference value of the previous cycle, Φ 1 θ is the observed value of this cycle, k 1 is the actual observed value of the system, Φ 1 θ is the prediction error, and k 1 is the corrected prediction value.To obtain the optimal estimation of the present cycle, θ 0 and 0 must be first provided to meet the requirements, k 1 is then obtained, and the least square method is executed.Generally, θ 0 can be any value, and 0 α , where α is a positive real number, and is a unit matrix.
The recursive least squares method has an unlimited memory, i.e., as the length K increases, the older data accumulates, making new data difficult to substitute into the least-square steps.This will subsequently affect parameter estimation, especially in time-varying systems.Because a large amount of accumulated old data creates an imbalance with the new data, the newly estimated parameters cannot accurately reflect the characteristics of the system at a current moment.Thus, to avoid the above situation [15], a forgetting factor λ, where 0 λ 1, is introduced: Thus, even when 1) is large, 1) does not go to 0, and "data saturation" can be eliminated.
The steps of the least square algorithm with the forgetting factor are as follows: In Equation ( 19), λ 1 the most common least squares.When λ is smaller, the tracking ability is stronger, but the volatility is greater; hence, generally 0.95 < λ < 1.

Dynamic Parameter Identification
Parameter identification is based on the information of the measurement system and provides guidelines to estimate the model structure and unknown parameters.According to the value of θ derived from the previous algorithm: Substituting this into Equation (10): Because the corresponding coefficients of equations ( 9) and ( 21) are equal, we can obtain: The coefficients on the right-hand side of Equation ( 22) can be obtained by a recursive algorithm, and the variables on the left-hand side are the unknown parameters of the battery model.This completes the process of parameter identification.
In the process of identifying model parameters, the known variables are V(k), I(k), V(k−1), I(k−1), SOC(k−1) and V(k−2), I(k−2), and the unknown variable is θ .The steps of using the LS method with a forgetting factor for the identification of dynamic parameters of the battery are as follows: 1. Identification initialization using sampling time T = 1s, and SOC (0) = 90%.2. Calculate each time and obtain the input Φ and output k of the identification process accurately.3. Initialize θ 0 , 0 and the forgetting factor λ, and start the forgetting factor least square parameter identification; in this paper, α 5000, λ 0.96.
Using this process, the value of can be obtained, and then according to Equation ( 22), R, Rs, Rp, Cs, and Cp can consequently be obtained; hence, the dynamic real-time update of the battery model parameters is realized, along with an accurate description of the dynamic response of the battery.Furthermore, the accuracy of the battery model is improved, and the basis for estimating the battery SOC accurately is provided in latter sections.

Model Verification
After the dynamic parameters of the battery model are determined, the next step is to verify the accuracy of the model using Hybrid Pulse Power Characterization (HPPC) [16].Here, the initial SOC is set to 0.5, and the input current waveform is shown in Figure 6 with a pulse current size of 1 C (2.6 A).A comparison of voltage responses is shown in Figure 7, and Figure 8 depicts the voltage error, i.e., the differences between the measured and estimated voltages.Figures 7 and 8 show that when the current suddenly changes, the model estimated voltage can track the actual voltage well, and the error remains at approximately 0.01 V. Hence, this model can be used to verify the algorithms of the SOC estimation in this paper.

Establishment of the AUKF Algorithm
The main idea of the Kalman filter is to make an optimal estimation of the minimum mean square value, which includes the following two stages: prediction and updating.In the prediction stage, the filter makes an estimate of the current state according to the value of the last state.In the updating stage, according to the observed value of the current state, the filter optimizes the predicted value from the prediction stage to obtain a more accurate estimation of the current state.
It is important to note that the Kalman filter is mainly used in linear systems, while a battery system reflects complex nonlinear characteristics.Some people [4,7,8] have used the extended Kalman filter (EKF) for SOC estimation, and while some good results have been achieved, linearization errors are inevitable, and the Jacobian matrix is also difficult to estimate.In recent years, a new nonlinear filtering method has emerged, collectively referred to as the sigma point Kalman filter, including the unscented Kalman filter (UKF).UKF does not require Taylor approximations of nonlinear equations; instead, the nonlinear unscented transform (UT) technique is used directly, and thus the mean and the variance of the nonlinear system states can be mapped directly to achieve a higher estimation accuracy.
In a normal UKF algorithm [17,18], the covariance is a constant and cannot satisfy the real-time dynamic characteristics of the noise, which has a certain impact on the accuracy.In this paper, to eliminate this effect, the normal UKF algorithm is improved by updating the covariance in real-time and thus improving the accuracy of the UKF.This type of algorithm is called the adaptive unscented Kalman filter (AUKF) algorithm.The establishment process of the algorithm is described as follows.
A discrete-time controlled system is governed by the equation of state and the observation equations are shown in Equation ( 23): where the random variables wk and vk represent the process and measurement noise, respectively.As for the UKF, the iteration equation is based on a certain set of sample points, which is chosen to make their mean value and variance consistent with the mean value and variance of the state variables.Then, these points will recycle the equation of the discrete-time process model to produce a set of predicted points.After that, the mean value and the variance of the predicted points will be calculated to modify the results, and the mean value and the variance will be estimated.Before the UKF recursion, the state variables must be modified in a superposition of the process noise and the measurement noise of the original states.The SOC of the Li-ion battery pack can be calculated using the ampere-hour integral method: The estimates of the states and the mean square error are as follows: where yk is the actual measured value of the system output.As the process noise and measurement noise are real-time and to make the covariance of the process noise and measurement noise update in real time, the following is needed: where μ is the residual error of the system measured output and | , is the residual error of the system measured output estimated by the sigma points.

Reasons and Steps of the Joint Estimation Algorithm
The LS method with a forgetting factor undertakes the work of parameter identification, and the AUKF functions in the progress of the SOC estimation.The characteristics of these two algorithms [17][18][19][20] are shown in Table 1.

Algorithm
Advantages Disadvantages

LS with a forgetting factor
This algorithm does not require the observation data to provide the probability and statistics of the noise under random conditions; the statistical properties are quite good.This algorithm cannot identify an unbiased, coherent parameter with colored noise.

AUKF
This algorithm has a strong immunity to the disturbance of the initial value; the iterative calculations ensure the acquirement of the desired value.
In theory, the minimum variance estimation can be obtained only when the statistical properties are known.
Based on the merits and the drawbacks mentioned above, a joint algorithm of these two algorithms is proposed.The implementation of the joint algorithm can be divided briefly into two steps.First, the Kalman filter model updates parameters using the data provided by the LS method with a forgetting factor.Then, the filter generates the SOC, which will be used to deduce the OCV.Second, the OCV combines the measured voltage and the current value to update the LS estimation result for the next reiteration.Figure 9 illustrates the steps of the joint algorithm.

Start
According to the a 1 ,a 2 ,a 3 ,a 4 ,a 5 , the bilinear inverse transform can be used to calculate the parameters of equivalent circuit model, such as Update the matching coefficient of the state space expression The details of the implemented algorithm are as follows: 1.The BMS measures the voltage of the Li-ion battery in the static state, according to the function of OCV-SOC, and the initial value of SOC (0) is calculated.2. The initial values of the model, i.e., R(0), Rs(0), Rp(0), Cs(0), and Cp(0), are estimated, according to the current and voltage responses in the early stage of battery operation.3. The initial values of the model are used to calculate the initial coefficients, and then the adaptive unscented Kalman Filter will be used to obtain the SOC value at the current moment.4. The open circuit voltage Voc at that time is calculated according to the function relationship of OCV-SOC.Then, the parameters of the model at the current instance are obtained using the LS method with a forgetting factor.5.The model parameters are utilized to update the corresponding coefficients, and the AUKF is used again to calculate the estimated value of SOC in the next instance, and step 4 is repeated.
Step 4 is applied to calculate the model parameters, and step 5 is utilized to estimate the SOC values.These two steps are repeated, and the Li-ion battery parameters and the estimated SOC values at every instance will be obtained.

Experimental Analysis of the Joint Estimation Algorithm
In this section, simulations of the joint algorithm mentioned above and a single AUKF are presented, and analysis will be made on the accuracy of the algorithms and the convergence to the initial value error.
In the process of setting the battery discharging and charging states, to correspond to the experimental object in the OCV-SOC calibration, the current signal in Figure 10 is adopted to describe the increase or decrease of the current in the discharging or charging process of the power battery.In one period, the average output current is 1.77 A, and the maximum discharging current is 5.28 A, the maximum charging current is 2.42 A. Each period is 1367 s, and the condition lasts two periods.

Accuracy Verification
In this simulation model, the input current I(k) is integrated using the Ampere-hour (Ah) integral method.As there is no error in the current measurement due to outside disturbances, no accumulative error exists; thus, the integration of the current in the simulation model could be regarded as the theoretical value of the SOC. Figure 11 displays a comparison of the results generated by the two algorithms and the theoretical value.Figure 12 compares the error of these two algorithms.The maximum error of the joint estimation algorithm is 1.3% and that of AUKF is 2.5%, which indicates a greater accuracy of the joint estimation algorithm.

Convergence to the SOC Initial Value Error
In the early operational stage of the Li-ion battery, errors exist between the measured and real voltage and current values, which will subsequently lead to an erroneous SOC value.Taking this condition into consideration, the convergence to the initial value error is a vital performance index of an algorithm.This section will discuss this issue.We assume that the real initial value of the SOC is 1, while a SOC value of 0.96 is deduced from the measurements.Figure 13 shows the theoretical value and results of the two algorithms, and Figure 14 is the error comparison of these two algorithms in a time period of 100 s.    that both algorithms have the ability to converge to the SOC initial value error.At 100 s, the error percentage of the joint estimation algorithm is 1.628%, while that of the AUKF is higher at 3.054%; hence, the joint estimation algorithm is better at converging to the SOC initial value error.

Conclusions
Power battery SOC is a vital state information of an electrical vehicle and is strongly nonlinear and time-varying.The proposed joint estimation algorithm combines the LS method with a forgetting factor and the AUKF method.This work can be summarized as follows: 1.A battery model was built according to its external characteristics, and the parameters were identified and verified at the same time.2. The advantages and disadvantages of the LS method with a forgetting factor and the AUKF method were analyzed, and a joint estimation algorithm was proposed.3. Comparison of the joint estimation algorithm and the AUKF, including the accuracy and the ability to converge to initial value errors, were conducted, and it was concluded that the joint estimation was better than the AUKF.
Suggested future research directions building off of the current data are as follows: 1.All of the current data are obtained in a constant temperature environment.Thus, data of the battery operating in a variable temperature environment should be obtained in the future, to evaluate the exact relationship of SOC-OCV.2. The calculations in this paper do not consider the battery health; hence, the joint estimation algorithm should be applied on batteries with different battery health conditions.

Figure 5 .
Figure 5. Different OCV-SOC relationships with sixth order polynomial fittings.

Figure 8 .
Figure 8. Differences between measured and estimated voltages.

Figure 9 .
Figure 9.The combination of the LS method with a forgetting factor and the AUKF.

Figure 11 .
Figure 11.Comparison of the SOC estimates.

Figure 12 .
Figure 12.Comparison of the SOC estimation error.

Figures 11 and 12
Figures 11 and 12  illustrate that both algorithms are able to follow the theoretical values of SOC.The maximum error of the joint estimation algorithm is 1.3% and that of AUKF is 2.5%, which indicates a greater accuracy of the joint estimation algorithm.

Figure 13 .
Figure 13.Results of the theoretical value and the two algorithms.

Figure 14 .
Figure 14.Error comparison in a time period of 100 s.

Figures 13 and 14
Figures 13 and 14  indicate that both algorithms have the ability to converge to the SOC initial value error.At 100 s, the error percentage of the joint estimation algorithm is 1.628%, while that of the AUKF is higher at 3.054%; hence, the joint estimation algorithm is better at converging to the SOC initial value error.
Figures 13 and 14  indicate that both algorithms have the ability to converge to the SOC initial value error.At 100 s, the error percentage of the joint estimation algorithm is 1.628%, while that of the AUKF is higher at 3.054%; hence, the joint estimation algorithm is better at converging to the SOC initial value error.
The initial parameters of the model are estimated based on the off line estimation, then The initial value of the matching coefficient of the state space expression can be obtained