A variable-length window-wise parameter-dependent state of charge estimation by Kalman ﬁlters

—This paper proposes a new window-wise state of charge (SOC) estimation algorithm based on Kalman ﬁlters (KF). In the ﬁrst stage, the equivalent circuit model’s parameters are estimated by a least square estimation window-wise, assuming a linear SOC and open-circuit volt- age (OCV) relation. The algorithm accurately estimates the parameters and observes the changes that depend on SOC. Moreover, based on the estimated parameters, the OCV values are identiﬁed. In the next stage, window-wise lin- ear Kalman ﬁlter(ES-LKF) without hysteresis and extended Kalman ﬁlter (ES-EKF) and sigma-point Kalman ﬁlter (ES- SPKF) algorithm with hysteresis are executed to estimate SOC. Having fewer state equations and hysteresis parame- ters tuned up in an off-line way, the ES-EKF and ES-SPKF perform better than the algorithms considered in previous works. The algorithms are validated by experiments with real data obtained from lab tests.

capacity, is a crucial parameter and is among the states that need to be monitored. Estimating SOC is the fundamental challenge for BMS because the parameter uncertainty and nonlinear dynamics of the battery make it a complex and difficult task.
About SOC estimation methods, one can find a large amount of literature. Here, we only describe the basic methods and the ones that are directly related to our work. Ampere-hour counting (Ah counting) [1] is the most basic and direct method to estimate SOC. In this method, SOC is calculated by integrating the loaded current to find how much charge is remained. Although, Ah counting is a useful theoretical method, it can not be used in a practice, because it suffers from the unknown initial SOC value and the accumulated uncertainty due to the integration process. Therefore, a proper recalibration must be incorporated into it and Ah counting method is often combined with other techniques to obtain better accuracy.
Another conventional approach is using look-up tables or SOC-OCV relation. This approach is used independently or in a combination of Ah counting [2], [3]. However, measuring OCV requires a long rest time, therefore, it is not used in online applications. Moreover, for the batteries which have a very flat SOC-OCV curve, this method is not applicable.
More sophisticated methods are the model-based approaches. These methods use mathematical equations to model the battery dynamics and calculate the SOC from the equations taking inputs such as voltage, current, and temperature. There are two types of battery models: electrochemical and electrical models. The electrochemical models use equations based on physical laws that govern the internal electrochemical processes in the battery. Although the electrochemical models are very accurate, the coupled partial differential equations make them very difficult to implement. An electrical model uses electrical circuit elements such as voltage source, resistors, and capacitors to describe battery dynamic behavior. It is ideal for system simulation and implementation in embedded microcontrollers [4]- [6]. For the details of above-mentioned methods and the other ones such as reduced-order models and machine learning-based approaches, we refer to excellent review papers [7], [8] and [9] and references therein.
The extended Kalman filter (EKF) is a widely used nonlinear KF and it linearizes the system dynamics efficiently. In a series of works [10], EKF was used as an electrical modelbased SOC estimation method. The main advantage of KF based methods to estimate SOC is that it can be performed very accurately and continuously during battery operation. The unscented KF and central difference KF methods [11]- [13], which are different forms of sigma-point KF (SPKF), address model nonlinearities more efficiently.
The battery model parameters change depending on the SOC level, operating temperature, and cycle number. The SOC estimation that takes into account these parameter changes should give better results. Therefore, online parameter estimation algorithms are desirable for that purpose. Rahimi-Eichi et al. [14]- [18] considered a moving window least-square filter for the piecewise linear model of SOC-OCV curve. The advantage of this method is that it estimates simultaneously the model parameters as the parameters change during the battery operation and the method has a better stability.
By proposing a special discretization for battery's dynamics equations, the authors in [19] extracted the battery's electrical model parameters more efficiently and the initial value of SOC in each time window was found by a nonlinear optimization solver. In this paper, we introduce a refined version of the discretization used in [19] and execute KFs to estimate SOC. This combined estimation scheme, in which the initial value of OCV is computed window-wise and the parameter variability is taken into account, yields more accurate results.
The rest of this article is organized as follows. The section II introduces the battery model, the proposed discretization and parameter identification scheme. The section III discusses the use of KFs with and without the hysteresis for the identified parameters. In section IV, the experimental results with data obtained from lab tests were given to validate the proposed method.

