Accurately monitoring the State of Charge (SOC) of lithium-ion batteries is a fundamental requirement for effective Battery Management Systems (BMS). As a carrier for new energy storage, the LiFePO4 battery, with its excellent safety, long cycle life, and stable performance, is a crucial component in implementing strategic energy goals. However, its characteristic flat open-circuit voltage (OCV) plateau poses a significant challenge for model-based SOC estimation algorithms, particularly those in the Kalman Filter family. In this work, I analyze the limitations imposed by LiFePO4 battery characteristics on the classic Extended Kalman Filter (EKF) and propose a novel, robust fusion method that combines Proportional-Integral-Derivative (PID) control principles with the EKF framework to enhance estimation accuracy, convergence speed, and robustness.
The core challenge stems from the intrinsic electrochemical properties of the LiFePO4 battery. Its OCV-SOC curve features an extended, relatively flat region where voltage changes minimally with large variations in SOC. This characteristic directly weakens the observability of the SOC state within a model-based filter. In the EKF algorithm, the state correction is governed by the Kalman gain and the innovation (the error between measured and model-predicted voltage). During the flat voltage plateau, the system’s output matrix, which contains the sensitivity of voltage to SOC ($\frac{\partial U_{oc}}{\partial SOC}$), becomes very small. Consequently, the Kalman gain related to the SOC state diminishes, reducing the algorithm’s ability to correct SOC errors stemming from initial value inaccuracies, model mismatches, or measurement noise. This results in slow convergence and degraded estimation accuracy specifically for LiFePO4 batteries, a problem not as pronounced in battery chemistries with steeper OCV-SOC slopes.
To address this, I developed a combined PID-EKF method. The EKF provides an optimal estimation framework under Gaussian noise assumptions, while the PID controller introduces a complementary correction mechanism that is less dependent on the instantaneous model sensitivity. The fusion is implemented in two key aspects: an initial SOC compensation strategy and an optimized state variable correction process.
The foundation of any model-based algorithm is a reliable battery model. I employ the second-order Thevenin equivalent circuit model for its good balance between complexity and dynamic representation. The model’s state-space equations in discrete form are given by:
$$x_k = \begin{bmatrix} SOC_k \\ U_{1,k} \\ U_{2,k} \end{bmatrix}, \quad A_k = \begin{bmatrix} 1 & 0 & 0 \\ 0 & e^{-\Delta t / (R_1 C_1)} & 0 \\ 0 & 0 & e^{-\Delta t / (R_2 C_2)} \end{bmatrix}, \quad B_k = \begin{bmatrix} -\frac{\eta \Delta t}{C_n} \\ R_1(1 – e^{-\Delta t / (R_1 C_1)}) \\ R_2(1 – e^{-\Delta t / (R_2 C_2)}) \end{bmatrix}$$
The system and measurement equations are:
$$x_{k} = A_{k-1} x_{k-1} + B_{k-1} I_{k-1} + w_{k-1}$$
$$U_{k} = U_{oc}(SOC_k) – U_{1,k} – U_{2,k} – I_k R_0 + v_k$$
where $U_{oc}(SOC_k)$ is the non-linear OCV-SOC relationship, $I$ is the current, $R_0$ is the ohmic resistance, $R_1, C_1$ and $R_2, C_2$ represent polarization and diffusion dynamics, and $w_k$, $v_k$ are process and measurement noise, respectively.

