Implementation of SOH Estimator in Automotive BMSs Using Recursive Least-Squares

: This paper presents a computationally e ﬃ cient state-of-health (SOH) estimator that is readily applicable to automotive battery management systems (BMSs). The proposed scheme uses a recursive estimator to improve the original scheme based on a batch estimator. In the batch process, state estimation requires signiﬁcantly longer CPU time than data measurement, and the original scheme may fail to satisfy real-time guarantees. To prevent this problem, we apply recursive least-squares. By replacing the batch process to solve the normal equation with a recursive update, the proposed scheme can spread CPU utilization and reduce memory footprint. The beneﬁts of the recursive estimator are quantitatively validated by comparing its CPU time and memory footprint with those of the batch estimator. A similar level of SOH estimation accuracy is achievable with over 60% less memory usage, and the CPU time stabilizes around 5 ms. This enables implementation of the proposed scheme in automotive BMSs. the recursive estimator is introduced. It is expected to exhibit higher BMS-applicability in on-line monitoring of SOH.


Introduction
It is established that lithium-ion batteries (LIBs) have been the predominantly used type for vehicle electrification. Battery electric vehicles (BEVs) powered by LIBs were first produced in-series and sold to the public, six to seven years back. By the end of 2018, the cumulative global sales of BEVs had reached four million units. In 2011, global EV sales were approximately 50,000 units, and seven years later, they increased over 80-fold. This high volume of BEV sales is primarily owing to the continuous increase in the energy density of LIBs. For example, the second generation (2018 model year) of Nissan Leaf features a 40 kWh battery pack with a range of 243 km on a single charge. The pack is made of 192 cells, with an energy density of 224 Wh/kg (460 Wh/l) per cell. This is equivalent to an increase in energy density by over 40% because the cell energy density of the first generation (2011 model year) is 157 Wh/kg (317 Wh/l) [1].
However, LIBs are subject to energy and power loss as they age. Compared to power loss, capacity loss is conveniently noticed by BEV owners because it is directly related to distance-to-empty. There are no specific data on the number of units that start to exhibit a shorter range because of lower capacity. However, it probably becomes more common from earlier deliveries. The aging mechanisms of LIBs in service are complicated to characterize. This is attributable mostly to the interplay of different operational factors. Nonetheless, their aging level is more or less straightforwardly indicated by a battery performance metric: the state-of-health (SOH). With regard to energy, the SOH typically represents the present capacity with respect to the nominal capacity. The capacity of LIBs can be measured conveniently with battery testers in a process of constant current charging at a specified state estimation will consume significantly longer CPU time than the data measurement. Accordingly, it is challenging for batch estimators to level off CPU utilization, whereas recursive estimators can do it straightforwardly. This is considered a benefit of the RLS, specifically for CPU utilization (see Figure 1). With regard to memory footprint, multiple and long vectors are not necessary for a recursive process. In contrast, a batch process typically requires the vectors of measurements, estimates, residuals, and Jacobian. Specifically for the WLS, the vectors of weights are added to them. As previously stated, different weights need to be applied to each of the data points because they are not equally reliable for the SOH estimation. This requirement could be realized simply by using a forgetting factor in the RLS. Thus, we expect to achieve higher applicability of the SOH estimator to computationally inexpensive BMSs, by means of the RLS.   Figure 1. Comparison of (a) batch estimator and (b) recursive estimator in terms of their BMS implementation. The batch estimator exhibits a nonuniform execution time in that the time required for the state estimation is significantly longer than that for the data measurement. Furthermore, the batch estimator exhibits an uncertain execution time as the time required for convergence is not guaranteed. To prevent these drawbacks, the recursive estimator is introduced. It is expected to exhibit higher BMS-applicability in on-line monitoring of SOH.

Reviewing the Original Scheme
Before addressing a recursive estimator, we briefly revisit the original scheme based on a batch estimator. In the process of the original scheme, we utilize several types of batch estimators. Thereby, we could estimate the state and parameters of the battery model (see Table 1).

