**4. Results**

Here, we highlight the usage of approach in Section 3. The number and variety of existing open-source battery modeling software packages (MATLAB, COMSOL, DUALFOIL, fastDFN, to name a few) have made it convenient for academics and industrial battery designers to begin with partially developed and functional models rather than building the battery model from scratch.

Utilization of experimental results for estimating the battery model parameters is necessary during initial design of the model. However, for estimating the battery state that is already in use for N cycles, experimental validation of terminal voltage followed by a minimization optimization algorithm is impossible. Here, the alternative is that either the BMS provides the voltage values of each cell through the voltage sensor or the parameter-update is identified through the aging physics of the battery.

PyBaMM (Python Battery Mathematical Modelling) is an open-source Python package that can solve continuum models. It can be coupled with other software packages and is capable of solving standard electrochemical battery models. Documentations for using PyBaMM are available [67,68] and the results show that PyBaMM can facilitate the model parameter-update estimation.

The data structure of battery models in PyBaMM is a collection of symbolic expression trees (variable, parameter, addition, multiplication, and gradient). These enable mathematical representation of the model components. The addition of a new battery model in PyBaMM requires initialization of attributes such as: (1) variable boundary conditions; (2) governing equations; (3) initial conditions; (4) output variables of the model; (5) other optional attributes (geometry, computation solver, parameter values, termination events, and battery region).

PyBaMM provides parameter sets based on experimental data provided in literature [69,70] which are used as the reference parameter values in this paper. Types of parameter for all the components (cells, electrolytes, negative electrode, positive electrode, SEI, separators) includes, macroscale geometry [m] or microstructure, current collector conductivities [S m−1], current collector density [kg m−3], current collector specific heat capacity [J· kg−<sup>1</sup> <sup>K</sup>−1], current collector thermal conductivity [W m−<sup>1</sup> <sup>K</sup>−1], nominal cell capacity [A.h], current function [A], electrode properties, and interfacial reactions.

According to Figure 3, the model is first fed with the charge/discharge cycle data through an excel file. In the following execution, a high acceleration aggressive driving schedule—US06 is used to discharge the DFN model. Code segments (2), (3) and (4) are the cycle integration steps.

Experiment1 = pybamm.Experiment (["Charge at 1 A until 4.1 V", "Hold at 4.1 V until 50 mA"]) (2)

Experiment2 = pybamm.Experiment([("Discharge at 1C for 0.5 h", "Discharge at C/20 for 0.5 h")] × 2 + [("Charge at 0.5 C for 45 min",)] (3)

Experiment3 = pybamm.Experiment([("Discharge at 2C until 3.3 V", "Rest for 0.5 h", "Charge at 1 A until 4.1 V", "Hold at 4.1 V until 50 mA")]) (4)

> The Python program was written based on the provided examples in the documentation, hence the results can be reproduced. PyBaMM operates with respect to a defined set of input parameters (~97) and output variables (~400). The PyBaMM program steps highlight the ease of following the implementation steps of Figure 3. It can be considered the means to develop battery DTs, mainly due to fast access to the model parameters in Python. Further analysis and research with different input data and parameter identification are definitely needed in order to implement a holistic battery DT. The correctness of the findings in these results are dependent on the precision of the PDE and ODE solvers in PyBaMM.

> In Figure 4, the default DFN model is assigned with the two types of charging preconditions—(2) and (3). The battery model is fully charged using 2, followed by the final state of the experimental solution being mapped to the initial conditions of the next discharge cycle. Similarly, using (3), the battery model is completely discharged followed by slow charge at 0.5 C for 45 min. Likewise, the final state of the experimental solution is mapped as the initial condition for the consequent discharge cycle. The surface concentration, electrode potentials, and terminal voltage values are compared for the three scenarios, i.e., default battery initial state, fully charged, and slow charged. The comparison implies that the effect of charging under varying conditions can be mirrored to the consequent discharge cycle. This helps in running the state estimation procedures after certain discharge cycles with relevant initial conditions.

**Figure 4.** DFN model discharge results with different preconditions. Fully charged—code statement (2). Complete discharge and slow charge—code statement (3).

Code segment (4) is a variation of (3), where the model is discharged at 2 C until 3.3 V, followed by 30 min rest and full charge until 4.1 V. Figures 5 and 6 show that a discharge/charge cycle with respect to (4) is followed by the US06 drive cycle. Similar to the processing of Figure 4, the final state of the model at the end of the charge cycle (Experiment 3) is used to update the initial conditions at the beginning of the discharge cycle. Figure 5 compares the model behavior with direct discharge and discharge after the Experiment 3. The plot of terminal voltage reflects that an accurate terminal voltage estimation is possible when the model parameters are appropriately updated with respect to the operation of the actual battery. Figure 6 partially repeats a section of Figure 5. It mainly shows the DFN model output variables for charge and discharge cycle based on code segment (4) and the US06 drive cycle.

**Figure 5.** Comparison between output parameters of two discharge characteristics.

**Figure 6.** DFN model output variables for discharge based on code statement—(4).

Some of the variables are two-dimensional, with respect to time and the distance from the anode current collector (x). Thus, the graphs change as time is modified. From Figure 5, the output variables for both the scenarios (i.e., only discharge and charge followed by discharge) are retrieved in MATLAB files in 1D or 2D arrays. The output variable set shown in the following code segment can be used to calculate the degradation mechanisms of the electrode, separator, and electrolyte.

solution.save\_data("Output\_AfterDischarging.mat",

["Time [h]", "Current [A]", "Terminal voltage [V]","x [m]",


"Negative electrode active material volume fraction"], to format="matlab")

Hence, the first parameter-update method of 3.3 is realizable in PyBaMM. This example was based on only a small range of driving schedules, while the input charge/discharge cycles are much longer in reality. There also arises an alternative of a straightforward implementation through continuous concatenation of the driving cycles. While that will work for small durations, a very high computation power will be needed to cycle the model through the complete usage phase using a single concatenated file. The model parameter-update during usage keeps the battery DT up-to-date with the actual cell after every N cycle.

Knowledge of which driving cycle parameters affects the model parameters might not always be computationally practical because evaluating the exact values of each parameter is not practically possible. Model reduction is, therefore, an important component, especially of electrochemical battery models. However, understanding potential dependencies will directly impact the formulation of the estimation algorithms' objective function and cost functions.

The output files generated from the results contribute to parameter retrieval and comparison, it can further be integrated with existing battery state estimation techniques. The extensive parameter set that the DFN model provides complements the requirements of the high fidelity prediction algorithms that aim for high accuracy, irrespective of the computation costs. Additionally, the output parameter set can be used for generating training data for data-driven predictions in real-time applications.

Due to the unavailability of operational data, the KPIs identified in Step 5 of the approach are not be quantified for this implementation. However, comprehensive testing and KPI quantification will be investigated in future research.

#### **5. Discussion**

The following points focus on the unaddressed issues that remain unresolved but are considerably broad in scope to be handled in one paper:

