## 3 Diagnostic and Prognostic Framework Modelling
### Particle Filter Framework  
As Kalman filters, Particle Filters (PFs) are an excellent tool to track the state of a system. The main reason for using PFs instead of Extended Kalman filters is that the latter usually need a high computational effort to obtain an exact solution, whereas the former usually find quite a good approximate solution with less computational effort [27].  
The particle filtering technique, also called bootstrap filtering or survival of the fittest, is a sequential Monte Carlo (MC) method that is described in detail in [28]. It represents the predicted state of the system using a group of random particles and their associated weights. This is shown in Equation (9):  
\[p(x_{0:k}/z_{1:k})\approx\sum_{i=1}^{N_{s}}\omega_{k}^{i}\cdot\delta\left(x_{0: k}-x_{0:k}^{i}\right), \tag{9}\]  
where \(\left\{x_{0:k}^{i},i=0,\ldots,N_{s}\right\}\) are the set of \(N_{s}\) particles or samples up to time step \(k\), and \(\left\{\omega_{k}^{i},i=1,\ldots,N_{s}\right\}\) are the associated weights for the particles at time step \(k\). A normalization of the weights is required at every time step to ensure that \(\sum_{i}\omega_{k}^{i}=1\).  
The state of the system is propagated using the system model, and the weights are updated for every time step when new measurements are available. The quality of the algorithm depends on the choice of the weight update function. There are several ways to update the weights:  
Figure 2: Li-ion cell discharge model.  
* Sequential importance sampling: when an importance density function \(q(\cdot)\) is available, the weights can be updated using: \[\omega_{k}^{i}\propto\omega_{k-1}^{i}.\frac{p\big{(}z_{k}/x_{k}^{i}\big{)}\cdot p \left(x_{k}^{i}/x_{k-1}^{i}\right)}{q\left(x_{k}^{i}/x_{k-1}^{i},z_{k}\right)}.\] (10)
* When the importance density sampling function is chosen so that it reduces the variance of the weights: \[\omega_{k}^{i}\propto\omega_{k-1}^{i}\cdot p\left(z_{k}/x_{k-1}^{i}\right).\] (11)
* Occasionally, the importance density sampling function is chosen to be the PDF of the state based only on the previous state (\(q\left(x_{k}^{i}/x_{k-1}^{i},z_{k}\right)=p\left(x_{k}/x_{k-1}^{i}\right)\)). The weight update function is then: \[\omega_{k}^{i}\propto\omega_{k-1}^{i}\cdot p\left(z_{k}/x_{k}^{i}\right).\] (12)  
An important issue with the particle filter algorithm is the _degeneracy problem_. This occurs when, after several iterations, a few particles have a high weight, making the other samples negligible. The degeneracy problem is usually evaluated using the effective sample size \(N_{eff}\), which is calculated using:  
\[N_{eff}\approx\frac{1}{\sum_{i=1}^{N_{s}}\left(\omega_{k}^{i}\right)^{2}}. \tag{13}\]  
When the effective sample size falls below a chosen threshold, a _resampling_ technique is required in order to ensure the efficiency of the algorithm. The aim of resampling is to eliminate particles with low weights and focus on the particles with higher weights. The resampling strategy used in [28] is adopted. The particle filter strategy is shown in Figure 3a and the resampling strategy is displayed in Figure 3b.  
Figure 3: (a) Particle filter algorithm methodology; (b) re-sampling strategy.