*Article* **A Robust Algorithm for State-of-Charge Estimation under Model Uncertainty and Voltage Sensor Bias**

**Yang Guo and Ziguang Lu \***

School of Electrical Engineering, Guangxi University, Nanning 530004, China; zzguoyang@163.com **\*** Correspondence: luzg@gxu.edu.cn

**Abstract:** Accurate estimation of the state of charge (SOC) of zinc–nickel single-flow batteries (ZNBs) is an important problem in battery management systems (BMSs). A nonideal electromagnetic environment will usually cause the measured signal to contain nonnegligible noise and bias. At the same time, due to the influence of battery ageing, environmental temperature changes, and a complex reaction mechanism, it is difficult to establish a very accurate system model that can be applied to various complex working conditions. The unscented Kalman filter (UKF) is a widely used SOC estimation algorithm, but the UKF will reduce the estimation accuracy and divergence under the influence of inaccurate model and sensor errors. To improve the performance of the UKF, a robust desensitized unscented Kalman filter (RDUKF) is proposed to realize an accurate SOC estimation of batteries in the context of different disturbances. Then, the proposed method is applied to cases of error interference, such as Gaussian noise, voltage sensor drift, an unknown initial state, and inaccurate model parameters. The simulation and experimental results show that compared with the standard UKF algorithm, the proposed estimation algorithm can effectively suppress the influence of various errors and disturbances and achieve higher accuracy and robustness.

**Keywords:** real-time estimation; robust desensitized unscented Kalman filter; state of charge; zinc–nickel single-flow batteries

**1. Introduction**

Renewable energy has been considered an alternative to coal-fired energy because its use can result in reduced pollution and greenhouse gas emissions. However, the fluctuation caused by the wide application of intermittent renewable energy, such as wind energy and solar energy, will increase the burden of the power grid. Integrating rechargeable batteries into the power grid as an energy storage system can effectively improve power quality and system reliability [1]. Redox flow batteries (RFBs) have become one of the most promising grid-connected energy storage technologies on the market because of their long life cycle, good scalability, high efficiency, and low spatial requirements [2,3]. The main difference between a typical RFB and other types of batteries is that the active materials of its positive and negative electrodes are stored in an external electrolyte storage tank in the form of electrolytes and circulated into the battery stack chamber by two independent auxiliary pumps. The RFB separates the two electrolytes through the ion exchange membrane to prevent the mixing of redox substances and to maintain the electrical neutrality of the energy storage system [4,5]. Since the concept of RFBs was put forward, different kinds of RFBs have rapidly been developed, but the high cost of ion exchange membranes and the interference of electrolyte cross pollution are still the main bottlenecks hindering the development of RFBs. A novel RFB structure was proposed in [6]. This battery dissolves zincate in high-concentration potassium hydroxide as the electrolyte. As only one electrolyte is used, there is no need for an expensive ion exchange membrane in the system design, and cross pollution of the electrolyte is avoided. At the same time, this RFB has a high open-loop voltage and energy density, is nontoxic, has a simple structure, and is low-cost [7–9]. This makes its commercialization easier.

**Citation:** Guo, Y.; Lu, Z. A Robust Algorithm for State-of-Charge Estimation under Model Uncertainty and Voltage Sensor Bias. *Energies* **2022**, *15*, 1537. https://doi.org/ 10.3390/en15041537

Academic Editors: Alon Kuperman and Alessandro Lampasi

Received: 29 November 2021 Accepted: 16 February 2022 Published: 19 February 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