II. BATTERY MODEL AND PARAMETER IDENTIFICATION
In this work, we assume the terminal voltage V and current I are known only, and we do not consider the temperature dependence and the battery capacity degradation. An electrical model (or equivalent circuit model) of a battery consists of a series resistance R 0 and parallel RC components (Fig.1). The purpose of using an electrical model is to imitate or approximate the dynamic behavior of a battery by the dynamics of the electrical model. Theoretically, one can add as many RC components as one wants. However, adding RC components increases the order of the dynamical systems (order of differential equations) being modeled. Although higher-order electrical models can give accurate simulation results, computational complexity and numerical stability issues often degrade the estimation results. In the work [4], two RC components are used to simulate the behavior of the Li-Po cells with reasonable accuracy. And each of the RC components acts as a slow and fast change of the variable. But one RC component model can yield good enough accuracy [10], [16], [17] for a shorter time window expressing faster transients.
The relation of OCV and SOC is, generally, nonlinear and contributes to the complexity of battery dynamics significantly. An approximation of the SOC-OCV curve by simpler functions (linear, quadratic, sigmoid, etc.) is necessary to manipulate the model's underlying equations. In this paper, one RC component model is considered as in the Fig.1, and the SOC-OCV curve is represented by: The terminal voltage V is the sum of individual element voltages: where V 0 is the voltage across the resistor element R 0 and V RC is the voltage across the RC component. The V RC follows the differential equatioṅ Combining (2) and (3) yields The SOC, by definition, satisfies the equatioṅ where Q is the total capacity of the cell. For the time window {t k }, k = k 0 , k 0 + 1, ..., k 0 + n, we approximate the SOC-OCV curve by linear relation where a and b are constants. This approximation is reasonable one if the time window and range of variability for SOC are short. Putting (6) into (4) gives In order to discretize the equations (7), we use the trapezoidal rule as follows: where f [k] = f (kT ). The bilinear transform, which is a transformation from continuous time system (in the Laplace domain) to discrete time system (in the Z-domain) uses the trapezoidal rule (8). Unlike the method used in [16], where the bilinear transform is applied to the second order version of (8) (one more differentiation), the trapezoidal rule is applied to (7) directly. In the next stage, the SOC is expressed by coulomb counting method with the rectangle rule for integral: .., k 0 + n. In the work [19], trapezoidal rule for integral was used for coulomb counting. The reason that rectangle rule for integral was used in this paper is the equation (9) is compatible with the state equation in KF-based SOC estimation. Another subtle effect is that (9) captures the instantaneous hysteresis more efficiently compared to trapezoidal rule (see section IV).
Using (8) for V, I and computing SOC by (9), the following discrete differential equations are obtained: where The values are known (measured) values within the current time window, the system (10) and (11) can be solved in a least square sense. Therefore, the parameters a, R 0 , R, C and the value OCV [k 0 ] are estimated directly. In the next stage, if we are to ignore the hysteresis effect, the value SOC[k 0 ] and the parameter b can be determined by The estimation algorithm purposed in [16] was able to determine only 4 parameters a, R 0 , R, C in the first stage and a look-up table of piece-wise linearization of SOC-OCV curve was used to determine b. However, the estimation scheme (10)- (12) determines not only the parameters a, b, R 0 , R, C, but also the initial values of SOC[k 0 ] and OCV [k 0 ]. Moreover, the linearization (6) of SOC-OCV curve was performed within the time window, while the linearization purposed in [16] was done statically (not depending on time). Therefore, our estimation scheme has a better adaptation, and extensive numerical testing results are reported in [19]. Since the initial value OCV [k 0 ] was determined, the circuit voltage V RC can be computed by within time window. Consequently, the OCV [k] values are determined by In the next section, we purpose KF-based SOC estimation algoritm that use the values (15).