Linear Least-Squares
As presented in Table 1, linear least-squares is applied to estimate parameters in the battery model. In this paper, we will call it ordinary least-squares (OLS) in contrast with weighted least-squares (WLS). As discussed earlier, the original scheme exploits changes in the shape of the charge curve with respect to the SOH. This complex relationship can be captured conveniently with the battery model through metamodeling. A series of reformulations of the charge curve finally yields the battery model in the form of the times elapsed to reach target voltages with respect to the SOH. Accordingly, the battery model is reformulated in the form of a second-degree polynomial as where the values of the parameters a k,p (k = 1-n, p = 1-3) are determined by the corresponding target voltages V k (k = 1-n). Equation (1) can be expanded as where n = 13 as the target voltage increases from 3650 to 3950 mV at 25 mV intervals. For example, the time required to reach the first target voltage V 1 (3650 mV) is predicted as t 1 = a 1,1 + a 1,2 × SOH + a 1,3 × SOH 2 . Hence, the values of the parameters a 1,p corresponded to their target voltage V 1 . Similarly, the time required to reach the final target voltage V 13 (3950 mV) is t 13 = a 13,1 + a 13,2 × SOH + a 13,3 × SOH 2 . This can be also expressed as If formally organized, suppose a k,1 , a k,2 , a k,3 T = H k is a constant yet unknown parameter vector; 1, SOH, SOH 2 = (x 1 , x 2 , x 3 ) = x is a known state vector; and t k = y k is a noisy measurement. As the parameters of the reformulate model are linear, y can be a linear combination of x with the addition of certain measurement noise ν. Accordingly, Equation (3) can be generalized as This section describes determination of the best estimate H k of H k by using the linear OLS. Given the state vector x, the difference between the measured values and predicted values, namely, the prediction error, is described as From the perspective of least-squares, the value of H k that minimizes the cost function is obtained by The minimum of Equation (6) can be determined by setting the derivative of the cost function with respect to H k as zero ∂cost H k The solution of Equation (7) results in a normal equation that enables us to estimate H k Provided x T x is non-singular and invertible, the solution takes the form where the measurement y k is obtained from battery cells at different SOHs ranging from 100 to 70%, which corresponds to the state x. As shown in Figures 7 and 10 in [15], the shape of the charge curve is affected by the SOH as well as other operational factors before charging, including the duty cycle, rest time, SOC, and temperature. Thus, the values of the contributing factors other than SOH are carefully selected and fixed while measuring the training data. Thereby, they represent various real-world conditions that LIBs for BEVs undergo (see Table 2). The resulting parameter vector H k by means of the linear OLS is tabulated in Table 3.

Non-Linear Least-Squares
The parameters in the reformulated model are determined by employing the linear OLS. Thus, our battery model becomes ready for use. Because the battery model is non-linear in its state, i.e., SOH, Equation (1) can be expressed with a non-linear function of h as The previous section described the determination of the values of the parameters a k,p (k = 1-n, p = 1-3) (see Table 3). Because they are determined by the corresponding target voltages V k (k = 1-n), Equation (10) can be rewritten as If formally stated, suppose SOH = x is an unknown state; and t k = y k is a noisy measurement at the corresponding voltages V k . Equation (11) can be generalized as This section describes our determination of the best estimate x of x by using the non-linear OLS. For such non-linear systems, the normal equation in Equation (9) needs to be modified as where the state x is estimated by successive approximation, x = x + ∆ x. The Jacobian matrix J in Equation (13) is defined as where J is in the form of a single column vector because the state x is a scalar value. The measurement y k in Equation (13) is acquired from battery packs in use for a fleet of BEVs. This is distinct from the training data whose preparation was described in the previous section. Now, we validate the parameterized model and its state estimator, i.e., the non-linear OLS. To achieve this, such noisy measurements are necessary, which will reflect randomly specified real-world conditions. We call it test data, in contrast to the training data. As shown in Figure 12 in [15], our validation concludes that the OLS is not reliable against the test data as it fails to satisfy the requirements, including that of an estimation error less than 3%. This is primarily owing to the measurements with significant noise, which correspond to the shape of the charge curve distorted by the uncontrolled operational factors before charging. It is also illustrated that the early part of the charge curve is more vulnerable to being noisy. This can be interpreted as the early part being less reliable than the later part. In order to provide higher weights to more reliable data points on the later part of the charge curve, we introduce the WLS in the next section.