Zinc–nickel single-flow batteries (ZNBs) have been developed rapidly since they were first proposed. However, there are still some important problems to be solved in their practical engineering. State of charge (SOC), an important state monitored in battery management systems (BMSs), is very important to consider in attempting to avoid overcharging and/or overdischarging. At present, SOC estimation has three main research directions: the Coulomb counting method, the machine learning method, and the state observer method [10]. The Coulomb counting method is an open-loop method that is simple to implement and has a low calculation cost. However, its accuracy is greatly affected by the sensor accuracy and initial errors; thus, it is necessary to periodically use the charge– discharge cut-off voltage or open-circuit voltage to correct the estimated value [11–13]. Machine learning methods do not need to understand the internal electrochemical or external circuit characteristics of a battery. They estimate the SOC by fitting the nonlinear relationship between relevant factors such as the current, voltage, temperature, and SOC. The support vector machine (SVM) [14], neural network (NN) [15], fuzzy logic (FL) [16], and long short-term memory (LSTM) network [17] have been implemented for SOC estimation. If the appropriate training dataset is given, the machine learning method can estimate the SOC of a battery more accurately. When the training data and test data correspond to different working conditions, the robustness of the state estimation algorithm will worsen, and machine learning will require a longer training time and higher computing cost, which restricts the wide application of machine learning in actual SOC estimation. The observer method usually assumes that the battery is a dynamic system. The battery model is established to describe the change in battery state, and various filter algorithms are introduced to estimate the state variables. Among the different types of observers, the Kalman filter is the most widely used. The extended Kalman filter (EKF) was first used to solve the problem of battery state estimation. However, as the battery state space model is usually a nonlinear model and the EKF uses first-order Taylor series expansion to linearize a nonlinear model, there are large errors in estimating battery SOC using the EKF; in contrast, using the unscented Kalman filter (UKF) to estimate battery SOC results in higher robustness and accuracy [18,19].

The Kalman filter algorithm is based on a basic premise: that the established model is accurate enough to accurately track the change in battery terminal voltage under dynamic current conditions. This assumption is usually difficult to fully satisfy because the actual parameters of the model will change in accordance with the change in ambient temperature and battery life, and it is very difficult to establish a model considering all influencing factors. In [20], the error sources of SOC estimation are systematically analyzed from the perspectives of the measurement signal, model error, and state estimation algorithm. In [21], the model-based SOC estimation algorithm was shown to be more affected by voltage measurement errors and model errors than by current measurement errors and initial errors. To improve the accuracy of SOC estimation under different error sources, many different improved algorithms have been proposed.

In [22], the bias term of the model error was taken as a new state vector, which was jointly estimated with the SOC through an estimation algorithm to solve the problems of open-circuit voltage drift and voltage sensor drift [23]; a proportional integral (PI) state observer and a current integrator were used to estimate the SOC of the battery; and a drift current corrector was used to suppress the influence of the drift current. For the situation in which the battery model parameters are uncertain due to battery ageing and there is instrument measurement noise, [24] proposed a smooth variable structure filter (SVSF) to estimate the SOC and health state of lithium batteries. Compared with the EKF, the SVSF can produce more accurate SOC estimation results. In [25], the extended Kalman smoothing variable structure filter was proposed, which is a new algorithm combining the EKF and SVSF technologies. The experimental results showed that it has strong robustness with respect to inaccurate models and can improve the accuracy of SOC estimation. In [26], an observer with multiple feedback gains was designed to estimate the SOC. In the case of inaccurate modeling and current sensor drift, the SOC of the battery can be estimated

robustly, and the amount of calculation is low. In [27], an algorithm combining the strong tracking UKF and adaptive UKF was proposed, and the uncertainty of the model was identified through statistical information, which can effectively suppress the state estimation error caused by sensor drift. In [28], the observability of the second-order RC nonlinear model was analyzed, and it was proposed that accurate voltage measurement is more important for SOC estimation than current measurement accuracy, which is consistent with the conclusion of [21]. At the same time, Zhao et al. [28] proposed using the extended model to address the reduction in the accuracy of SOC estimation when errors occur in sensors and pointed out that when errors occur in voltage and current sensors, the method used may not accurately estimate the SOC and bias at the same time. In [29,30], the state estimation problem was studied when noise and bias occur in voltage sensors or current sensors. The DEKF was used to estimate the battery SOC, and the results showed that the proposed estimation method has good convergence and robustness. The two-layer state estimator proposed in [31] estimated the SOC of a battery, limiting the state estimation error to ±4% when the model is inaccurate and current deviation exists.

