In the rapidly evolving domain of electric vehicles (EVs) and renewable energy storage, the lithium ion battery stands as a cornerstone technology due to its high energy density, long cycle life, and declining cost. Accurate estimation of the State of Charge (SOC) for lithium ion batteries is paramount, as it directly influences battery management system (BMS) decisions, ensuring operational safety, optimizing performance, and preventing detrimental states like overcharge or deep discharge. The SOC, defined as the ratio of remaining capacity to nominal capacity, is not directly measurable and must be inferred from observable signals such as terminal voltage, current, and temperature. However, the inherent nonlinearities, time-varying parameters, and complex electrochemical dynamics of lithium ion batteries make SOC estimation a non-trivial challenge. Traditional approaches, including the ampere-hour (Ah) integral method and open-circuit voltage (OCV) method, suffer from error accumulation, sensitivity to initial conditions, and inadequate dynamic response. Consequently, model-based estimation techniques, particularly those rooted in state-space frameworks and advanced filtering theory, have gained prominence. In this work, I present a comprehensive study on enhancing SOC estimation accuracy for lithium ion batteries by innovatively integrating Proportional-Integral-Derivative (PID) control principles into the H∞ filtering framework. This PID-type H∞ filter (PID-HIF) is designed to improve robustness against model uncertainties and noise while leveraging the predictive capabilities of PID action to refine state updates.
The foundation of any model-based SOC estimator is a reliable mathematical representation of the lithium ion battery. Among various modeling paradigms, equivalent circuit models (ECMs) offer a favorable balance between computational tractability and physical interpretability. For this research, I adopt a second-order RC ECM, which effectively captures major dynamic behaviors such as ohmic loss, electrochemical polarization, and concentration polarization. The model comprises an ideal voltage source representing the open-circuit voltage (UOC), an ohmic resistor (R0), and two parallel RC branches: one for short-term transient response (Ra, Ca) and another for long-term dynamics (Rb, Cb). The governing equations are derived from Kirchhoff’s laws. The terminal voltage UL is expressed as:
$$U_L = U_{OC} – U_a – U_b – I_L R_0$$
where IL is the load current (positive for discharge, negative for charge), and Ua and Ub are the voltages across the two RC networks. The differential equations describing the RC network dynamics are:
$$\frac{dU_a}{dt} = -\frac{U_a}{R_a C_a} + \frac{I_L}{C_a}$$
$$\frac{dU_b}{dt} = -\frac{U_b}{R_b C_b} + \frac{I_L}{C_b}$$
The SOC is intrinsically related to the net charge transfer and is commonly updated via the coulomb counting principle:
$$\text{SOC}(t) = \text{SOC}(t_0) – \frac{1}{Q_n} \int_{t_0}^{t} \eta I_L(\tau) d\tau$$
Here, Qn is the battery’s nominal capacity (in ampere-hours), and η is the coulombic efficiency, often assumed to be 1 for discharge and slightly less than 1 for charge. To implement this in a digital estimator, the continuous-time model is discretized with a sampling period T. Defining the state vector as x(k) = [Ua(k), Ub(k), SOC(k)]T, the input as u(k) = IL(k), and the output as y(k) = UL(k), the discrete state-space equations are:
$$
x(k+1) =
\begin{bmatrix}
e^{-T/\tau_a} & 0 & 0 \\
0 & e^{-T/\tau_b} & 0 \\
0 & 0 & 1
\end{bmatrix}
x(k) +
\begin{bmatrix}
R_a(1 – e^{-T/\tau_a}) \\
R_b(1 – e^{-T/\tau_b}) \\
-\frac{\eta T}{Q_n}
\end{bmatrix}
u(k) + w(k)
$$
$$
y(k) = \begin{bmatrix} -1 & -1 & \frac{\partial U_{OC}}{\partial \text{SOC}} \end{bmatrix} x(k) – R_0 u(k) + v(k)
$$
where τa = RaCa and τb = RbCb are time constants, and w(k) and v(k) represent process noise and measurement noise, respectively. The partial derivative ∂UOC/∂SOC is obtained from the OCV-SOC relationship, which is characteristic of the specific lithium ion battery chemistry. For the lithium iron phosphate (LFP) battery studied here, this relationship is highly nonlinear and is determined empirically.

