*2.1.3 Li-ion battery 3RC ECM SOC estimation using an adaptive extended Kalman filter (AEKF)*

The main goal of this section is to estimate the battery SOC and analyze the AEKF SOC estimator accuracy compared with the actual value of the battery model validated in the previous section. It is essential to prove that an accurate battery model in terms of SOC and terminal voltage is vital for building the most accurate SOC estimator. To accomplish this goal, an adaptive extended Kalman filter (AEKF) SOC estimator is adopted in this research, encouraged by the preliminary results obtained in [9, 29] by using the same AEKF estimator for a similar application. The SOC estimator implementation is performed on the MATLAB R2018b platform, and the simulation results are depicted in **Figure 10**. Also, in **Figure 10a** is shown the SOC AEKF estimator accuracy and its robustness to changes in the SOC initial value from SOCini = 0.7 to SOCini = 0.4, compared with the 3RC ECM model values. In **Figure 10b**, the battery model terminal voltage is compared with the AEKF estimate of the terminal voltage. Both **Figure 10a** and **b** reveal that the SOC AEKF estimator performs well with high SOC accuracy, evaluated also based on their errors shown in **Figure 10c** and **d**.

*Investigations of Using an Intelligent ANFIS Modeling Approach for a Li-Ion Battery… DOI: http://dx.doi.org/10.5772/intechopen.105529*

#### **Figure 8.**

*(a) The Simulink model of the 3RC ECM Li-ion battery in compact form; (b) the detailed Simulink model of the 3RC ECM Li-ion battery.*

## *2.1.4 The ARX model of the Rint-3RC ECM circuit dynamics (ARX-ECM)*

An alternative to the battery model is a linear polynomial model in discrete-time state-space representation, namely an autoregressive with exogenous terms (ARX) model, which captures the dynamics impact on the series circuit Rint (internal battery resistance) and all three RC polarization cells. The linear discrete-time polynomial model ARX is one of the simplest models that incorporate the stimulus input signal to capture some stochastic dynamics as part of the 3RC ECM dynamics. Since the OCV = f(SOC) curve is of high nonlinearity, an ANFIS model is also assessed. A hybrid battery model structure ARX Rint-3RC ECM – ANFIS OCV(SOC) model will be developed as a challenge in this valuable research for the reader to have a good

**Figure 9.**

*(a) Li-ion battery 3RC ECM model SOC versus battery ADVISOR simulator estimated; (b) SOC residual error; (c) OCV = f(SOC) curve for 5 hours full discharge of the battery to a UDDS driving multi-cycles; (d) SOC for a full battery discharge SOC; (e) SOC for a single UDDS driving cycle discharging input profile (1370 seconds).*

insight on OCV(SOC) impact on battery SOC accuracy. Finally, a combined ARX Rint-3RC ECM – ANFIS OCV(SOC) model structure is investigated. The Simulink diagram with all these alternative modeling techniques is shown in **Figure 8**. To build a single-input single-output (SISO) ARX model, the system identification MATLAB toolbox and Simulink are the most precious tools [13]. Also, for good documentation,

*Investigations of Using an Intelligent ANFIS Modeling Approach for a Li-Ion Battery… DOI: http://dx.doi.org/10.5772/intechopen.105529*

#### **Figure 10.**

*(a) SOC voltage; (b) battery terminal voltage versus AEKF estimated. (c) Terminal voltage residual error; (d) SOC residual error.*

a piece of valuable information about ARX models is provided in the references [10–13, 31]. MATLAB's arx command is helpful to generate and estimate the models' parameters from the input-output data sets. This MATLAB command is a routine based on a prediction-error least-squares method and specified polynomial orders to estimate the parameters of ARX polynomial discrete-time models. The model properties include covariances (parameter uncertainties) and goodness of fit between the estimated and measured data. Fundamental work on systems identification is done in [31]. The MATLAB implementation and simulations of SISO polynomial ARX models can be performed on any recent MATLAB platforms available online at www.math works.com/help/ident/ref/arx.html [13]. A "trial and error" procedure is considered to select the most suitable ARX model order. This procedure is repetitive until the best match of the data set is found, provided by the following status indicators:


as recorded output data of ARX model. The ARX model can be represented in the discrete state-space by the following polynomial with constant coefficients:

$$A(q)\mathcal{y}\_d(t) = B(q)u(t) + e(t) \tag{7}$$

where *yd*ð Þ*t* is the output dynamics part of the series circuit Rint-3RC, given by