In summary, although voltage offset and model error are the main factors affecting the reduction in SOC estimation accuracy, few studies have considered the SOC estimation problem when voltage offset or model error exists. Moreover, the BMS is affected by external electromagnetic interference in harsh operating environments. The signals received from voltage and current sensors are usually polluted by random noise, which reduces the SOC estimation accuracy. To solve the above problems, a robust UKF algorithm is proposed to improve the robustness of the SOC estimation of ZNBs under Gaussian noise, inaccurate modeling, or voltage sensor drift. The proposed method has the following advantages: (1) it can suppress the influence of Gaussian measurement noise in a sensor, (2) it has good robustness to model parameter uncertainty, and (3) it improves the accuracy of battery SOC estimation in the presence of voltage sensor drift.

The structure of the paper is as follows: In Section 2, the equivalent circuit model of a ZNB is introduced. In Section 3, the application of the proposed robust UKF algorithm in battery SOC estimation is introduced. In Section 4, the estimation results of a robust UKF in the presence of model parameter disturbance or voltage bias are verified and compared with those of a UKF. Section 5 offers the main conclusions of the paper.

#### **2. Equivalent Circuit Model**

The SOC of ZNBs can be defined as the ratio of residual capacity to maximum capacity, which can be expressed by (1). *SOCt* and *SOC*<sup>0</sup> are the initial *SOC* at time *t* and at the beginning of estimation, respectively, *Qn* is the maximum capacity of the battery, and *i*(*τ*) is the load current. It is assumed that the current is positive when the battery is discharged.

$$\text{SOC}\_{t} = \text{SOC}\_{0} - \frac{1}{Q\_{\text{u}}} \int\_{0}^{t} i(\mathbf{r}) d\mathbf{r} \tag{1}$$

At present, the commonly used battery models mainly include neural network models, electrochemical models, and equivalent circuit models (ECMs). Among the electrochemical models, the one-dimensional (1D) model [32] and pseudo-two-dimensional (P2D) model [33,34] are widely used. As the electrochemical model is the first-principles model and has clear physical significance, it can not only describe the relationship between current and voltage at the macroscale but also analyze the concentration, current and potential distribution of reaction products in the electrode and electrolyte at the microscale. However, the complex coupled nonlinear partial differential equations and the model parameters that are difficult to measure directly cause the electrochemical model to have high requirements regarding the amount of calculation. The neural network model is the opposite of the electrochemical model. This model does not consider the mechanism of a battery and uses only the data-driven method to approximate the dynamic characteristics of the battery. Compared with other models, it requires more data to train the network model. ECM uses circuit elements such as resistance, capacitance, and voltage source to build

a circuit network to simulate the dynamic response of voltage under different working conditions. The commonly used equivalent circuit models include the Thevenin model and second-order RC equivalent circuit model, which adds a group of RC networks. Therefore, the polarization and diffusion characteristics inside the battery can be better simulated.

A typical second-order-equivalent circuit model is shown in Figure 1. *R*<sup>1</sup> and *R*<sup>2</sup> represent the polarization resistance, and C1 and C2 represent the polarization capacitance. The equivalent circuit model uses parallel RC branches to characterize the electrochemical polarization and concentration polarization of ZNBs during charge and discharge. *VOCV* represents the open-circuit voltage of the battery, which is the difference in the equilibrium electrode potential between the positive and negative electrodes when the battery is in a reversible equilibrium state during the open-circuit period. *R*<sup>0</sup> is the ohmic resistance, which is used to characterize the energy loss caused by the resistance between the battery electrode and electrolyte. The terminal voltage and current of the battery are expressed as *Vt* and I, respectively, and the current during discharge is defined as a positive number. According to Kirchhoff's law and (1), the discrete state space equation of a dynamic battery can be easily deduced, as shown in (2) and (3). It is worth noting that for a ZNB, because the open-circuit voltage, polarization capacitance, and polarization resistance are functions related to the SOC, the state equation and output equation of this state space equation are nonlinear equations.

