## 3 Diagnostic and Prognostic Framework Modelling
### Enhanced End of Discharge (EOD) Prediction Model  
The EOD prediction methodology is shown in Figure 5. The model includes measurements from the sensors, the particle filter to track the state of discharge and prediction, and other algorithms that adapt the model for different loading profiles. Both voltage and current are required for the EOD prediction. The state of charge (SOC) is reflected by the voltage and the loading profile is evaluated by the measurement of the current. Every time a new current measurement is present, the battery state of charge is updated to comprise the effects of the charge that has been already extracted from the battery. This is achieved using Equation (19):  
\[SOC_{i+1}\approx SOC_{i}+\frac{I_{i}\cdot T_{S}}{C}, \tag{19}\]  
where \(T_{S}\) represents the sampling period, \(I_{i}\) is the measured current of the battery, and \(C\) is the current capacity of the battery for that discharge cycle, evaluated by the EOL particle filter. The particle filter is able to track the state of the cell during discharge once the loading profile is evaluated. The state transition and measurement models are described in Equations (20)-(25). The state transition model is based on work carried out by [PERSON] and [PERSON] [14], but includes some modifications, given by:  
\[\alpha_{1,i+1}=\alpha_{1,i}+v_{1,i} \tag{20}\]  
\[\alpha_{2,i+1}=\alpha_{2,i}+v_{2,i} \tag{21}\]  
\[\alpha_{3,i+1}=\alpha_{3,i}+v_{3,i} \tag{22}\]  
\[\alpha_{4,i+1}=a\cdot\frac{(1-SOC_{i})}{t_{i}}+v_{4,i} \tag{23}\]  
\[\alpha_{5,i+1}=\alpha_{5,i}+v_{5,i} \tag{24}\]  
\[E_{i+1}=E_{i}-\frac{\alpha_{1,i}\cdot\alpha_{2,i}\cdot\exp\left(\frac{-\alpha _{2}}{t_{i}}\right)/t_{i}^{2}-\alpha_{3,i}\cdot\alpha_{4,i}\cdot\exp\left(\alpha _{4,i}\cdot t_{i}\right)-\alpha_{5,i}}{f_{s}}+v_{6,i}, \tag{25}\]  
Figure 4: End of Life (EOL) prediction. where \(v_{1,i}\), \(v_{2,i}\), \(v_{3,i}\), \(v_{4,i}\), \(v_{5,i}\), and \(v_{6,i}\) are independent zero-mean Gaussian noise terms; \(a\) is a constant adjusted when tuning the algorithm; \(t_{i}\) is the current time; and \(f_{s}\) is the sampling frequency. The novelty of this study when compared to the model proposed by [PERSON] and [PERSON] [14] is the method of calculating \(\alpha_{4}\). Determination of \(\alpha_{4}\) according to [PERSON] and [PERSON]'s method is shown by Equation (21). In their model, the values were initialized knowing the loading profile and capacity in advance. The calculation in Equation (23) for \(\alpha_{4}\) allows the parameters to adapt to different loads. This proposed modification of \(\alpha_{4}\) also works when the capacity has faded away, causing a reduction in the EOD time. \[\alpha_{4,i+1}=\alpha_{4,i}+v_{4,i} \tag{26}\]  
The measurement model is expressed as:  
\[SOC_{i+1}\approx SOC_{i}+\frac{I_{i}\cdot T_{S}}{C}, \tag{19}\]0  
where \(n_{i}\) is the measurement noise, modeled as zero-mean Gaussian noise; and \(z_{i}\) is the measured voltage at time \(t_{i}\). The particle filter tracks the state of charge of the battery by using these two models, giving accurate predictions of the state of the next step every time a new measurement is present. The particle filter propagates the current state of the battery until it reaches the EOD voltage threshold when the user requires a prediction of the remaining time for the discharge of the battery. This threshold can be adjusted in order to maximize the discharge time by setting a low EOD voltage threshold such as 2 V or reduce aging due to overcharging by setting a moderate value such as 2.7 V. The last update of the variables \(\alpha_{1},\alpha_{2},\alpha_{3},\alpha_{5}\) is maintained and the parameter \(\alpha_{4}\) recalculated by assuming that the loading profile used by the application remains the same until the end of discharge in order to propagate the current state of the battery. This is achieved using Equation (28):  
\[SOC_{i+1}\approx SOC_{i}+\frac{I_{i}\cdot T_{S}}{C}, \tag{19}\]1  
where the sampling period \(T_{S}\) is used to update the time \(t_{i}\).