Estimation of the State of Charge of Lithium Batteries Based on Adaptive Unscented Kalman Filter Algorithm

: The state of charge (SOC) estimation of the battery is one of the important functions of the battery management system of the electric vehicle, and the accurate SOC estimation is of great signiﬁcance to the safe operation of the electric vehicle and the service life of the battery. Among the existing SOC estimation methods, the unscented Kalman ﬁlter (UKF) algorithm is widely used for SOC estimation due to its lossless transformation and high estimation accuracy. However, the traditional UKF algorithm is greatly a ﬀ ected by system noise and observation noise during SOC estimation. Therefore, we took the lithium cobalt oxide battery as the analysis object, and designed an adaptive unscented Kalman ﬁlter (AUKF) algorithm based on innovation and residuals to estimate SOC. Firstly, the second-order RC equivalent circuit model was established according to the physical characteristics of the battery, and the least square method was used to identify the parameters of the model and verify the model accuracy. Then, the AUKF algorithm was used for SOC estimation; the AUKF algorithm monitors the changes of innovation and residual in the ﬁlter and updates system noise covariance and observation noise covariance in real time using innovation and residual, so as to adjust the gain of the ﬁlter and realize the optimal estimation. Finally came the error comparison analysis of the estimation results of the UKF algorithm and AUKF algorithm; the results prove that the accuracy of the AUKF algorithm is 2.6% better than that of UKF algorithm.


Introduction
In recent years, with the escalating energy crisis and environmental problems, low-pollution, high-efficiency electric vehicles (EVs) have become a hot spot in the automotive industry. Lithium-ion batteries have the characteristics of small size, light weight, high energy density, large output power and high safety performance, and have become the first choice for energy storage devices of EVs [1][2][3]. State of charge (SOC) is used to directly reflect the remaining capacity of the battery, which is an important basis for the vehicle control system to formulate an optimal energy management strategy. SOC is an important battery performance parameter; accurate estimation of SOC is of great significance to improve battery safety performance, extend battery life and ensure reliable operation of battery system [4,5].
At present, the commonly used SOC estimation methods for lithium batteries include the ampere-hour integration method, the open circuit voltage method, the neural network method, the particle filter algorithm and the Kalman Filter (KF) method. Among them, the ampere-hour integration method estimates the SOC of the battery by accumulating the amounts of charge and the uncertainty of the battery model and system noise is not considered. Uncertainty of model noise and system noise will lead to increased error, slow convergence speed and filter divergence. Reference [26] introduces adaptive filtering on the basis of UKF, and replaces system noise covariance and observation noise covariance of UKF with adaptive-filter-estimated system noise covariance and observation noise covariance, respectively. In order to update the system error and the observation error in real time, the filtering effect is relatively good, but the adaptive filtering cannot truly reflect the system noise and the observation noise error, so it can be further improved.
In the traditional UKF algorithm [27,28], the system noise covariance and the observation noise covariance are usually set as constants, which cannot truly reflect the dynamic characteristics of noise, and have a certain influence on the accuracy of SOC estimation. In view of the shortcomings of the traditional UKF algorithm in the case of low model accuracy and uncertain noise, we designed an adaptive unscented Kalman filter (AUKF). The AUKF algorithm monitors the dynamic changes of innovation and residual in the filter in real time; corrects the system noise covariance and observation noise covariance in real time; and adjusts the filter gain to improve the estimation accuracy.
The organizational structure of this paper is as follows. In Section 1, the common methods for battery SOC estimation are introduced, and the methods designed in this paper are briefly introduced. In Section 2, the second-order RC equivalent circuit model is established, the parameters are identified and the accuracy of the model is verified. In Section 3, the traditional UKF algorithm and the AUKF algorithm designed in this paper are introduced. In Section 4, the convergence speed and estimation accuracy of the UKF algorithm and AUKF algorithm are compared through experiments. In Section 5, the work and research results of this paper are summarized.