$$
\begin{bmatrix} SOC(k) \\ U\_1(k) \\ U\_2(k) \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \exp(-\Delta t/R\_1/C\_1) & 0 \\ 0 & 0 & \exp(-\Delta t/R\_2/C\_2) \end{bmatrix} \begin{bmatrix} SOC(k-1) \\ U\_1(k-1) \\ U\_2(k-1) \end{bmatrix} \tag{2}
$$

$$
+ \begin{bmatrix} -\eta \frac{\Delta t}{Q\_\pi} \\ [1 - \exp(-\Delta t/\tau\_1)]R\_1 \\ [1 - \exp(-\Delta t/\tau\_2)]R\_2 \end{bmatrix} I(k-1)
$$

$$
V\_t(k) = V\_{\text{OCV}}(SOC(k)) - lI\_1(k) - lI\_2(k) - R\_0I(k) \tag{3}
$$

**Figure 1.** Schematic diagram of the two-order RC ECM.

To simplify the model, the parameters are assumed to be related only to the SOC, but in fact, the model parameters are also affected by the ambient temperature, current, and battery ageing state. Ignoring these factors in modeling reduces the accuracy of the model in a complex working state and affects the accuracy of the algorithm when used to estimate the SOC.

#### **3. Robust Unscented Kalman Filter**

For nonlinear systems such as ZNBs, the corresponding discrete state space representation is as follows:

$$\mathbf{x}\_{k} = f(\mathbf{x}\_{k-1}, \mathbf{u}\_{k-1}) + \mathbf{w}\_{k-1} \tag{4}$$