III. SOC ESTIMATION BY KFS
Gaussian sequential probabilistic inference scheme is used for the following general model: where w k and v k Gaussian noise processes with meansw andv and covariance matrices Σ w and Σ v respectively. The following is the summary of general Gaussian sequential probabilistic inference scheme, where Plett's notations were used from [11].
When the dynamics of the system being modeled is linear, i.e., the functions f and g are linear, the above scheme called linear KF, and it is exact minimum mean-square-error state estimator. If the system dynamics is nonlinear, other variants of KF are used. The EKF linearizes the model at each time point, and it performs well when the system nonlinearities are not high. The SPKF (or unscented KF) linearizes the model statistically at each point in time, and it tends to give reasonable estimates even if nonlinearities are high.
In the first phase of purposed SOC estimation method, the parameters a, b, R 0 , R, C and the OCV [k] values are estimated by (10)- (15). In the next phase, two types of KF (linear and nonlinear) are purposed depending on the influence of hysteresis effect. If the hysteresis effect is neglected, the following simple linear model can be used window-wise to estimate SOC: where w[k] and v[k] are process and sensor noises with Gaussian distributions. Let us denote this combined estimation scheme (10)- (15) and (17a)-(17b) by ES-LKF.
If we are to consider hysteresis effect significantly, the following hysteresis model can be used: where f (SOC) denotes the average of main charge curve and discharge curve. The hysteresis modeling (18) is introduced in [20] as a part of enhanced self correcting model (ESC). The hysteresis effect is very complicated process and there is certain difficulty for modeling it, we refer to [20] and [21] for detailed discussions. The parameters M 0 , M and η should be estimated in an offline way for measured values of OCV − f (SOC). Therefore, the dynamic state-space model of a battery is written as The equations (19a) and (19b) are the state equations and (19c) is the output equation for KF algorithm. Note that V RC [k] is not included as one of battery states compared to the original model introduced in [20], since it is determined already.

IV. TEST WITH LITHIUM-ION "E2" CELL
In this section, the results of experimental tests of the proposed method are given for real data obtained from [20]. We compared the performance of the proposed method with that of EKF and SPKF reported in [20], where the parameters were extracted without considering SOC dependence. The tests are executed for lithium-ion "E2" cell with the temperature T = 5 • C and T = 25 • C. The battery's current and terminal voltage is displayed in Fig.2. This data is obtained by repeatedly exercising the "urban dynamometer drive schedule" (UDDS) profile. There are around 720 seconds of rest time after each UDDS profile exercise. Fig.4 shows the charge and discharge curves at the temperatures T = 5 • C and T = 25 • C. In order to estimate M, M 0 and η in (18) in an offline way, the following procedure was performed. Starting from the end of rest time, the parameter estimation algorithm (10), (11), (13), (14) and (15) [20].  Table II). This task is performed with the help of lsqcurvefit tool in Matlab by splitting the linear and nonlinear parts. 2, 3-d columns of Table II show the values of M, M 0 estimated linearly for η 25 = 39.6, η 5 = 64.4, which are taken as the averages of estimated values η for each temperature. We observe that for the case T = 25 • C the instantaneous hysteresis parameter M 0 is estimated significantly compared with that reported in [19]. This is because the rectangle rule for integral used in (9) captures the instantaneous hysteresis more efficiently, whereas the trapezoidal rule for integral was used instead in [19]. Another effect observed in Table II is hysteresis level for T = 5 • C is higher than for T = 25 • C, which is expected, since the battery dynamics is more severe in cooler temperatures. Let us denote the EKF and SPKF based on (10), (11), (13), (14), (15), (19a) and (19b) by ES-EKF and ES-SPKF respectively. Fig.5 shows the estimated parameters and time window sizes with excitation level 790. The values of R 0 , R and C reported in [20] are held constant and shown in Table I. The noise covariances Σ w = 0.2 and Σ v = 0.2, which are used for SPKF and EKF in [20], are also used for ES-SPKF in order to compare their performances. However, the measurement equation of ES-LKF is quite different in the form from that of ES-SPKF, SPKF and EKF. Thus, we found the value Σ v = 1.6207e − 4 by trial-and-error. The performances of the methods ES-Ah, ES-LKF, ES-SPKF, SPKF and EKF are compared in Table III    in Fig.7. The method ES-SPKF outperforms all the others. This improvement can be explained by three ideas proposed in this work. First, the nonlinearity in battery dynamics localized efficiently and the parameters are extracted online as in Fig.5   (19b) in KF alforithm. Third, the hysteresis parameters are extracted in a way such that they depend on SOC as in Table  II.

