## 3 Mathematical Formulation
### Digital Twins
#### 3.1.1 Dt-Ev  
CLD owns a diverse EV fleet, including garbage trucks, cleaning vehicles, vans, and trucks. Each EV has a battery management system (BMS) integrated with the battery pack, ensuring safe operation. Due to the low computational capacity onboard, the models used in the BMS are relatively simple, resulting in reduced precision and greater deviations [26]. Over the battery lifespan, this affects critical parameters such as SOC or SOH calculation, which are key for the proper operation of the system. The DT-EV uses raw data (temperature, current, voltage, SOC) from the onboard BMS as input, transmitted to the cloud via integrated dataloggers that enables the data transference between the EV and the cloud database. Advanced models then process this data to generate outputs such as SOC, SOH, Remaining Useful Life (RUL), and Full  
Figure 2: Simplified diagram of the DT-based EMS solution showing sequence, interactions, and main outputs. Numbers indicate execution order, green boxes denote DTs, and blue boxes represent the optimization algorithms. Equivalent Cycles (FECs), which are provided to both the end user and the EVO [27]. This enables more precise analysis and accurate forecasting, leading to improved EV fleet operation. Figure 3 reflects the data exchange procedure and the main assets of the DT-EV system. Lithium-ion battery (LIB) models are generally classified into three types: ECM, PBM, and DDM [28]. ECM, based on Thevenin circuits with resistors and capacitors, is widely used in the automotive sector due to its simplicity, low computational requirements, and fast response. However, the model accuracy decreases over the battery lifespan and generally does not account for degradation. PBM, on the other hand, provides a detailed representation of the electrochemical processes happening inside the battery, offering higher accuracy and better predictions of parameters like RUL and SOH [29]. Nevertheless, they rely on nonlinear equations, which increases their computational requirements, limiting their application in real-time BMS implementations. DDM is based on machine learning (ML) techniques and has gained attention for its ability to handle nonlinearities with relatively low computational cost. While it offers better long-term accuracy than ECM, this highly depends on the datasets used for training. Moreover, its integration into BMS remains challenging due to computational constraints and instability in certain scenarios [26; 30]. For DT-EV, two models have been implemented: a PBM and a DDM model. This approach allows us to benefit from both methodologies: the reliability of PBM and the precision and adaptability of DDM. The PBM is based on the Pseudo 2-Dimensional (P2D) model [29], which represents how \(Li^{+}\) ions move alongside the battery in two dimensions: the particle radius (r) and the overall location on the battery dimension (x). It is based on the resolution of 5 partial differential equations and has a requirement of 35 parameters that depend on the intrinsic characteristics of the cells, such as the type of electrodes, electrolyte, or separator [29]. Manufacturers tend not to share the necessary information to execute these types of algorithms, for confidentiality reasons, which makes the calibration process challenging. In this case, the necessary values have been extracted from a well-known study such as [31], where a commercial NMC811 cell is parametrized and has been validated in a wide range of scenarios. This model has been integrated with additional equations that introduce temperature dependencies and degradation. The thermal behavior was characterized by a lumped model, which treats the cell as a uniform system with a unique temperature [32]. This simplification reduces the computational cost and eases its implementation, but provides  
Figure 3: DT-EV schema, interactions, data-flows, and cloud algorithms. higher error at high currents [33].