$$y\_k = h(\mathbf{x}\_{k'} \boldsymbol{u}\_k) + \boldsymbol{v}\_k \tag{5}$$

where *xk* = [*SOC U*<sup>1</sup> *U*2] *<sup>T</sup>* is the state at time *k*, and *uk* and *yk* are the input current and output voltage at time *<sup>k</sup>*, respectively. *<sup>f</sup>*(*xk*−1, *uk*−1) is the state transfer function, *<sup>h</sup>*(*xk*, *uk*) is the measurement function, and *wk*−<sup>1</sup> and *vk* are the process noise and the measurement noise, which are usually assumed to be zero-mean white noise with covariance matrices *Q* and *R*, respectively.

Unlike the EKF, which uses only Taylor series expansion to approximate the nonlinear state space model [35], the UKF uses a traceless transformation (UT) to determine the sampling points near the estimation points and uses these sample points to approximately represent the random distribution of the nonlinear function [36]; thus, the UKF algorithm does not need to calculate the Jacobian matrix of the system model (compared with the EKF). At the same time, there is no need for random sampling (compared with the particle filter (PF) algorithm); therefore, the UKF can be regarded as a compromise between the EKF and PF. The SOC estimation process of a ZNB based on the UKF can be summarized as follows:

(1) Initialize the value of the state variable and the covariance:

$$\begin{cases} \overline{\mathbf{x}}\_0 = E(\mathbf{x}\_0) \\ P\_0 = E[(\mathbf{x}\_0 - \overline{\mathbf{x}}\_0)(\mathbf{x}\_0 - \overline{\mathbf{x}}\_0)^T] \end{cases} \tag{6}$$

where *E* (·) is the expected mean value.

(2) Generate 2*n* + 1 sigma vectors and corresponding weights at the *k* − 1 step, where *n* is the dimension of the state variable:

$$\begin{cases} \begin{aligned} \hat{\chi}\_{0,k-1} &= \hat{\mathfrak{x}}\_{k-1} \\ \hat{\chi}\_{i,k-1} &= \hat{\mathfrak{x}}\_{k-1} + \left(\sqrt{(n+\lambda)P\_{k-1}}\right)\_{i} i = 1, 2, \dots, n \\ \hat{\chi}\_{i,k-1} &= \hat{\mathfrak{x}}\_{k-1} - \left(\sqrt{(n+\lambda)P\_{k-1}}\right)\_{i} i = n+1, \dots, 2n \end{aligned} \end{cases} \tag{7}$$
 
$$\begin{cases} \omega\_{0}^{m} = \frac{\lambda}{(n+\lambda)} \\ \omega\_{0}^{c} = \frac{\lambda}{(n+\lambda)} + \left(1+\beta-\alpha^{2}\right) \\ \omega\_{j}^{m} = \omega\_{j}^{c} = \frac{1}{2(n+\lambda)}, j = 1, 2, \dots, 2n \end{aligned} \tag{8}$$

Here, *<sup>λ</sup>* is a scaling parameter, which can be expressed as *<sup>λ</sup>* <sup>=</sup> *<sup>α</sup>*2(*<sup>n</sup>* <sup>+</sup> *<sup>h</sup>*) <sup>−</sup> *<sup>n</sup>*, and *<sup>α</sup>* determines the spread of the sigma points around *x*ˆ*k*−<sup>1</sup> and is usually set to a small positive value. *ω<sup>m</sup>* and ω*<sup>c</sup>* are covariance weights, and *β* is a parameter that is used to incorporate prior knowledge of the distribution of the state variable. For Gaussian distributions, one can assume *β* = 2.

(3) State prediction

Update the sample point and calculate the propagated mean:

$$\overline{\chi}\_{j,k} = f\left(\hat{\chi}\_{j,k-1}, \mu\_{k-1}\right), j = 0, 1, \dots, 2n \tag{9}$$

$$
\overline{\mathbf{x}}\_k = \sum\_{j=0}^{2n} \omega\_j^{(\mathfrak{m})} \overline{\chi}\_{j,k} \tag{10}
$$

Update the priori error covariance of state:

$$\mathcal{P}\_k = \sum\_{j=0}^{2n} \omega\_j^{(c)} [\overline{\chi}\_{j,k}^x - \overline{\chi}\_k] [\overline{\chi}\_{j,k}^x - \overline{\chi}\_k]^T + Q\_k \tag{11}$$

where *Qk* is the covariance of system process noise.

(4) Measurement update

Predict the measurement from the propagated sigma points and estimate the mean of the predicted measurement.

$$\mathcal{Y}\_{j,k} = h\left(\overline{\chi}\_{j,k'} \mu\_k\right), j = 0, \dots, 2L \tag{12}$$

$$\overline{y}\_k = \sum\_{j=0}^{2n} \omega\_j^{(m)} \mathcal{Y}\_{j,k} \tag{13}$$

Calculate the covariance of the measured variables and associated covariance matrices, where *Rk* is the covariance of measurement noise.

$$\overline{P}\_{yy,k} = \sum\_{j=0}^{2n} \omega\_j^{(c)} \left[ \mathcal{Y}\_{j,k} - \overline{y}\_k \right] \left[ \mathcal{Y}\_{j,k} - \overline{y}\_k \right]^T + \mathcal{R}\_k \tag{14}$$

$$\overline{P}\_{xy,k} = \sum\_{j=0}^{2n} \omega\_j^{(c)} \left[ \overline{\chi}\_{j,k} - \overline{\pi}\_k \right] \left[ \mathcal{Y}\_{j,k} - \overline{\mathcal{Y}}\_k \right]^T \tag{15}$$

Calculate the posterior estimate and the covariance:

$$\pounds\_k = \overline{\pi}\_k + K\_k (y\_k - \overline{y}\_k) \tag{16}$$

$$\mathcal{P}\_k = \overline{\mathcal{P}}\_k - \overline{\mathcal{P}}\_{xy,k} \mathcal{K}\_k^T - \mathcal{K}\_k \overline{\mathcal{P}}\_{xy,k}^T + \mathcal{K}\_k \overline{\mathcal{P}}\_{yy,k} \mathcal{K}\_k^T \tag{17}$$

where *Kk* is the Kalman gain, which can be expressed as *Kk* = *Pxy*,*kP*<sup>−</sup><sup>1</sup> *yy*,*k*.

The standard UKF has been successfully applied to battery SOC estimation [37,38]. It is easy to prove that the UKF is an unbiased state estimator when all system model parameters and noise statistics are accurately known. However, when the parameters of the system model are uncertain, the theoretical behavior and actual behavior of the filter will be inconsistent. Compared with the actual state value, the state estimation value will have a large deviation and even a serious divergence problem. Therefore, the RDUKF is then applied to the SOC estimation of ZNBs [39] to obtain a more robust SOC state estimation scheme.

Before using the RDUKF to estimate the battery SOC, the state equation and observation equation need to be changed to the following form:

$$\mathbf{x}\_{k} = f(\mathbf{x}\_{k-1}, \mathbf{u}\_{k-1}, \mathbf{a}) + w\_{k-1} \tag{18}$$

$$y\_k = h(\mathbf{x}\_{k\prime} u\_{k\prime} \boldsymbol{\omega}) + v\_k \tag{19}$$

where *α* is the uncertainty parameter in the established model.

The influence of model disturbance parameters on the accuracy of state estimation is measured by the sensitivity matrix of the state estimation error relative to the disturbance parameters. Therefore, (20) is used to evaluate the influence of uncertain parameters on a priori estimation and a posteriori estimation in the UKF algorithm, and *α<sup>i</sup>* is the I component of uncertain parameters.

$$
\overline{\sigma}\_{i\_k} = \frac{\partial \overline{\pi}\_k}{\partial \alpha\_i}, \hat{\sigma}\_{i\_k} = \frac{\partial \hat{\alpha}\_k}{\partial \alpha\_i} \tag{20}
$$

The sensitivity matrix can be generated by calculating the partial derivatives of the parameters in (10) and (16), where *l* is the number of uncertain parameters.

$$
\overline{\sigma}\_{i\_k} = \sum\_{j=0}^{2L} \omega\_j^{(m)} \frac{\partial \overline{\chi}\_{j,k}}{\partial \alpha\_i}, i = 1, \dots, \ell \tag{21}
$$

$$
\sigma i\_k = \overline{\sigma}\_{i\_k} - K\_k \frac{\partial \overline{y}\_k}{\partial \alpha\_i}, i = 1, \dots, \ell \tag{22}
$$

Corresponding to the UKF algorithm, the calculation of the sensitivity of the RDUKF can be divided into four steps:

(1) Calculate the sensitivities of the sigma points for each uncertain parameter.

$$\begin{cases} \frac{\partial \hat{\lambda}\_{0,k-1}^{\circ}}{\partial \boldsymbol{a}\_{i}} = \hat{\sigma}\_{i\_{k-1}}^{T} \\\\ \frac{\partial \hat{\lambda}\_{j,k-1}^{\circ}}{\partial \boldsymbol{a}\_{i}} = \hat{\sigma}\_{i\_{k-1}}^{T} + \sqrt{(n+\lambda)} \left(\frac{\partial \sqrt{\hat{P}\_{k-1}}}{\partial \boldsymbol{a}\_{i}}\right)\_{j}; j = 1, 2, \dots, n \\\\ \frac{\partial \hat{\lambda}\_{j,k-1}^{\circ}}{\partial \boldsymbol{a}\_{i}} = \hat{\sigma}\_{i\_{k-1}}^{T} + \sqrt{(n+\lambda)} \left(\frac{\partial \sqrt{\hat{P}\_{k-1}}}{\partial \boldsymbol{a}\_{i}}\right)\_{j}; j = 1, 2, \dots, n \end{cases} \tag{23}$$