V. TEST WITH NMC532/GRAPHITE POUCH CELL
This section presents the test results for NMC532/Graphite pouch cell. A pouch cell consists of a graphite anode, and NMC532 (LiNi0.5Mn0.3Co0.2O2) cathode, where each 21 and 20 two-side coated anode and cathodes are stacked as zig-zag stacking method as in Fig.8. This stacked anodes and cathodes are wrapped by Al pouch film with liquid electrolyte. The cell operating voltage range is 3.0 -4.25V and the maximum continuous charge/discharge current is 0.7C.  Model name of charge and discharge cycler is WBCS 3000s from Won-A Tech (S. Korea). The control voltage range is ±5V and the maximum current is 1A per each channel. The test equipments are shown in Fig.9ab. The charge and discharge curves (Fig.10) are obtained by C/30 current test. All tests are conducted in 25 • C temperature. For dynamic tests, we exercised the dynamic current profile (shown partially in Fig.11) 40 times starting from the initial SOC value of 1, and the last SOC value is 0.68. This dynamic current profile is different from the UDDS profile considered in previous section. As we see from Fig.11, it consists of short constant current intervals. The estimated hysteresis parameters M 0 , M and η for different SOC values are tabulated in Table.IV and M and M 0 linearly estimated parameters for η = 6.5411, which is the average value of η. We see that the parameter M is extracted appropriately. However, instantaneous hysteresis parameter M 0 is estimated with very small negative values. This tells us instantaneous hysteresis has some small reverse effect for constant current profile, if we compare it to the previous section, where the considered UDDS current profile has many sudden jumps. Consequently, it says instantaneous hysteresis could have different characteristics depending on the current history. Nevertheless, it's effect on overall SOC estimation is very little and some comparisons were made in [19]. In Fig.12, the extracted parameters R 0 , R, C, a, b and window sizes with excitation level 53 are graphed against the number of window. The variability of R 0 and R are clearly shown, while C takes the average value of 434 most of the times. In Fig.13, the estimated OCV (purple) and the terminal voltage V (light blue) are graphed for the same time interval as in Fig.11. Compared the magnitudes of OCV and V , it is seen that the dynamics of electrical circuit model explains much part of the terminal voltage. Ideally, if SOC-  OCV relation is just one curve (that is there is no hysteresis effect), one would expect the estimated OCV is smooth piecewise lines that coincides with SOC-OCV curve. However, as seen in Fig.13, the identified OCV values are not exactly piece-wise lines because of the hysteresis effect. Based on the estimated hysteresis parameters in Table.IV, we see this remaining voltage difference is modeled with enough accuracy by the hysteresis model (18). Finally, the results of SOC estimation are presented in Table.V. The methods ES-Ah and ES-LKF are almost equally performed as expected. The reasons behind this better performances of these methods are the battery type, temperature and uncertainty involved. The RMS of 1% is in acceptable range for some applications. We think more research is needed in this direction. The noise variances for KF-based estimations are, experimentally, found to be Σ w = 5e − 4 and Σ v = 2e − 4. The error bounds for ES-SPKF and ES-EKF are presented in Fig.14  experiment. The error decreases to some level starting from initial uncertain SOC value and uncertainty tends to grow. This is because the gap between charge and discharge curve widens to the middle and shrinks to both ends. We know the OCV value depends on history of currents and we modeled the hysteresis by some displacement (M , M 0 ) from the average OCV = f (SOC). Therefore, the modeling error increases to the middle of SOC and decreases to both ends.

VI. CONCLUSION
Online parameter identification and KF-based battery SOC estimation technique were proposed for an electrical battery model. Firstly, modeling the SOC-OCV relation locally linear on the fly, we perform a simple linear estimation algorithm on each time window and extract battery parameters R 0 , R, C, a, b and OCV [k 0 ]. This procedure lets us obtain values of OCV . In the next phase, KF algorithm is executed to estimate the SOC with fewer state equations. Extensive experimental tests are conducted for the real data obtained in the designated labs. The KF-based methods with hysteresis parameters estimated with SOC dependence perform better than the other methods considered previously. Besides SOC, an important indicator of the battery's performance, which is also among the states BMS monitors, is the state of health (SOH). SOH, in some sense, can be defined by the increase of resistance R 0 and the decrease of total capacity Q. While the resistance R 0 can be estimated online as in the section II, the estimation of Q is not straightforward and requires more effort. In the next phase of this research, we plan to devise an algorithm to estimate SOH based on the special discretization considered in this work.