The OCV-SOC characterization is critical for the model’s accuracy. Through experimental testing, I established ninth-order polynomial fits for the charge and discharge curves of the lithium ion battery. These fits are:
For discharge:
$$U_{OCD}(S) = 1813.4 S^9 – 8629.9 S^8 + 17435 S^7 + 19595 S^6 + 13285 S^5 – 5570.7 S^4 + 1419.9 S^3 – 208.1 S^2 + 15.953 S + 2.7228$$
For charge:
$$U_{OCC}(S) = 3060.5 S^9 – 13713 S^8 + 25909 S^7 – 26862 S^6 + 16655 S^5 – 6310.9 S^4 + 1434.4 S^3 – 185.1 S^2 + 12.471 S + 2.9002002$$
where S denotes the SOC (ranging from 0 to 1). These polynomials provide a precise mapping necessary for linearizing the output equation in the filter design.
With the model established, the focus shifts to the SOC estimation algorithm. The Extended Kalman Filter (EKF) is a common choice for nonlinear systems but assumes known Gaussian noise statistics, which may not hold in practical lithium ion battery applications. To enhance robustness, I initially employ the H∞ filter (HIF), which minimizes the worst-case estimation error without stringent noise assumptions. The H∞ filtering problem is formulated by considering the following discrete-time linear system (obtained after linearizing the nonlinear model around the current state estimate):
$$
x(k) = A(k-1)x(k-1) + B(k-1)u(k-1) + w(k-1)
$$
$$
y(k) = C(k)x(k) + D(k)u(k) + v(k)
$$
$$
z(k) = L(k)x(k)
$$
Here, z(k) is the linear combination of states to be estimated (in our case, z(k) = SOC(k), so L(k) = [0, 0, 1]). The matrices A, B, C, D are derived from the discretized model. The performance of the H∞ filter is evaluated via a cost function J that balances the estimation error against the disturbances:
$$
J = \frac{\sum_{k=0}^{N} \| z(k) – \hat{z}(k) \|^2_{S(k)}}{\| x(0) – \hat{x}(0) \|^2_{P^{-1}(0)} + \sum_{k=0}^{N} \left( \| w(k) \|^2_{Q^{-1}(k)} + \| v(k) \|^2_{R^{-1}(k)} \right)}
$$
The matrices S(k), P(0), Q(k), and R(k) are symmetric positive definite weighting matrices chosen by the designer. The objective is to find an estimate ẑ(k) such that the supremum of J over all admissible disturbances is minimized. This leads to the recursive H∞ filtering equations:
$$
\hat{x}(k|k-1) = A(k-1) \hat{x}(k-1|k-1) + B(k-1) u(k-1)
$$
$$
P(k|k-1) = A(k-1) P(k-1|k-1) A^T(k-1) + Q(k-1)
$$
$$
H(k) = P(k|k-1) C^T(k) \left[ C(k) P(k|k-1) C^T(k) + R(k) \right]^{-1} \quad \text{(for standard form, but in H∞, it’s more complex)}
$$
However, the standard H∞ filter recursion involves a Riccati equation with a performance bound parameter γ (or δ). The exact formulation I used is based on the game theory approach, where the filter gain H(k) is computed as:
$$
H(k) = A(k) P(k|k-1) \left[ I – \delta S(k) P(k|k-1) + C^T(k) R^{-1}(k) C(k) P(k|k-1) \right]^{-1} C^T(k) R^{-1}(k)
$$
$$
\hat{x}(k|k) = \hat{x}(k|k-1) + H(k) \left( y(k) – C(k) \hat{x}(k|k-1) – D(k) u(k) \right)
$$
$$
P(k|k) = P(k|k-1) \left[ I – \delta S(k) P(k|k-1) + C^T(k) R^{-1}(k) C(k) P(k|k-1) \right]^{-1}
$$
where δ > 0 is a scalar chosen to satisfy the condition:
$$
P^{-1}(k|k-1) – \delta S(k) + C^T(k) R^{-1}(k) C(k) > 0
$$
This ensures the existence of a solution. While this H∞ filter offers robustness, I observed that its state update relies solely on the current innovation (i.e., the difference between measured and predicted output), potentially making it less responsive to trends and accumulated errors. To address this, I introduce a PID controller structure into the innovation processing. The core idea is to modify the state update equation by incorporating not only the current innovation but also its integral and derivative, thereby providing a more comprehensive correction mechanism.
Let the innovation sequence be defined as e(k) = y(k) – ŷ(k|k-1) = y(k) – [C(k) ẋ(k|k-1) + D(k) u(k)]. In the conventional H∞ filter, the update is ẋ(k|k) = ẋ(k|k-1) + H(k) e(k). In the proposed PID-type H∞ filter (PID-HIF), the update law is augmented as follows:
$$
\hat{x}(k|k) = \hat{x}(k|k-1) + H(k) \left\{ K_P e(k) + K_I \sum_{i=0}^{k} e(i) + K_D [e(k) – e(k-1)] \right\}
$$
To reduce computational load and avoid integral windup, I employ a practical incremental form. Define Δe(k) = e(k) – e(k-1) and Δ²e(k) = e(k) – 2e(k-1) + e(k-2). Then, the PID-controlled update can be written as:
$$
\hat{x}(k|k) = \hat{x}(k|k-1) + H(k) \left[ K_P e(k) + K_I \Delta e(k) + K_D \Delta^2 e(k) \right]
$$
where KP, KI, and KD are diagonal matrices of proportional, integral, and derivative gains, respectively. For simplicity and given that the primary state of interest is SOC, these gains are tuned as scalars focused on the SOC channel. After extensive simulation and empirical tuning on lithium ion battery data, I arrived at the values: KP = 0.010, KI = 0.001, KD = 0.200. These values were found to provide a balanced response, improving accuracy without introducing instability. The PID-HIF algorithm thus combines the disturbance attenuation properties of H∞ filtering with the anticipatory and corrective actions of PID control, leading to superior SOC tracking for lithium ion batteries.
To validate the proposed PID-HIF algorithm, I conducted rigorous experiments on a commercial lithium iron phosphate (LFP) lithium ion battery (model IFP26374816D) with a nominal capacity of 36 Ah and a nominal voltage of 3.2 V. A BTS-4000 battery test system was used to apply precise charge-discharge profiles and record voltage, current, and temperature data. The test protocols included a constant-current discharge test and a Dynamic Stress Test (DST), the latter designed to simulate realistic EV driving cycles with varying current magnitudes and signs. Prior to SOC estimation, online parameter identification was performed using an Adaptive Forgetting Factor Recursive Least Squares (AFFRLS) algorithm to estimate the model parameters (R0, Ra, Ca, Rb, Cb) in real-time, accounting for the lithium ion battery’s changing characteristics.
The initial SOC for all filters was intentionally set to 1.0 (100%), while the true initial SOC was 100% for the discharge test and varied for the DST according to the protocol. The noise covariance matrices were chosen as Q = diag([10-7, 10-7, 10-7]) and R = 10-1, reflecting the confidence in the model and measurements. The performance bound parameter δ was set to 104, and S(k) was chosen as the identity matrix. The algorithms were implemented in MATLAB, and the SOC estimates were compared against a reference SOC derived from high-precision coulomb counting with periodic OCV resets (considered as ground truth).
For the constant-current discharge test, the lithium ion battery was discharged at a steady current until the cutoff voltage was reached. The SOC estimation results from the EKF, HIF, and PID-HIF algorithms are quantitatively summarized in Table 1, which lists the maximum absolute error and the root mean square error (RMSE).
| Algorithm | Maximum Absolute Error (%) | Root Mean Square Error (RMSE) (%) |
|---|---|---|
| Extended Kalman Filter (EKF) | 2.3475 | 3.3753 |
| H∞ Filter (HIF) | 1.7547 | 2.4158 |
| PID-type H∞ Filter (PID-HIF) | 1.4213 | 0.7393 |
The data clearly indicates that the standard H∞ filter outperforms the EKF by reducing the RMSE from 3.3753% to 2.4158%, showcasing its robustness. However, the introduction of PID control further cuts the RMSE dramatically to 0.7393%, an improvement of about 1.6765 percentage points over the HIF and 2.6360 points over the EKF. This underscores the efficacy of the PID enhancement in refining the state update mechanism for lithium ion battery SOC estimation.
To evaluate performance under more strenuous and dynamic conditions, the DST profile was applied. This profile consists of multiple segments with rapid current fluctuations, including charge and discharge pulses, closely mimicking real-world load variations on a lithium ion battery. The SOC estimation errors for the DST are compiled in Table 2.
| Algorithm | Maximum Absolute Error (%) | Root Mean Square Error (RMSE) (%) |
|---|---|---|
| Extended Kalman Filter (EKF) | 2.8967 | 4.1038 |
| H∞ Filter (HIF) | 1.9649 | 2.4141 |
| PID-type H∞ Filter (PID-HIF) | 0.5196 | 0.0694 |
The results are even more compelling. Under the dynamic stress test, the PID-HIF achieves an exceptionally low RMSE of 0.0694%, compared to 2.4141% for HIF and 4.1038% for EKF. This represents an RMSE reduction of 2.3447 percentage points relative to HIF and 4.0344 points relative to EKF. The maximum absolute error is also minimized to 0.5196%, indicating that the PID-HIF maintains high accuracy even during aggressive transients. The superior performance of PID-HIF can be attributed to its ability to leverage past error information (via integral action) and anticipate future trends (via derivative action), thereby providing a more nuanced correction than the purely proportional update of the standard H∞ filter. This is particularly beneficial for lithium ion batteries, where SOC dynamics can be swift and nonlinear.
To further elucidate the algorithm’s behavior, I analyzed the convergence properties and computational complexity. The PID-HIF inherits the stability conditions of the H∞ filter, requiring the Riccati inequality to hold. With properly tuned gains, the addition of the PID terms does not destabilize the filter; instead, it accelerates convergence and reduces steady-state error. In terms of computation, the PID-HIF requires a few extra additions and multiplications per cycle compared to the standard HIF, but this overhead is negligible given modern microcontroller capabilities in BMS applications. The online parameter identification via AFFRLS adds another layer of adaptability, ensuring the model remains accurate as the lithium ion battery ages or operates under different temperatures.
The implications of this work extend beyond academic interest. Accurate SOC estimation is vital for optimizing the performance and lifespan of lithium ion batteries in electric vehicles, grid storage, and portable electronics. By reducing SOC estimation errors to below 1% RMSE under dynamic conditions, the PID-HIF algorithm can enable more precise battery state awareness, leading to better charge control, enhanced safety, and potentially longer battery life. For instance, with a more reliable SOC estimate, a BMS can more accurately determine the remaining driving range, implement efficient cell balancing, and avoid operating in stressful regions that accelerate degradation of the lithium ion battery.
In conclusion, this study has presented a novel PID-type H∞ filtering algorithm for the state of charge estimation of lithium ion batteries. Building on a well-established second-order RC equivalent circuit model, I demonstrated that while the H∞ filter offers improved robustness over the EKF, its accuracy can be significantly enhanced by incorporating PID control logic into the state update step. Experimental validation on a commercial LFP lithium ion battery under both constant-current and dynamic stress tests confirmed the superiority of the proposed PID-HIF. It achieved root mean square errors as low as 0.7393% in discharge tests and 0.0694% in dynamic tests, substantially outperforming both EKF and standard HIF. Future work will focus on extending this approach to estimate additional states, such as state of health (SOH), and testing the algorithm under wider temperature ranges and across different lithium ion battery chemistries. Furthermore, adaptive tuning of the PID gains and the H∞ performance bound could be explored to optimize performance throughout the entire lifespan of the lithium ion battery.