Weighted Least-Squares
The battery model is equivalent to Equation (1). However, in this section, we assume the measurements to be unequally reliable. This is reflected in test data. Suppose the noise for each measurement ν k (k = 1-n) has zero mean and is independent of each other. Then, the covariance matrix for all the measurement noise can be represented as The prediction error is considered as before. Thus, the residual vector is = (ε 1 , ε 2 , · · · , ε n ) T . For the WLS, the cost function to be minimized is the summation of squared residuals weighted divided by the error variance: At a minimum, the partial derivative of the cost function should vanish, so that Equation (17) is solved to obtain the normal equation that enables us to estimate the state x against the unequally reliable measurement y: Replacing R −1 with the weight vector W yields Again, for similar non-linear systems, the normal equation in Equation (19) is modified as As shown in Figure 12 in [15], our validation concludes that the WLS is reliable against the test data as it is capable of satisfying the requirements including an estimation error less than 3%. By providing more weights to the later part of the charge curve, where the data points are more reliable that those in the early part, the estimation error is reduced by 7.8% point.

Problem Statement
With reference to the implementation of the WLS to BMSs, we could identify scope for further improvement. This is motivated primarily by our need for an alternative state estimator that exhibits higher BMS-applicability than the WLS, while being as reliable as the WLS.
For on-line state estimation, a recursive process tends to be preferred over a batch process. This is true also for SOH estimation. For the BMS, SOH estimation is one of its multiple tasks. Therefore, the implemented SOH estimator is required to run in conjunction with other tasks within a common timeframe. To process multiple tasks using a single-core processor, a scheduler is necessary to decide the task to be executed next. A scheduler in the BMS assigns a timeslot to each task in equal portion and in circular order, thereby processing multiple tasks without priority. We generally call it a round-robin scheduler. A default timeframe common to all the tasks is set to 10 ms. Tasks that need to be executed at higher frequency are assigned at every 10 ms timeslot. The 10 ms tasks primarily include cell monitoring. For example, the voltages from every 96 cells are measured at every 10 ms interval. The current is measured similarly. Such cell monitoring generally consumes less than 2 ms out of the 10 ms timeslot. Tasks that may run at lower frequencies are assigned once every ten 10 ms timeslots. This operates in conjunction with the 100 ms timeslot. The 100 ms tasks involve, for example, battery state estimation. SOH estimation belongs to this category. The SOC and internal resistance are also predicted at every 100 ms interval. Taking into account the relatively slow dynamics of battery states, the 100 ms intervals are considered timely. Within the 10 ms timeslot, the 100 ms tasks are assigned after the 10 ms tasks. This implies that the 100 ms tasks should be performed during the time remaining within the 10 ms timeslot, which is at most approximately 5 ms with a time margin of safety (see Figure 2). If the 100 ms tasks run out of time, the task to be run next lags behind schedule. Thus, a scheduler in the BMS fails to satisfy real-time guarantees. The problem we are concerned with is the vulnerability of batch estimators to this failure.  As previously noted, the implemented SOH estimator comprises two steps: data measurement and state estimation. As SOH estimation is a 100 ms task, the time periods available to each of these is 5 ms. However, the execution times required to complete them are unequal. The data measurement typically consumes approximately 2 ms or less, whereas the state estimation generally uses up the maximum permitted time and occasionally exceeds it. This is mainly because the state estimation incurs longer CPU time than the data measurement does. During the data measurement, the times consumed for reaching the target voltages are measured and then stored in the measurement vector. In contrast, the state estimation is supposed to address computationally denser tasks in the provided time. During the state estimation, the times required to reach the target voltages are first predicted from the battery model and then stored in the estimate vector. The residual vector is produced by subtracting the estimate vector from the measurement vector. Next, the weight vector is produced by taking the reciprocal of the residual vector. Then, the Jacobian, the partial derivative of the residual vector, is numerically calculated. With the calculated Jacobian, the state is updated iteratively until it converges. As a consequence, the execution time required for the state estimation is significantly longer and more uncertain than that required for the data measurement. This is more likely to break real-time guarantees.
This potential albeit critical problem could be addressed by applying a recursive estimator to on-line state estimation. In the following section, we introduce recursive least-squares (RLS) that aids in spreading the computational costs across consecutive timeslots, which is crucial to the BMS implementation.