$$\mathcal{Y}\_d(t) = R\_{int}u(t) + V\_1(t) + V\_2(t) + V\_3(t) = \nu\_d(t) \tag{8}$$

where the voltages *V*1ð Þ*t* ,*V*2ð Þ*t* , and ,*V*3ð Þ*t* are given in Eq. (1), Eq. (2), and respectively Eq. (3). The Rint-3RC circuit input *u t*ð Þ denotes the battery charging and discharging current input (e.g., UDDS driving cycle input current profile). The linear discrete time polynomials *A q*ð Þ and *B q*ð Þ in Eq. (7) have the degrees *na* (poles), respectively *nb*(zeroes) and are described as,

$$A\left(q^{-1}\right) = \mathbf{1} + a\_1 q^{-1} + \dots + a\_{n\_a} q^{-n\_a} \tag{9}$$

$$B(q^{-1}) = b\_1 q^{-1-n\_k} + \dots + b\_{n\_b} q^{-n\_b - n\_k + 1} = q^{-n\_k} \left( b\_1 q^{-1} + \dots + b\_{n\_b} q^{-n\_b + 1} \right) \tag{10}$$

where *nk* designates an integer number of samples as a track record of pure transport signal flow delay between the system input-output measurement sensors. Also, *u t*ð Þ and *yd*ð Þ*t* in Eq. (7) denote the Rint-3RC ECM input, respectively, its output at the discrete instant *t* ¼ *kTs*, *kϵZ*þ, *q* is a forward shift operator, i.e., *qut* ð Þ¼ ð Þ *u t*ð Þ <sup>þ</sup> <sup>1</sup> , *q yd*ð Þ*<sup>t</sup>* <sup>¼</sup> *yd*ð Þ *<sup>t</sup>* <sup>þ</sup> <sup>1</sup> , and *<sup>q</sup>*�<sup>1</sup> is backward shift operator, i.e., *<sup>q</sup>*�<sup>1</sup> ð Þ¼ *u t*ð Þ *u t*ð Þ � <sup>1</sup> , *<sup>q</sup>*�<sup>1</sup> *yd*ð Þ*<sup>t</sup>* <sup>¼</sup> *yd*ð Þ *<sup>t</sup>* � <sup>1</sup> . *Ts* represents the sampling period, and *e t*ð Þ term denotes the white noise disturbance value at the discrete instant t. The values of *na* and *nb* that signify the degrees of the polynomials *A q*ð Þ and *B q*ð Þ, respectively, are set to the arguments in the syntax of the specific MATLAB arx command from Control Systems Identification MATLAB Toolbox. To use MATLAB Simulink to build the 3RC ECM battery model based on ARX model of the Rint-3RC electrical circuit dynamic part, a transfer function representation of the linear discrete-time polynomial ARX model is required. Some of MATLAB simulations results obtained after the use for ARX Rint-3RC ECM model implementation of the identification systems toolbox arx command are shown below. Discrete-time ARX (2,2,1) (i.e., ARX (*na* ¼ 2, *nb* ¼ 2, *nk* ¼ 1) model [10, 12, 13]:

$$A(x)y\_d(t) = B(x)u(t) + e(t) \tag{11}$$

$$A(z) = 1 - 1.121z^{-1} + 0.2837z^{-2}, \\ a\_1 = -1.121, \\ a\_2 = 0.2837 \tag{12}$$

$$B(z) = 0.006972z^{-1} - 0.005292^{-2}, b\_1 = 0.006972, b\_2 = -0.005292\tag{13}$$

Sample time: 1 seconds, Parameterization: polynomial orders: na ¼ 2, nb ¼ 2, nk ¼ 1, Number of free coefficients: 4, Status: Estimated using ARX on time-domain data, Fit to estimation data: 33.89% (simulation focus), FPE: 0.007562, MSE: 0.004557.

**Remark:** Since the roots of the characteristic equation *A z*�<sup>1</sup> ð Þ¼ 0 are equal to

0<*z*1= 0.735 < 1, <0 and *z*<sup>2</sup> = 0.385 < 1, then the dynamic part of the 3RC ECM model is stable. The Simulink model of the ARX Rint-3RC ECM dynamic model part is integrated into the overall Simulink diagram shown in **Figure 8**, and the MATLAB simulation results for the new Li-ion battery SAFT accurate model implementation are presented in **Figure 11** for the ARX model of Rint-3RC ECM dynamic part voltage versus the voltage measurement values. In **Figure 7**, the result of simulations is related to battery terminal voltage based on the original 3RC ECM model versus battery

*Investigations of Using an Intelligent ANFIS Modeling Approach for a Li-Ion Battery… DOI: http://dx.doi.org/10.5772/intechopen.105529*

**Figure 11.** *The ARX – ECM model of 3RC ECM dynamic part voltage- MATLAB simulation result for validation.*

**Figure 12.** *Battery terminal voltage residual error.*

terminal voltage in the integrated structure with ARX Rint-3RC ECM, the dynamic part model. For a good visualization of battery accuracy performance, the residual voltage between two previous voltages is depicted in **Figure 12**.

According to Eq. (4) and Eq. (6), an overall discrete-state space representation for the integrated ARX model structure of 3RC ECM SAFT Li-ion battery model can be written as follows:

$$\sec(k+1) = \sec(k) - \frac{\eta T\_s u(k)}{C\_{nom}}, \sec(0) = \text{SOCini} \tag{14}$$

$$y(k) = -V\_d(k) + V\_{OCV}(k) = -ARX(u(k)) + OCV(\text{soc}(k))\tag{15}$$

where *yd*ð Þ¼ *k Vd*ð Þ*k* represents the output voltage of the dynamic part Rint-3RC ECM, and *u k*ð Þ¼ *i k*ð Þ the input current profile of the battery. Also, a detailed discretetime state-space representation has the following form:

$$\mathcal{L}\varkappa(k+1) = A\varkappa(k) + Bu(k) + w(k)\tag{16}$$

$$\mathbf{y}(k) = \mathbf{C}\mathbf{x}(k) + \boldsymbol{\nu}(k) \tag{17}$$

where

$$A = \begin{bmatrix} 1 & 0 & 0 \\ 0 & a\_1 & a\_2 \\ 0 & 0.5 & 0 \end{bmatrix}, \quad B = \begin{bmatrix} -\frac{\eta T\_s}{C\_{nom}} \\ b\_1 \\ 0 \end{bmatrix}, \quad C = \begin{bmatrix} \text{OCV}(\text{sc}(k)) & c\_1 \ c\_2 \\ \text{sc}(k) & c\_1 \ c\_2 \end{bmatrix}, \tag{18}$$

*x k*ð Þ¼ *soc k*ð Þ *x*1ð Þ*k x*2ð Þ*k* 2 6 4 3 7 <sup>5</sup>, *u k*ð Þ¼ *i k*ð Þ and represent the battery state vector and input

current driving cycle profile, respectively. The components *x*1ð Þ*k* and *x*2ð Þ*k* of the state vector describe the Rint-3RC ECM dynamics part of all three parallel polarization cells, and *y k*ð Þ is the predicted battery terminal voltage. The new model parameters have the following values: *a*<sup>1</sup> ¼ 1*:*121, *a*<sup>2</sup> ¼ �0*:*5674,*c*<sup>1</sup> ¼ 0*:*058578, and *c*<sup>2</sup> ¼ �0*:*08467. The advantage of the new discrete-time state-space representation compared with 3RC ECM battery original model is its third-order simplified structure. This structure is used to estimate the battery SOC using an AEKF SOC state estimator and then to compare its

**Figure 13.**

*(a) The battery SOC true values versus SOC AEKF estimated values and SOC ADVISOR estimate for SOCini = 40%.; (b) AEKF battery terminal voltage versus battery ARX ECM and 3RC ECM models terminal voltages; (c) SOC battery residual between ARX model SOC and AEKF SOC estimator; (d) terminal voltage error between ARX model and AEKF estimator.*

*Investigations of Using an Intelligent ANFIS Modeling Approach for a Li-Ion Battery… DOI: http://dx.doi.org/10.5772/intechopen.105529*

accuracy performance with 3RC ECM Li-ion battery original model. For comparison purposes, the MATLAB simulation results of AEKF SOC estimator based on ARX battery model are shown in **Figure 13**. To also highlight the robustness of the AEKF SOC estimator to the changes in the initial value of battery SOC, in **Figure 13a** is depicted the battery SOC true values versus SOC AEKF estimated values and SOC ADVISOR estimate for an SOCini = 40%. The simulation results reveal an excellent robustness and SOC accuracy of the adopted AEKF SOC estimator. Moreover, the simulation results are shown in **Figure 13b–d** that highlight the accuracy of battery terminal voltage of ARX ECM model compared with 3RC ECM and AEKF SOC estimator based on ARX model, as well as both residuals SOC and battery terminal voltage.
