# Tiny Machine Learning Battery State-of-Charge Estimation Hardware Accelerated
## 12 Battery Pack Architecture Analysis  
The battery pack, which provides electrical energy to the vehicle's inverter to drive the electric motor, usually consists of a number of modules with battery cells connected in series or in parallel or a combination of both. A crucial function of the BMS is to make sure that the different cells in the battery pack keep the same charge capacity during charge and discharge cycles. By keeping the cells balanced in terms of energy stored, the BMS extends the life of the battery pack (and its elements) as its longevity is affected by overcharge and depth of discharge states. Unbalances between the charge levels of different cells can exacerbate these issues. Consequently, this paper investigated the total time required to compute the SoC at a finer granularity level considering all cells composing the battery pack. As it was also suggested by [PERSON] et al. [81] to estimate the SoC at pack level, the SoC for each individual cell shall be computed and then combine them to compute the overall value:  
\[SoC_{pack}=\frac{\sum_{i=1}^{N}SoC_{i}\times C_{i}}{\sum_{i=1}^{N}C_{i}} \tag{2}\]  
The use of a single MCU installed on the battery connected via a common data transport bus to the individual cells was assumed be available. With a single MCU, the approach chosen was the linear accumulation of the individual inference times of the SoC inference for each cell. Table 16 shows the number of cells, their configuration within battery pack and the overall inference time for different automobile models. The pack configurations are arranged in an \"\(\times\)SpyP\" structure, where x denotes the number of cells connected in series to form a module and y denotes the number of modules connected in parallel to form the battery pack [82]. For example, Nissan Leaf had 96 cells connected in series to form a module and 2 modules connected in parallel to form the pack, for a total of 192 cells. All data concerning the different electric car models were collected from the EV Database [83]. All these vehicles featured Lithium-ion battery type. \begin{table}
\begin{tabular}{c c c} \hline
**MCU** & **Latency at Startup [\(\mathrm{\SIUnitSymbolMicro s}\)]** & **Throughput Latency [ns]** \\ \hline SR5E1-EVBE3000 & 6.6 & 66 \\ STM32H5731-DK & 7.1 & 71 \\ STM32 MP257F & 1.3 & 13 \\ \hline \end{tabular}
\end{table} 
Table 15: Latencies to store the input feature batch into embedded MCU memory at startup (1000 features) and in throughput (10 features update). In the first scenario, the STM32 MP257F-EV1 MPU (2 cores) was adopted. The Parallel TCNs architecture provided the fastest results (Table 14). The RAM occupied was 4.92 MB (Table 14). Total inference time was computed by multiplying the number of pack cells by 0.88 ms, inference time (Table 17 column STM32 MP257F-EV1). In the second scenario, the MCU SRE1-EVBE3000D automotive MCU was adopted. The LSTM Stateless was chosen, since it exhibited the best trade-off among inference time (Table 11), MSE (Table 3), RAM and Flash usage (Table 7). The MCU RAM and Flash occupied was 4.91 KiB and 22 KiB (Table 7) respectively. Total inference time was computed by multiplying the number of pack cells by 20.64 ms inference time (Table 17 column SR5E1-EVBE3000D). The results (ref. Table 17) showed a significant inference time difference between the 8 bits Parallel TCNs deployed on a  
STM32 MP2 and the fp32 LSTM Stateless topology deployed on the SRE1, mainly due to the highest computing capabilities of the STM32 MP257F (2 cores at 1.5 GHz) and due to the more efficient 8 bits TCN workload. The inference time was higher on automobiles with high module parallelism, such as Tesla Model S Plaid, Lucid Air Grand Touring and Rimac Nevera (column Number of cells of Table 16). Therefore, a second approach was considered. It assumed that a MCU was connected to each \"S\" structure. This to enable \"yP\" parallel computation. The total inference time was computed by multiplying the \"xS\" by the inference time of the individual cell.