Introducing the Revised Scheme
Similar to the original scheme, the revised scheme captures the shape of the charge curve varying with the SOH. However, rather than the batch estimators, a recursive estimator is employed, expecting its higher applicability to on-line monitoring of the SOH. Suppose we estimate a state x k−1 after k − 1 measurements and then obtain a new measurement y k . Using the RLS, we update x k−1 to x k without requiring the solving of the normal equation in Equations (9) or (20), which is computationally intensive.
We first observe the final form of the RLS: where the gain vector K k corrects the previous state x k−1 with the one-step-ahead prediction error y k − x k−1 H k . That is, the new state x k is corrected from the previous state x k−1 by the gain vector K k .
With the aim of deriving Equation (21), the normal equation in the previous section is rewritten in the recursive context, so that Provided that H k H T k is non-singular and invertible, the solution takes the following form: Reformulating with P k and b k yields where P k = H k H T k −1 and b k = H k y k . In the recursive perspective, P k and b k can be described with the previous P k−1 and b k−1 , respectively: Equation (25) is rearranged as Then, multiplying by x k yields Multiplying this by 1 + x T k P k−1 x k −1 x T k P k−1 yields Substituting Equations (27), (29) is formulated as Now, substituting Equations (26) and (30) into Equation (24) yields Noting that x k−1 = P k−1 b k−1 , Equation (31) can be expanded to yield with the gain vector As the WLS mitigates the effect of obsolete measurements on the state estimation, the RLS is also expected to do so. As aforementioned, this is mainly related to the fact that not all measurements are equally reliable. The early part of the charge curve is subject to being noisier than the later part because it is more exposed to the effect of the operational factors before charging. For recursive estimators, there are generally two options to provide higher weights to more reliable data points.
One is commonly called a moving rectangular window, and the other is an exponentially weighted window (see Figure 3a,b). The second option is selected in this work as it functions more similarly to the WLS. As its name indicates, the exponentially weighted window can provide progressively higher weights to the more current data points. Thereby, it causes the state estimation to be more sensitive to recent changes in the shape of the charge curve. By applying an exponential forgetting factor α, the gain vector K k in Equation (33) is modified as with the covariance matrix In Equations (34) and (35), α is relevant to a decay time constant τ by where ∆t is a time interval within data points (see Figure 3c). A more detailed description of RLS is available in [18].

Experimental Validation of the Revised Scheme
In this section, we describe the experimental validation of the revised scheme from two aspects. One is from the perspective of BMSs. It addresses, for example, the CPU time and memory footprint required to implement the recursive estimator. The other is from the batteries' perspective. It addresses the accuracy of the SOH estimation by using the recursive estimator. Each of these performance metrics of the recursive estimator is compared to those of the batch estimator such that the revised scheme could be evaluated in comprehensive and quantitative terms.
Prior to assessing the revised scheme, we briefly introduce the hardware specification of the BMS used in this work. As described in [15], the previous BMS is not equipped with the floating-point unit (FPU), which is specifically designed to perform floating-point arithmetic. It is established that the RLS exhibits finite precision effects, which causes it to become numerically unstable and eventually fail to converge. In order to run the RLS in a fast, effective, and reliable manner, an FPU-equipped BMS is newly deployed in this work (see Table 4).