The Second-Order RC Equivalent Circuit Model of a Lithium-Ion Battery
An accurate battery model is the basis for SOC estimation. Battery models can be roughly divided into electrochemical models [29,30], mathematical models [31] and equivalent circuit models [32,33]. Although the accuracy of the electrochemical model is high, the structure is complex and difficult to implement, and it is not suitable for modeling actual working conditions. The mathematical model has a simple structure and is easy to calculate, but it is difficult to describe the external characteristics of the battery. Considering the complexity and accuracy of the battery model, this paper uses a second-order RC equivalent circuit model [34]; the schematic diagram is shown in Figure 1.
Electronics 2020, 9, x FOR PEER REVIEW 3 of 23 statistics is high. However, the uncertainty of the battery model and system noise is not considered. Uncertainty of model noise and system noise will lead to increased error, slow convergence speed and filter divergence. Reference [26] introduces adaptive filtering on the basis of UKF, and replaces system noise covariance and observation noise covariance of UKF with adaptive-filter-estimated system noise covariance and observation noise covariance, respectively. In order to update the system error and the observation error in real time, the filtering effect is relatively good, but the adaptive filtering cannot truly reflect the system noise and the observation noise error, so it can be further improved.
In the traditional UKF algorithm [27,28], the system noise covariance and the observation noise covariance are usually set as constants, which cannot truly reflect the dynamic characteristics of noise, and have a certain influence on the accuracy of SOC estimation. In view of the shortcomings of the traditional UKF algorithm in the case of low model accuracy and uncertain noise, we designed an adaptive unscented Kalman filter (AUKF). The AUKF algorithm monitors the dynamic changes of innovation and residual in the filter in real time; corrects the system noise covariance and observation noise covariance in real time; and adjusts the filter gain to improve the estimation accuracy.
The organizational structure of this paper is as follows. In Section 1, the common methods for battery SOC estimation are introduced, and the methods designed in this paper are briefly introduced. In Section 2, the second-order RC equivalent circuit model is established, the parameters are identified and the accuracy of the model is verified. In Section 3, the traditional UKF algorithm and the AUKF algorithm designed in this paper are introduced. In Section 4, the convergence speed and estimation accuracy of the UKF algorithm and AUKF algorithm are compared through experiments. In Section 5, the work and research results of this paper are summarized.

The Second-Order RC Equivalent Circuit Model of a Lithium-Ion Battery
An accurate battery model is the basis for SOC estimation. Battery models can be roughly divided into electrochemical models [29,30], mathematical models [31] and equivalent circuit models [32,33]. Although the accuracy of the electrochemical model is high, the structure is complex and difficult to implement, and it is not suitable for modeling actual working conditions. The mathematical model has a simple structure and is easy to calculate, but it is difficult to describe the external characteristics of the battery. Considering the complexity and accuracy of the battery model, this paper uses a second-order RC equivalent circuit model [34]; the schematic diagram is shown in Figure 1. In Figure 1, U OC (SOC) represents the battery open circuit voltage related to SOC; I bat represents the open circuit current of the battery, and the discharge current is a positive value; U bat represents the battery terminal voltage; R si represents the ohmic internal resistance of the battery; R t f and C t f Electronics 2020, 9, 1425 4 of 22 represent the polarization resistance and polarization capacitance of the battery respectively; R ts and C ts represent concentration polarization resistance and concentration polarization capacitance respectively; U t f and U ts represent the voltage across the polarization capacitance and the concentration polarization capacitance, respectively. According to Kirchhoff's law, the state equation and output equation of the equivalent circuit can be obtained: where Q bat is the rated capacity of the battery.

Parameter Identification
Parameter identification technology is a technology that combines theoretical models and experimental data for prediction. Parameter identification determines the parameter values of a group of models based on the model established by the experimental data, so that the numerical results calculated by the model can better fit the test data, so that the unknown process can be predicted.
In this section, we identify the parameters through the voltage response curve of battery discharge and combine Equations (1) and (2); the parameters to be identified are R si , R t f , C t f , R ts , C ts and function relationship U OC (SOC).
The cell model used in the experiment in this paper was the SAMSUNG 30Q INR18650 power lithium cell. The specific parameters of the cell are shown in Table 1. The experimental object of this paper is a battery composed of 10 parallel lithium cobalt oxide cells. The battery was discharged by 1 C pulsed for 3 min, placed statically for 2 h and discharged to the cut-off voltage in cycles. The pulsed discharge voltage is shown in Figure 2a, and the pulsed discharge current is shown in Figure 2b.    Use MATLAB to perform the least squares fitting of the data in Table 2 to obtain the equation of the functional relationship between U oc and SOC; the equation is shown in Equation (3). The fitted relationship curve between U oc and SOC is shown in Figure 3.

Parameter Identification of Resistance and Capacitance
This paper combines the characteristics of resistance and capacitance, and analyzes the voltage response curve of the battery pulsed discharge to identify the resistance and capacitance. The partial discharge voltage diagram of the battery pulsed discharge is shown in Figure 4, and the battery voltage response curve can be divided into four stages: Section A-B: The battery turns from a static state to a discharged state, and the terminal voltage drops abruptly. From the second-order equivalent circuit diagram, it can be seen that tf U and ts U cannot be abruptly changed. The sudden drop in the voltage of section A-B is caused by the ohmic internal resistance si R .
Section B-C: During the continuous discharge, electrochemical polarization and concentration polarization work together to make the voltage drop in the form of exponential changes. Before

