Particle Filter SoC Tracking

Controls & Parameters

Execution Control


Status: Initializing...

Particle Filter Settings

Battery & Load Settings

Simulation Status

Time: 0.0 s

True SoC: 100.0 %

Estimated SoC: --- %

Measured Voltage (for next update): --- V

Understanding the Particle Filter for SoC Estimation

This interactive visualization demonstrates how a Particle Filter can be used to estimate the State of Charge (SoC) of a battery. Unlike simpler methods, a Particle Filter is a non-parametric approach that can handle non-linear system dynamics and non-Gaussian noise, making it suitable for complex battery models.

The core idea is to represent the probability distribution of the battery's SoC using a set of weighted "particles". Each particle represents a possible state (SoC value) of the battery. The weight of a particle indicates how likely that state is.

The Particle Filter operates in a cycle of three main steps:

  1. Prediction (or Propagation): Based on the known input (the applied current) and a model of the battery's dynamics, each particle's SoC is updated to predict its state at the next time step. Process noise is added to these predictions to account for uncertainties in the model and unmodeled disturbances. The general prediction step can be represented as: \[x_t^i = f(x_{t-1}^i, u_t) + v_t\] In this battery SoC example, the prediction for each particle's SoC (\(SoC_t^i\)) is based on the previous SoC (\(SoC_{t-1}^i\)), the applied current (\(I_t\)), and the battery capacity (\(C_{batt}\)), with added process noise (\(v_t\)): \[SoC_t^i = SoC_{t-1}^i - \frac{I_t \cdot \Delta t}{C_{batt}} + v_t\] where \(\Delta t\) is the time step.
  2. Update (or Weighting): A measurement (the battery voltage, \(z_t\)) is received. For each particle, the likelihood of observing this measurement, given the particle's predicted SoC and a model of the measurement noise, is calculated. The particle's weight (\(w_t^i\)) is then updated proportionally to this likelihood. Particles whose predicted SoC is consistent with the measurement will have higher weights. The weight update is given by: \[w_t^i = w_{t-1}^i \cdot p(z_t | x_t^i)\] The likelihood \(p(z_t | x_t^i)\) is typically calculated using a probability density function (PDF) of the measurement noise. Assuming Gaussian measurement noise with standard deviation \(\sigma_m\), the likelihood is: \[p(z_t | x_t^i) = \frac{1}{\sqrt{2\pi\sigma_m^2}} \exp\left(-\frac{(z_t - h(x_t^i, u_t))^2}{2\sigma_m^2}\right)\] where \(h(x_t^i, u_t)\) is the expected voltage calculated from the particle's SoC (\(x_t^i\)) and the applied current (\(u_t\)), considering the internal resistance.
  3. Resampling: A new set of particles is generated by sampling from the current set with replacement, based on their weights. Particles with higher weights are more likely to be selected, while particles with very low weights are likely to be discarded. This step focuses the particles on the more probable regions of the state space and prevents the degeneracy problem (where most particles have negligible weights). The resampling step effectively replaces particles with low weights with duplicates of particles with high weights. The probability of selecting a particle \(i\) is proportional to its weight \(w_t^i\). After resampling, the new set of particles \(\{\tilde{x}_t^j\}_{j=1}^N\) is obtained, and their weights are typically reset to \(1/N\).

After resampling, the estimated SoC is typically calculated as the weighted average of the particles' SoC values (or simply the average if resampling assigns equal weights). The process then repeats for the next time step.

Using the Visualization:

Observe how the distribution of particles (shown in the histogram) changes with each step and how the estimated SoC (red line in the time series plot) tracks the true SoC (blue line), especially in the presence of measurement noise (green line in the voltage plot).