BMS Implementation
With the introduction of the RLS, the process of the revised scheme comprises of the iteration of the data measurement, and the state estimation. Before the first measurement (k = 0), we have certain prior information about the state. This becomes our initial state. If we do not have the prior SOH, the initial SOH is set as one. Although this is an unfavorable condition to the SOH estimator, it could occur if the prior SOH stored in a BMS is unavailable, e.g., owing to the battery or its BMS replacement. There is some uncertainty of the initial state. This becomes our initial covariance. The initial covariance is set close to zero, i.e., 1e-4. After the first measurement (k = 1), we sequentially update the state and its error covariance according to (32-35). As noted before, the target voltages are predetermined as 3650-3950 mV at intervals of 25 mV. Thereby, 13 data points are produced. Hence, after the 13th measurement (k = 13), we finalize this update. In order to impose higher weights upon the more recent measurements, a forgetting factor of 0.7 is selected and applied. With these hyper-parameters, the recursive estimator is implemented to the BMS.
It is observed that the implemented recursive estimator is capable of spreading CPU time across consecutive timeslots while guaranteeing real-time execution of tasks (see Figure 4). The recursive estimator exhibits a largely even execution time in the order of 5 ms. In contrast, the batch estimator exhibits a varying execution time ranging from 1 to 8 ms. This is related mainly to its two steps. The data measurement consumes less than 2 ms, whereas the state estimation requires 6-7 ms. It is also observed that the implemented recursive estimator can reduce the memory footprint by over 60%. The batch estimator primarily carries eight long vectors. They include the vectors of measurements, estimates, residuals, weights, and Jacobian. They also include the three parameter vectors. Their column size is 13. Each vector thus consumes 104 bytes (8 bytes × 13 floating-point numbers). Moreover, overall, 832 bytes of RAM are always required during run-time. In contrast, the recursive estimator uses only the three parameter vectors. Thus, only 312 bytes of RAM are occupied. It is observed that this comparison considers only such long vectors that require relatively large arrays. Considering the uniform CPU time and the low memory usage, it is concluded that a recursive process is more readily applicable to the BMS than a batch process is.

SOH Estimation
The test data sets are consistent with those provided in the original work. Two battery packs in use for a fleet of BEVs are employed to provide the test data. Their present capacities are first measured under the standard conditions. The values obtained are 35.8 Ah and 29.6 Ah, respectively. Each of them has a nominal capacity of 42 Ah. Thus, their SOHs are 85.3% and 70.4%, respectively. It is observed that the SOH of the entire pack is determined by the cell that has the least capacity and generally exhibits the largest internal resistance. Then, their present capacities are estimated under randomly specified real-world conditions. With respect to the test data, it is observed that the recursive estimator is as reliable as the batch estimator (see Figure 5); the difference between the two estimators is less than 1%. The difference between the estimate from the recursive estimator and the measurement is also within 1%. The test data is obtained from the battery packs at (a) 85.3% SOH and (b) 70.4% SOH, which is consistent with that presented in Figure 12 in [15].
These results are from the recursive estimator for implementation with hyper-parameters, including a forgetting factor of 0.7. In general, the forgetting factor affects two conflicting properties of a recursive estimator: tracking and convergence. The selection of an effective value for the forgetting factor is thus based on a trade-off between these. It is observed that as the forgetting factor reduces to 0.7, better tracking is achieved (see Figure 6a-d). In contrast, as the forgetting factor decreases below 0.7, lower convergence is observed (see Figure 6e,f). This illustrates that specifically for our problem, a forgetting factor of 0.7 is optimal in that it will aid the RLS in straightforwardly adapting to recent measurements, while preventing the RLS from becoming too sensitive to measurement noise.

Conclusions
In this work, the original scheme based on a batch process is revised, considering its BMS implementation. The original scheme uses the WLS, which requires Jacobian calculation and matrix inversion to solve the normal equation. Therefore, in a batch process, state estimation requires significantly more intensive CPU utilization and larger memory footprint than those for data measurement. This is detrimental to its BMS implementation. By replacing a batch process to solve the normal equation with a recursive update, the revised scheme aids in spreading CPU utilization. The revised scheme also aids in reducing memory footprint because it does not require long and multiple vectors to formulate the normal equation. The advantage of the revised scheme is quantitatively validated against the test data. It is observed that the recursive estimator spends largely uniform execution time in the order of 5 ms. This is in contrast to the batch estimator, which exhibits varying execution time ranging from 1 to 8 ms. Furthermore, it is observed that the recursive estimator occupies more than 60% less memory footprint than the batch estimator does. Notwithstanding such substantial revisions made to the state estimator, a similar level of accuracy of SOH estimation is attained.

Conflicts of Interest:
The authors declare no conflict of interest.