## 4 Modeling and Prediction
### Prediction  
The goal is to understand how batteries work and be able to anticipate their possible ageing and malfunction, to further proactively conduct maintenance accordingly. Therefore, the development of prediction models on the performance of the batteries is essential so that the user can make better use of the battery, which can extend the life of the said battery.  
To design the prediction model, the model of the evolution of internal resistance previously created is used as the base. It is virtually impossible to estimate the lifespan of a battery before using it, as it depends directly on the quality of use given to it. It would be similar to trying to figure out how long a person is going to live before they are born.  
The objective is to create a range of end-of-life possibilities among which the actual end of life of the battery is expected to be found. For this, the model will be based on the historical data of batteries 1, 2, 3, 4, 5, 6, and 7 and the data obtained from the previous use of the battery under study. The model elaborates two possible evolutions of internal resistance that will correspond to the upper and lower limit between which reality is found. This provides a broader provision of battery performance which includes both the good use and the bad use.  
Figure 26 presents the prediction model flow chart including the structure of this prediction model.  
First, the values of discharged capacity, previous storage time, and flight type of the new cycle are randomly created. For this, the historical data and the previous experience of the battery are considered, giving more weight to one or the other, depending on the number of cycles prior to the prediction, so that more importance is given to the experience the greater it is.  
The values of the voltage dispersion between cells and the difference between input and output voltage in the charge are then randomly created. To achieve this, the model is based on the historical relationship of these parameters with the previously created discharged capacity and the cycle number.  
Once all these values have been obtained for a new cycle, the evolution model of the previous section is used to obtain a new internal resistance value. If this value does not exceed the end-of-life value, the process repeats, starting a new cycle.  
This structure is repeated to create both the upper and lower limit, including, in each case, variations based on the study of the data, so that in one case the probabilities of good use of the battery are increased and in the other, the opposite occurs. The values created to draw the possible evolution of the resistance are random, but these small variations are used in each case, to ensure that there is a certain trend.  
To ensure that the boundaries are adequate, a population of possible solutions is created. In each case, a solution is chosen based on a high safety factor, so that the crossing of the boundaries is avoided, as well as extreme values that are completely unrealistic.  
Figure 26: Prediction model flow chart.  
Figure 28: Prediction of life for batteries in use: (**a**) cell 8; (**b**) cell 9.  
Figure 27: Results of prediction of battery 1: (**a**) 20 cycles; (**b**) 50 cycles; (**c**) 80 cycles.  
To obtain these results, a population of 500 solutions was used for each limit, to achieve acceptable accuracy in a short time. The computation time for each iteration of creating an upper and lower bound pair depends on the length of these solutions. However, it is not estimated to be greater than 0.001 s. On the other hand, the total computation time of the model is approximately 3 s.  
The presented black box model thus showed that a rather simple model can give a good prediction of the remaining useful life (RUL) of a battery, integrating the changes throughout the battery life. Moreover, this model needs a limited amount of memory and can still run in real time. It would be interesting to integrate such a model in the charger or vehicle software.