For the LiFePO4 battery under study, the OCV-SOC relationship is identified through a quiet relaxation test and fitted using a high-order polynomial to ensure accuracy across the entire SOC range, especially the plateau. Model parameters ($R_0, R_1, C_1, R_2, C_2$) are identified from test data using a recursive least squares method with a forgetting factor, and they are stored as a function of SOC. A subset of the identification results is summarized in the table below.
| SOC (%) | $R_0$ (mΩ) | $R_1$ (mΩ) | $C_1$ (kF) | $R_2$ (mΩ) | $C_2$ (kF) |
|---|---|---|---|---|---|
| 100 | 29.4 | 23.6 | 0.270 | 25.1 | 10.03 |
| 80 | 29.5 | 5.7 | 0.547 | 33.8 | 7.66 |
| 60 | 29.6 | 6.2 | 0.478 | 29.6 | 11.33 |
| 40 | 29.2 | 5.8 | 0.511 | 42.5 | 7.19 |
| 20 | 29.8 | 7.1 | 0.378 | 52.4 | 5.67 |
| 0 | 30.5 | 7.2 | 0.436 | 270.4 | 2.48 |
The standard EKF algorithm proceeds through prediction and update steps. The weakness for LiFePO4 battery estimation appears in the update step. The state correction is:
$$\hat{x}_k^+ = \hat{x}_k^- + K_k (y_k – \hat{y}_k)$$
$$\hat{y}_k = U_{oc}(\widehat{SOC}_k^-) – \widehat{U}_{1,k}^- – \widehat{U}_{2,k}^- – I_k R_0$$
$$K_k = P_k^- C_k^T (C_k P_k^- C_k^T + R)^{-1}$$
$$C_k = \left[ \frac{\partial U_{oc}}{\partial SOC} \bigg\rvert_{\widehat{SOC}_k^-} \quad -1 \quad -1 \right]$$
When $\frac{\partial U_{oc}}{\partial SOC}$ is near zero in the plateau region, the corresponding element in $C_k$ is small, leading to a small Kalman gain for the SOC state. This means the voltage error $ (y_k – \hat{y}_k)$ has minimal effect on correcting the SOC estimate, leaving it vulnerable to initial errors and noise.
My proposed PID-EKF method introduces two key modifications to counteract this issue.
1. SOC Initial Value Compensation Strategy: A large initial SOC error can cause persistent voltage error. To accelerate convergence, I employ a PID-based observer that acts before and alongside the EKF’s regular operation. A cumulative voltage error over a moving window $W$ is calculated as a more stable indicator than the instantaneous error:
$$E_{c,k} = \sum_{i=k-W+1}^{k} (y_i – \hat{y}_i)$$
If $|E_{c,k}|$ exceeds a predefined threshold (empirically determined based on model characteristics), a significant initial SOC bias is assumed. A compensation is then applied directly to the SOC state estimate using a PD-type correction:
$$SOC_k \leftarrow SOC_k + \left[ K_p^c E_{c,k} + K_d^c (E_{c,k} – E_{c,k-1}) \right]$$
where $K_p^c$ and $K_d^c$ are proportional and derivative gains for compensation. This strategy provides a fast, model-agnostic pull towards the true SOC when a large initial mismatch is detected, greatly improving convergence time.
2. Enhanced State Correction with PID Fusion: The standard EKF correction is augmented with PID terms. The innovation (voltage error) is processed not only by the Kalman gain but also through PID channels to generate an additional correction vector $\Delta x_k^{PID}$. The enhanced update law becomes:
$$\hat{x}_k^+ = \hat{x}_k^- + K_k (y_k – \hat{y}_k) + \Delta x_k^{PID}$$
$$\Delta x_k^{PID} = \begin{bmatrix} K_p^e e_k + K_i^e \Sigma e + K_d^e (e_k – e_{k-1}) \\ 0 \\ 0 \end{bmatrix}, \quad e_k = y_k – \hat{y}_k$$
Here, $K_p^e, K_i^e, K_d^e$ are the PID gains for the enhancement loop. The integral term $K_i^e \Sigma e$ helps eliminate steady-state error caused by model inaccuracy, which is particularly beneficial for the LiFePO4 battery model across its entire SOC range. The proportional and derivative terms provide immediate and predictive corrections. Crucially, this PID correction is applied primarily to the SOC state (other states can be included if needed), providing a persistent driving force for SOC estimation even when the model’s $\frac{\partial U_{oc}}{\partial SOC}$ is small. The EKF’s own $K_k$ still operates, providing optimal fusion under its assumptions, while the PID handles residuals and systematic biases.
The performance of the PID-EKF method was rigorously evaluated against the standard EKF using experimental data from a LiFePO4 battery cell under a Federal Urban Driving Schedule (FUDS) profile. The algorithms were implemented with the following initialized parameters:
| Parameter | EKF | PID-EKF |
|---|---|---|
| $P_0$ | diag(1e-4, 1e-4, 1e-4) | diag(1e-4, 1e-4, 1e-4) |
| $Q$ | diag(1e-6, 1e-6, 1e-6) | diag(1e-6, 1e-6, 1e-6) |
| $R$ | 0.0003 | 0.0003 |
| $K_p^c, K_i^c, K_d^c$ | N/A | 0.12, N/A, 0.033 |
| $K_p^e, K_i^e, K_d^e$ | N/A | 0.12, 0.024, 0.033 |
1. Normal Operation (Accurate Initial SOC): Starting from the correct SOC (80%), the PID-EKF showed superior accuracy throughout the discharge cycle, especially at the beginning and end where model fidelity varies. The Root Mean Square Error (RMSE) and Maximum Absolute Error (MAE) were significantly lower than those of the EKF.
| Algorithm | RMSE (%) | MAE (%) |
|---|---|---|
| EKF | 0.72 | 1.77 |
| PID-EKF | 0.30 | 1.13 |
2. Convergence with Initial SOC Error: To test convergence, the initial SOC estimate was set to 100% while the true value was 80%. The standard EKF, hampered by the flat voltage plateau, took an extremely long time (over 12,000 seconds) to converge within a 2% error band. In stark contrast, the PID-EKF method, leveraging its initial compensation strategy, converged to within the same band in approximately 40 seconds. This dramatic improvement highlights the critical advantage of the proposed method for practical BMS applications where the initial SOC is often uncertain.
3. Robustness Against Model Error: To evaluate robustness, both algorithms were run using model parameters identified at a fixed 50% SOC point, rather than the true SOC-varying parameters. This introduced a deliberate model mismatch. The EKF’s performance degraded considerably as the operating point moved away from 50% SOC. The PID-EKF, however, maintained much better accuracy thanks to the integral action in its correction loop, which continuously compensated for the systematic model bias. The RMSE for PID-EKF was 0.55% compared to 0.98% for EKF under this stress test.
4. Robustness Against Measurement Noise: Additional Gaussian white noise was superimposed on the voltage measurements to simulate harsh sensor conditions. While the EKF is theoretically optimal for Gaussian noise, its performance for the LiFePO4 battery deteriorated significantly in the mid-SOC plateau due to the low observability, with the RMSE increasing to 2.41%. The PID-EKF demonstrated remarkable robustness, maintaining an RMSE of only 0.38%, as its PID correction mechanism provided a consistent, gain-sufficient feedback path independent of the diminished Kalman gain.
The experimental analysis confirms that the unique characteristics of the LiFePO4 battery, specifically its flat OCV-SOC plateau, substantially weaken the effectiveness of the standard EKF algorithm. Simple parameter tuning of the EKF (like reducing measurement noise covariance $R$) proved ineffective in overcoming this fundamental observability issue.
The proposed PID-EKF fusion method successfully mitigates this problem. By integrating a fast PD-based initial value compensator and augmenting the state correction with a full PID controller, the algorithm ensures rapid convergence and maintains high estimation accuracy even in the presence of significant initial errors, model inaccuracies, and measurement noise. The method effectively decouples the SOC estimation performance from the instantaneous sensitivity of the LiFePO4 battery model, providing a robust and practical solution for SOC estimation in LiFePO4 battery-powered systems. Future work will focus on integrating online model parameter identification to further enhance the adaptability of the PID-EKF method throughout the entire lifespan of the LiFePO4 battery.