Parameter Identification of Resistance and Capacitance
This paper combines the characteristics of resistance and capacitance, and analyzes the voltage response curve of the battery pulsed discharge to identify the resistance and capacitance. The partial discharge voltage diagram of the battery pulsed discharge is shown in Figure 4, and the battery voltage response curve can be divided into four stages:  According to the sections A-B and C-D in Figure 4, the ohmic internal resistance can be obtained: I is the discharge current of the battery.
Solving the differential equation according to Equation (1) gives Equation (5):  According to Figure 4, the discharge current is zero in the DE segment, as a zero input response state. Taking point D as the starting moment, the zero input response expression of the RC loop can be obtained as shown in Equation (6): Combined with Equation (2), the battery output equation at zero input response is: Equation (7) can be simplified: Section A-B: The battery turns from a static state to a discharged state, and the terminal voltage drops abruptly. From the second-order equivalent circuit diagram, it can be seen that U t f and U ts cannot be abruptly changed. The sudden drop in the voltage of section A-B is caused by the ohmic internal resistance R si .
Section B-C: During the continuous discharge, electrochemical polarization and concentration polarization work together to make the voltage drop in the form of exponential changes. Before section B-C, U t f and U ts are zero, so section B-C can be regarded as a zero state response.
Section C-D: The battery discharge current disappears and the battery terminal voltage rises rapidly. It is the same as the section A-B. It can be considered that it is caused by the ohmic internal resistance R si .
Section D-E: The battery is at rest. Due to the electrochemical polarization and concentration difference, the voltage is slowly increased. At this time, there is no current discharge, which can be regarded as zero input response.
According to the sections A-B and C-D in Figure 4, the ohmic internal resistance can be obtained: where U A , U B , U C , U D are the battery terminal voltages corresponding to points A, B, C and D in Figure 4 respectively; I bat is the discharge current of the battery. Solving the differential equation according to Equation (1) gives Equation (5): where τ t f = R t f C t f , τ ts = R ts C ts are the fast time constant and slow time constant respectively; U t f (0) and U ts (0) are the initial voltages across C t f , C ts , respectively. According to Figure 4, the discharge current is zero in the DE segment, as a zero input response state. Taking point D as the starting moment, the zero input response expression of the RC loop can be obtained as shown in Equation (6): Electronics 2020, 9, 1425 7 of 22 Combined with Equation (2), the battery output equation at zero input response is: Equation (7) can be simplified: where By using Equation (8) as the fitting function, and using MATLAB to perform the least squares fitting on the DE segment in Figure 4, the value of b 1 , b 2 , λ 1 , λ 2 can be obtained.
According to the BC segment in Figure 4, it can be regarded as a zero state response. Taking point B as the initial moment, the expression of the zero state response of the RC loop can be obtained as shown in Equation (9): Combined with Equation (2), the battery output equation at zero state response is: Take τ t f , τ ts obtained by the Equation (8) fitting into Equation (10), use Equation (10) as the fitting function and use MATLAB to perform the least squares fitting of the BC segment in Figure 4; that will provide the values of a 1 , a 2 , and then the value of R t f , R ts is obtained: According to τ t f = R t f C t f , τ ts = R ts C ts , the value of C t f , C ts can be obtained. According to the battery discharge voltage curve and battery characteristics, the results of identifying the parameters of the battery model by using the least square method in MATLAB are shown in Figure 5.
Electronics 2020, 9, x FOR PEER REVIEW 8 of 23 By using Equation (8) as the fitting function, and using MATLAB to perform the least squares fitting on the DE segment in Figure 4, the value of 1 2 1 2 , , , bb  can be obtained.
According to the BC segment in Figure 4, it can be regarded as a zero state response. Taking point B as the initial moment, the expression of the zero state response of the RC loop can be obtained as shown in Equation (9): Combined with Equation (2), the battery output equation at zero state response is: Take , tf ts  obtained by the Equation (8) fitting into Equation (10), use Equation (10) as the fitting function and use MATLAB to perform the least squares fitting of the BC segment in Figure 4; that will provide the values of 12 , aa, and then the value of , tf ts RR is obtained: According to the battery discharge voltage curve and battery characteristics, the results of identifying the parameters of the battery model by using the least square method in MATLAB are shown in Figure 5.  Figure 5 shows the change of battery resistance and capacitance with SOC when the battery is discharged with constant current pulsed at a constant temperature of 25 °C. When the battery SOC value is between 0% and 20%, the resistance and capacitance values change greatly, and when the battery SOC value is between 20% and 100%, the resistance and capacitance values change relatively little. Considering that the lower limit SOC value of battery in the actual working environment is 20%, this paper takes the average value of the resistance and capacitance of the battery's SOC in the range of 20-100% as the battery parameters for the subsequent SOC estimation experiment.  Figure 5 shows the change of battery resistance and capacitance with SOC when the battery is discharged with constant current pulsed at a constant temperature of 25 • C. When the battery SOC value is between 0% and 20%, the resistance and capacitance values change greatly, and when the battery SOC value is between 20% and 100%, the resistance and capacitance values change relatively Electronics 2020, 9, 1425 8 of 22 little. Considering that the lower limit SOC value of battery in the actual working environment is 20%, this paper takes the average value of the resistance and capacitance of the battery's SOC in the range of 20-100% as the battery parameters for the subsequent SOC estimation experiment.
The average value of the resistance and capacitance of the battery with SOC in the range of 20-100% is shown in Table 3. Table 3. Lithium-ion battery parameter identification results. Take the battery parameters identified in Table 3 into Equations (1) and (2), use the pulsed discharge current as input and compare the output terminal voltage with the actual terminal voltage. The comparison between the true value of the battery terminal voltage and the model value is shown in Figure 6; the model error value of the battery terminal voltage is shown in Figure 7; and the relevant parameters of the model error are shown in Table 4.
Electronics 2020, 9, x FOR PEER REVIEW 9 of 23 The average value of the resistance and capacitance of the battery with SOC in the range of 20-100% is shown in Table 3. Table 3. Lithium-ion battery parameter identification results. Take the battery parameters identified in Table 3 into Equations (1) and (2), use the pulsed discharge current as input and compare the output terminal voltage with the actual terminal voltage. The comparison between the true value of the battery terminal voltage and the model value is shown in Figure 6; the model error value of the battery terminal voltage is shown in Figure 7; and the relevant parameters of the model error are shown in Table 4.   In Figure 6, the actual value of the battery terminal voltage is compared with the model value of the battery terminal voltage; the terminal voltage curve of the battery model is basically consistent with the true terminal voltage curve of the battery. In Figure 7, the terminal voltage error of the battery model is shown; the terminal voltage error value of the battery model fluctuates around ±0.05 V. In Table 4, the terminal voltage error value of the battery model is calculated; the mean absolute error (MAE) of the terminal voltage of the battery model is 0.51%; the root mean square error (RMSE) of the terminal voltage of the battery model is 0.8%. The above results prove that the second-order The average value of the resistance and capacitance of the battery with SOC in the range of 20-100% is shown in Table 3. Table 3. Lithium-ion battery parameter identification results. Take the battery parameters identified in Table 3 into Equations (1) and (2), use the pulsed discharge current as input and compare the output terminal voltage with the actual terminal voltage. The comparison between the true value of the battery terminal voltage and the model value is shown in Figure 6; the model error value of the battery terminal voltage is shown in Figure 7; and the relevant parameters of the model error are shown in Table 4.   In Figure 6, the actual value of the battery terminal voltage is compared with the model value of the battery terminal voltage; the terminal voltage curve of the battery model is basically consistent with the true terminal voltage curve of the battery. In Figure 7, the terminal voltage error of the battery model is shown; the terminal voltage error value of the battery model fluctuates around ±0.05 V. In Table 4, the terminal voltage error value of the battery model is calculated; the mean absolute error (MAE) of the terminal voltage of the battery model is 0.51%; the root mean square error (RMSE) of the terminal voltage of the battery model is 0.8%. The above results prove that the second-order  In Figure 6, the actual value of the battery terminal voltage is compared with the model value of the battery terminal voltage; the terminal voltage curve of the battery model is basically consistent with the true terminal voltage curve of the battery. In Figure 7, the terminal voltage error of the battery model is shown; the terminal voltage error value of the battery model fluctuates around ±0.05 V. In Table 4, the terminal voltage error value of the battery model is calculated; the mean absolute error (MAE) of the terminal voltage of the battery model is 0.51%; the root mean square error (RMSE) of the terminal voltage of the battery model is 0.8%. The above results prove that the second-order RC equivalent circuit model of the battery designed in this paper is reasonable and reliable, and the battery model was able to be used in subsequent experiments.

Design of the SOC Estimation Algorithm
For a nonlinear system, the state equation and observation equation considering the system noise and observation noise are as shown in Equation (12): where k is the current moment, is the nonlinear observation equation, x k is the state variable, u k is the known input, y k is the observation signal, w is the system noise and v is the observation noise.
According to the second-order equivalent circuit model of the battery, combining Equations (1) and (2), the discretized state equation and observation equation of the equivalent circuit model of the battery can be shown in Equation (13): Equations (13) can be simplified to Equations (14): where According to the KF principle, combining Equations (12) and (14), the first derivative of the nonlinear observation equation is calculated at the current state value, and the observation matrix can be obtained as Equation (15).

Design of the Unscented Kalman Filter Algorithm
The unscented Kalman filter (UKF) is a combination of the unscented transform (UT) and the standard Kalman filter system, and uses the unscented transform to adapt the nonlinear system equations to the standard Kalman system under the linear assumption. UKF uses statistical linearization technology, which mainly linearizes the nonlinear function of random variables through linear regression of n Sigma points collected in the prior distribution. This linearization is more accurate than Taylor series linearization. The basic idea of UKF is Kalman filtering and unscented transform. Since UKF does not ignore high-order terms, it can effectively overcome the problems of low accuracy and poor stability of EKF estimation.
The UDDS operating conditions are shown in Figure 8. The estimation terminal voltage of the battery using the UKF algorithm for SOC estimation is shown in Figure 9. The SOC estimation results of the battery using the UKF algorithm for SOC estimation are shown in Figure 10.

Design of the Unscented Kalman Filter Algorithm
The unscented Kalman filter (UKF) is a combination of the unscented transform (UT) and the standard Kalman filter system, and uses the unscented transform to adapt the nonlinear system equations to the standard Kalman system under the linear assumption. UKF uses statistical linearization technology, which mainly linearizes the nonlinear function of random variables through linear regression of n Sigma points collected in the prior distribution. This linearization is more accurate than Taylor series linearization. The basic idea of UKF is Kalman filtering and unscented transform. Since UKF does not ignore high-order terms, it can effectively overcome the problems of low accuracy and poor stability of EKF estimation.
We The UDDS operating conditions are shown in Figure 8. The estimation terminal voltage of the battery using the UKF algorithm for SOC estimation is shown in Figure 9. The SOC estimation results of the battery using the UKF algorithm for SOC estimation are shown in Figure 10.

Design of the Unscented Kalman Filter Algorithm
The unscented Kalman filter (UKF) is a combination of the unscented transform (UT) and the standard Kalman filter system, and uses the unscented transform to adapt the nonlinear system equations to the standard Kalman system under the linear assumption. UKF uses statistical linearization technology, which mainly linearizes the nonlinear function of random variables through linear regression of n Sigma points collected in the prior distribution. This linearization is more accurate than Taylor series linearization. The basic idea of UKF is Kalman filtering and unscented transform. Since UKF does not ignore high-order terms, it can effectively overcome the problems of low accuracy and poor stability of EKF estimation.
We ( The UDDS operating conditions are shown in Figure 8. The estimation terminal voltage of the battery using the UKF algorithm for SOC estimation is shown in Figure 9. The SOC estimation results of the battery using the UKF algorithm for SOC estimation are shown in Figure 10.

Design of the Unscented Kalman Filter Algorithm
The unscented Kalman filter (UKF) is a combination of the unscented transform (UT) and the standard Kalman filter system, and uses the unscented transform to adapt the nonlinear system equations to the standard Kalman system under the linear assumption. UKF uses statistical linearization technology, which mainly linearizes the nonlinear function of random variables through linear regression of n Sigma points collected in the prior distribution. This linearization is more accurate than Taylor series linearization. The basic idea of UKF is Kalman filtering and unscented transform. Since UKF does not ignore high-order terms, it can effectively overcome the problems of low accuracy and poor stability of EKF estimation.
We ( The UDDS operating conditions are shown in Figure 8. The estimation terminal voltage of the battery using the UKF algorithm for SOC estimation is shown in Figure 9. The SOC estimation results of the battery using the UKF algorithm for SOC estimation are shown in Figure 10. In Figure 9, the battery terminal voltage estimated by the UKF algorithm is shown. In Figure 9a, the estimated terminal voltage is compared with the true terminal voltage, and the estimated terminal voltage is not much different from the true terminal voltage. In Figure 9b, the terminal voltage error value of the battery fluctuates greatly. In Figure 10, the SOC of the battery estimated by UKF is shown. In Figure 10a, the estimated SOC of the battery differs greatly from the true value before 5000 seconds. In Figure 10b, the SOC estimation error of the battery just approached zero after 5000 seconds, and the convergence speed of the filter is slow.

Design of the Adaptive Unscented Kalman Filter Algorithm
The UKF algorithm uses UT to replace Taylor series expansion to transform a nonlinear system into a linear system, improving the accuracy of the algorithm. However, in the UKF algorithm, the system model noise and observation noise are set as constants, which cannot reflect the effect of real noise on the filter, which causes the SOC estimation error to increase or even diverge. In order to solve the above problems, we designed an AUKF algorithm; the algorithm is improved on the basis of the UKF algorithm; the algorithm monitors the change of innovation and residual in the filter in real time, and calculates the variance of innovation and residual by the moving window method. The system noise covariance is corrected in real time by the innovation variance, and the observation noise covariance is corrected in real time by the residual variance.
The AUKF algorithm process is as follows: (1) Determine the initial value of state valuex 0 and the initial value of state error covariance P 0 : (2) Calculate Sigma point: where L is the length of the state vector, the length of the state vector in this paper is 3 and the weight value calculation is shown in Equation (19): where α = 0.01, k i = 0, β = 2.
(3) Time update. Update predicted status value x k : Update predicted observation y k .
Update system covariance prediction value P xx|k .
Calculate innovation value d k and innovation variance value C d k .
Update system noise covariance Q k .
(4) Status update. Update observation covariance prediction value P yy|k .
Update covariance P xy|k .
Calculate Kalman gain K k .
Update estimated state valuex k .x Update estimated observationŷ k .ŷ Update error covariance P k . P k = P xx|k − K k P yy|k K T Calculate the residual value r k and the residual variance value C r k .
The AUKF algorithm flow is shown in Figure 11.
The AUKF algorithm flow is shown in Figure 11.

Adaptive System Noise Covariance Q k
From Equations (18), (21), (24), (27) and (33), it can be seen that when the Q k value is too large, system covariance prediction P xx|k increases, so that the next predicted state value x k+1 becomes larger, which eventually leads to the estimated state valuex k+1 being too large, which increases the SOC estimation error. Therefore, the system noise covariance Q k can be updated in real time to correct the influence of the system error on the estimation result.
The innovation d k at time k is defined as the difference between the actual observation value y k and the predicted observation value y k . The expression of innovation is shown in Equation (37): According to the moving window method, the variance of innovation C d k is calculated as: where W is the length of the moving window. Through the innovation variance C d k , the system noise covariance Q k can be calculated [36] as shown in Equation (39), Since the system state variable has a dimension of 3, Q k is a 3 × 3 symmetric matrix. This paper The Q k value when using the AUKF algorithm to estimate the SOC in MATLAB is shown in Figure 12.
where W is the length of the moving window. Through the innovation variance k d C , the system noise covariance k Q can be calculated [36] as shown in Equation (39) ,, The k Q value when using the AUKF algorithm to estimate the SOC in MATLAB is shown in Figure 12. It can be seen from Figure 12 that since the initial value of SOC is uncertain, the system error is relatively large at this time, so the system noise covariance It can be seen from Figure 12 that since the initial value of SOC is uncertain, the system error is relatively large at this time, so the system noise covariance Q k is relatively large. By calculating the value of innovation d k , and then updating Q k in real time to correct the error covariance P k in time, the system noise is corrected in time, and the value of Q k approaches to zero.

Adaptive Observation Noise Covariance R k
From Equations (28), (30) and (33), it can be seen that the value of R k determines the weight of the observation value to the estimated result. When the R k value increases, the filter gain K k decreases, resulting in the effect of the observation value on the estimated state value becoming smaller. Conversely, when the value of R k decreases, the filter gain K k will increase, which will increase the proportion of the observation value in the estimated state value. Therefore, the observation noise covariance R k adjusts the Kalman gain K k in real time to change the proportion of the predicted observation value in the estimation result, thereby reducing the influence of the observation noise on the estimation result.
The residual r k at time k is defined as the difference between the actual observation value y k and the estimated observation valueŷ k . The expression of the residual is shown in Equation (40): According to the moving window method, the variance of residual C r k is calculated as: Through the residual variance C r k , the observation noise covariance R k can be calculated [37] as shown in Equation (42), The R k value when using the AUKF algorithm to estimate the SOC in MATLAB is shown in the Figure 13.
Through the residual variance k r C , the observation noise covariance k R can be calculated [37] as shown in Equation (42), The k R value when using the AUKF algorithm to estimate the SOC in MATLAB is shown in the Figure 13.

Comparison of SOC Estimation Algorithms
The battery SOC was estimated using the unscented Kalman filter algorithm; k Q and k R in the adaptive unscented Kalman filter algorithm were analyzed and simulated-see Section 3. In this section, we describe how the AUKF algorithm was used to estimate the battery SOC under different It can be seen from Figure 13 that the value of R k fluctuates in a small range. The residual r k calculates the difference between the actual observation value and the estimated observation value, and then realizes the real-time update of R k , and then adjusts the Kalman gain K k to achieve the optimal estimation.

Comparison of SOC Estimation Algorithms
The battery SOC was estimated using the unscented Kalman filter algorithm; Q k and R k in the adaptive unscented Kalman filter algorithm were analyzed and simulated-see Section 3. In this section, we describe how the AUKF algorithm was used to estimate the battery SOC under different load cycles and different initial SOC values. The results of SOC estimation using AUKF algorithm and the results of SOC estimation using UKF algorithm are compared and analyzed.

Under Pulsed Discharge Conditions
We carried on the simulation experiment in MATLAB, using the AUKF algorithm to carry on the SOC estimation experiment under the pulsed discharge condition. Firstly, the initial values of the AUKF algorithm were set as follows: x 0 = [0 0 SOC] T ,P 0 = diag([10 −5 , 10 −5 , 10 −3 ]), W = 1180, Q = 10 −7 × eye(3), R = 1. Then, the AUKF algorithm was used to estimate the SOC under pulsed discharge conditions. The robustness of the proposed AUKF algorithm was tested under different initial SOC conditions. Finally, the results of SOC estimation using UKF algorithm and AUKF algorithm were compared and analyzed.
Experiments and analyses were performed under pulsed discharge conditions. For the initial SOC = 0.4, the comparison between the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 14. For the initial SOC = 0.6, the comparison between the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 15. For the initial SOC = 0.8, the comparison of the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 16.
Experiments and analyses were performed under pulsed discharge conditions. For the initial SOC = 0.4, the comparison between the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 14. For the initial SOC = 0.6, the comparison between the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 15. For the initial SOC = 0.8, the comparison of the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 16. SOC = 0.4, the comparison between the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 14. For the initial SOC = 0.6, the comparison between the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 15. For the initial SOC = 0.8, the comparison of the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 16. From Figures 14a, 15a and 16a, it can be seen that under pulsed discharge conditions, the value of the battery terminal voltage estimated by the AUKF algorithm is closer to the true value than the value estimated by the UKF algorithm value. From Figures 14b, 15b and 16b, it can be seen that under pulsed discharge conditions, the terminal voltage error value estimated by the AUKF algorithm is smaller than the terminal voltage error value estimated by the UKF algorithm. Additionally, the error value of the terminal voltage estimated by the AUKF algorithm is relatively small. According to Figures 14c, 15c and 16c, it can be seen that the SOC value estimated using the AUKF algorithm is closer to the true value. From Figures 14d, 15d and 16d, it can be seen that the SOC estimation error of AUKF is smaller than that of UKF, and the convergence speed of AUKF algorithm is faster. In summary, under pulsed discharge conditions and different initial SOC conditions, the robustness of the AUKF algorithm for estimating the SOC of the battery is better than that of the UKF algorithm.
(c) (d) From Figures 14a, 15a and 16a, it can be seen that under pulsed discharge conditions, the value of the battery terminal voltage estimated by the AUKF algorithm is closer to the true value than the value estimated by the UKF algorithm value. From Figures 14b, 15b and 16b, it can be seen that under pulsed discharge conditions, the terminal voltage error value estimated by the AUKF algorithm is smaller than the terminal voltage error value estimated by the UKF algorithm. Additionally, the error value of the terminal voltage estimated by the AUKF algorithm is relatively small. According to Figures 14c, 15c and 16c, it can be seen that the SOC value estimated using the AUKF algorithm is closer to the true value. From Figures 14d, 15d and 16d, it can be seen that the SOC estimation error of AUKF is smaller than that of UKF, and the convergence speed of AUKF algorithm is faster. In summary, under pulsed discharge conditions and different initial SOC conditions, the robustness of the AUKF algorithm for estimating the SOC of the battery is better than that of the UKF algorithm.

Under UDDS Discharge Conditions
We carried on the simulation experiment in MATLAB, using AUKF algorithm to carry on the SOC estimation experiment under the UDDS discharge condition.

Under UDDS Discharge Conditions
We carried on the simulation experiment in MATLAB, using AUKF algorithm to carry on the SOC estimation experiment under the UDDS discharge condition. Firstly, the initial values of the AUKF algorithm were set as follows: x 0 = [0 0 SOC] T , P 0 = diag([10 −5 , 10 −5 , 10 −3 ]), W = 1180, Q = 10 −7 × eye(3), R = 1. Then, the AUKF algorithm was used to estimate the SOC under UDDS discharge conditions. The robustness of the proposed AUKF algorithm was tested under different initial SOC conditions. Finally, the results of SOC estimation using UKF algorithm and AUKF algorithm were compared and analyzed.
Experiments and analyses were performed under UDDS discharge conditions. For the initial SOC = 0.4, the comparison between the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 17. For the initial SOC = 0.6, the comparison between the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 18. For the initial SOC = 0.8, the comparison of the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 19.
From Figures 17a, 18a and 19a, it can be seen that under UDDS discharge conditions, the value of the battery terminal voltage estimated by the AUKF algorithm is closer to the true value than the value estimated by the UKF algorithm. From Figures 17b, 18b and 19b, it can be seen that under UDDS discharge conditions, the terminal voltage error value estimated by the AUKF algorithm is smaller than the terminal voltage error value estimated by the UKF algorithm. Additionally, the error value of the terminal voltage estimated by the AUKF algorithm is relatively stable. According to Figures 17c,  18c and 19c, it can be concluded that the SOC value estimated using the AUKF algorithm is closer to the true value. From Figures 17d, 18d and 19d, it can be seen that the SOC estimation error of AUKF is smaller than that of UKF, and the convergence speed of AUKF algorithm is faster. In summary, under UDDS discharge conditions and under different initial SOC conditions, the robustness of the AUKF algorithm for estimating the SOC of the battery is better than the UKF algorithm. SOC = 0.4, the comparison between the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 17. For the initial SOC = 0.6, the comparison between the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 18. For the initial SOC = 0.8, the comparison of the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 19.  algorithm is shown in Figure 17. For the initial SOC = 0.6, the comparison between the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 18. For the initial SOC = 0.8, the comparison of the results estimated using the UKF algorithm and the AUKF algorithm is shown in Figure 19.  From Figures 17a, 18a and 19a, it can be seen that under UDDS discharge conditions, the value of the battery terminal voltage estimated by the AUKF algorithm is closer to the true value than the value estimated by the UKF algorithm. From Figures 17b, 18b and 19b, it can be seen that under UDDS discharge conditions, the terminal voltage error value estimated by the AUKF algorithm is smaller than the terminal voltage error value estimated by the UKF algorithm. Additionally, the error value of the terminal voltage estimated by the AUKF algorithm is relatively stable. According to Figures 17c, 18c and 19c, it can be concluded that the SOC value estimated using the AUKF algorithm is closer to the true value. From Figures 17d, 18d and 19d, it can be seen that the SOC estimation error of AUKF is smaller than that of UKF, and the convergence speed of AUKF algorithm is faster. In summary, under UDDS discharge conditions and under different initial SOC conditions, the robustness of the AUKF algorithm for estimating the SOC of the battery is better than the UKF algorithm.
In order to further verify the accuracy of the SOC estimation by the AUKF algorithm, the terminal voltage value and the SOC value estimated by the UKF algorithm and the AUKF algorithm were subjected to error analysis. The error results of the battery SOC estimation under different load cycles and different initial SOC values were averaged. The error analysis results of the terminal voltage are shown in Table 5. The error analysis results of the estimated SOC are shown in Table 6.  In order to further verify the accuracy of the SOC estimation by the AUKF algorithm, the terminal voltage value and the SOC value estimated by the UKF algorithm and the AUKF algorithm were subjected to error analysis. The error results of the battery SOC estimation under different load cycles and different initial SOC values were averaged. The error analysis results of the terminal voltage are shown in Table 5. The error analysis results of the estimated SOC are shown in Table 6. The mean absolute error (MAE) can avoid the problem of the deviations cancelling each other out, and can well describe the degree of data dispersion. The root mean square error (RMSE) measures the deviation between the observation value and the true value, and can well reflect the accuracy of the measurement. Table 5 shows that the MAE of the terminal voltage estimated by AUKF was smaller, indicating that the terminal voltage estimated by AUKF is less discrete than that of UKF algorithm; the RMSE of terminal voltage estimated by AUKF algorithm was smaller than that of UKF algorithm. Table 6 shows that the SOC value estimated by the AUKF algorithm had a smaller MAE than that of UKF algorithm. The RMSE of SOC estimated by AUKF algorithm was 2.6% smaller than that of UKF algorithm. The above error analysis results indicate that the accuracy of SOC estimation using AUKF algorithm is better than that of UKF algorithm.

Conclusions
In this paper, an adaptive unscented Kalman filter algorithm was designed to estimate the SOC of a lithium cobalt oxide battery. The second-order RC equivalent circuit model was used for nonlinear modeling of batteries. The least square method was used to identify the parameters of the battery model and for simulations in MALAB according to the battery voltage characteristics. The established model was verified under pulsed discharge conditions; the model error is 0.8%, which provides an accurate model for SOC estimation using AUKF algorithm. The system noise covariance Q value and observation noise covariance R value in the unscented Kalman filter algorithm were analyzed in this paper. The AUKF algorithm updates the system noise covariance Q and the observation noise covariance R in real time by monitoring the changes of the innovation and residual in the filter to adjust the filter gain and achieve the optimal estimate. The AUKF algorithm and UKF algorithm were used for SOC estimation under different load cycles and different initial SOC values. The estimated result of AUKF algorithm was more accurate, and the convergence rate of filtering was faster than that of UKF algorithm. To further verify the effectiveness of the AUKF algorithm, the estimated error of the terminal voltage and the estimated error of the SOC were analyzed. The error results show that the error of SOC estimation using AUKF algorithm was 0.7%, which was 2.6% smaller than that of SOC estimation using UKF algorithm.