<figure><img src="image_1.png" /></figure>

HAL
open science

# A Virtual Platform for Modular Smart Battery Testing and Prototyping

Francesco Simonetti, Roberta Di Fonso, Nicolai Weinreich, Yusheng Zheng, Arman Oshnoei, Xin Sui, Remus Teodorescu

► To cite this version:

Francesco Simonetti, Roberta Di Fonso, Nicolai Weinreich, Yusheng Zheng, Arman Oshnoei, et al. A Virtual Platform for Modular Smart Battery Testing and Prototyping. The 26th European Conference on Power Electronics and Applications, GDR SEEDS France & EPE Association, Mar 2025, Paris, France. 10.34746/epe2025-0307. hal-05079909

HAL Id: hal-05079909

https://utc.hal.science/hal-05079909v1

Submitted on 22 May 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# A Virtual Platform for Modular Smart Battery Testing and Prototyping

Francesco Simonetti
Aalborg University

Pontoppidanstræde 111
Aalborg, Denmark
Tel.: +45 99409940.

E-Mail: frsi@energy.aau.dk

URL: https://www.aau.dk

Roberta Di Fonso
Aalborg University

Pontoppidanstræde 111
Aalborg, Denmark
Tel.: +45 99409940.

E-Mail: rdf@energy.aau.dk

URL: https://www.aau.dk

Nicolai Weinreich
Aalborg University

Pontoppidanstræde 111
Aalborg, Denmark
Tel.: +45 99409940.

E-Mail: nawe@energy.aau.dk

URL: https://www.aau.dk

Yusheng Zheng
Aalborg University

Pontoppidanstræde 111
Aalborg, Denmark
Tel.: +45 99409940.

E-Mail: yzhe@energy.aau.dk

URL: https://www.aau.dk

Arman Oshnoei
Aalborg University

Pontoppidanstræde 111
Aalborg, Denmark
Tel.: +45 99409940.

E-Mail: aros@energy.aau.dk

URL: https://www.aau.dk

Xin Sui
Aalborg University

Pontoppidanstræde 111
Aalborg, Denmark
Tel.: +45 99409940.

E-Mail: xin@energy.aau.dk

URL: https://www.aau.dk

Remus Teodorescu
Aalborg University

Pontoppidanstræde 111
Aalborg, Denmark
Tel.: +45 99409940.

E-Mail: ret@energy.aau.dk

URL: https://www.aau.dk

**Index Terms**—Battery energy storage system (BESS), Battery management system (BMS).

**Abstract**—Developing and testing algorithms for the management and control of modular smart batteries pose severe safety problems due to the inherent risk of hazards when dealing with battery cells.

This work proposes a virtual prototyping platform aiming to validate the performance of the controller without involving the use of real battery cells.

This setup allows real-time tests in safety conditions, which is preliminary to the validation on the real battery system.

## I. INTRODUCTION

Modular smart batteries (SBs) topologies are an emerging and attractive solution for improving the efficiency in controlling the state variables of the battery cells. Inspired by modular converters [1]–[3], they are flexible solutions for many applications, such as electric vehicles, second-lifetime applications, aerospace solutions, uninterruptible power supplies and many more [4]–[6]. One of the main features of the modular smart battery is its redundancy. Indeed, the SB system is composed of a number of battery cells that is higher than number of strictly needed cells to supply the desired voltage to the load.

The electronics equipped on each cell allows to connect

or disconnect at real-time the individual cell from the load, providing reconfigurability to the SB system.

The combination of redundancy and reconfigurability gives the SB the ability to dynamically choose to connect or bypass the cells to the load while guaranteeing the desired output voltage.

These cells can differ in their capacities for many different factors, including the impact of aging mechanisms and differences in the manufacturing process [7].

A cell with lower state of charge (SOC) can be bypassed in favor of a cell with higher SOC such to restore the SOC balance among them; a cell with an unacceptable temperature value can be disconnected until it returns to its nominal range; a faulty cell can be permanently excluded and the SB can still work properly.

The work in [8] proposed a method inspired by the k-nearest neighbor to balance both SOCs and temperatures of the cells simultaneously. At each time instant, it selects the individual cells to be connected to the load in order to guarantee the desired output voltage at the SB output terminals and, at the same time, minimizing the SOC and temperature unbalance among the cells by solving an optimization problem at run-time.

The development and testing of the monitoring and control algorithms on a real battery system can lead to hardware failures leading to health and safety issues also impacting the development time of battery management systems. Therefore, the ability to emulate
battery cells for the virtual testing of control algorithms is a very attractive feature that can impact positively on the development time as well as the cost. To address this challenges, several strategies have been developed, including hardware-based testing methods and virtual emulation tools.

In [9], a battery emulator platform that can reproduce the electrical and thermal characteristics of individual cells is discussed. This platform allows users to control outputs such as voltage, temperature, and current. Similarly, a virtual battery module for testing battery management systems (BMS) in real-world driving scenarios is proposed in [10] and validated through specific driving cycles. Additional developments in multi-cell emulation, design constraints, and platform characterization are explored in [11], [12], while real-time battery charge state estimation techniques, such as the extended Kalman filter (EKF), are analyzed in [13]. While these approaches provide valuable insights, they mainly focus on the emulation of battery cells. However, advanced features, such as sophisticated cell balancing and the integration of control systems are still not addressed. Since the validation of control algorithms for the battery system before the actual implementation on the real setup is essential to guarantee safety testing conditions, a proper validation procedure is of crucial importance.

This work presents a virtual prototyping platform aiming to validate the SB controller performance without involving real battery cells. The idea is to implement the control algorithm on the actual main controller and to run simulations of the battery cells on the digital signal processors (DSPs) equipped by the cells modules. A software running on a PC is employed to monitor the state variables of the simulated system and evaluate the controller behaviour. With this approach, the real-time validation of the controller performance can be validated, in safety conditions, preliminary to the validation on the real battery system.

## II. MODULAR SMART BATTERY CONCEPT

The SB system is composed of N smart cells modules connected in series. A module comprises a battery cell and a half-bridge that can control the insertion or bypass of the cell in the string. We assume: (i) to have knowledge about each cell voltage, temperature, and SOC, by means of sensors and estimation algorithms; (ii) to have a redundant number of cells in the battery pack. This flexible architecture allows us to insert only the certain number of cells strictly needed to create the output voltage required by the load, while bypassing the other cells to make them rest.

<figure><img src="image_3.png" /><figcaption>Fig. 1. Modular smart battery schematics.</figcaption></figure>

The schematic of the modular smart battery is presented in Fig. 1. In the virtual prototyping platform, battery models are necessary for obtaining the voltage, SOC, and temperature information of each battery during operations. To this end, a battery model should be developed to capture both the electrical and the thermal behaviors. It should be noted that there exist interactions between the electrical and the thermal behaviors of the battery, where the electrical model calculates the heat generation and input to the thermal model, and the calculated temperature will feed back to the electrical model to change the parameter value [14].

### A. Battery Electrical Model

Various equivalent circuit models have been proposed to mimic the dynamic characteristics of battery voltage response under a given current [15]. Considering the computational burden and accuracy, the first-order Randles circuit model is used in this work, as shown in Fig. 2. In the model for j-th battery cell, $v_{oc,j}$ is the open circuit voltage (OCV) and it has a nonlinear function relationship with battery $SOC_j$. $R_{0,j}$ is the internal ohmic resistance characterizing the electrolyte and interphase resistance of the battery. The RC branch $R_{1,j} C_{1,j}$, reflects the charge transfer and diffusion effect, $i_j$ and $v_j$ denote the j-th battery's current and the terminal voltage, respectively. According to Fig. 2, the governing equations for the j-th cell can be expressed as

$$ \frac{dv_{1,j}(t)}{dt} = -\frac{1}{R_{1,j}C_{1,j}}v_{1,j}(t) + \frac{1}{C_{1,j}}i_j(t) \quad (1) $$

$$ \frac{dSOC_j(t)}{dt} = \frac{1}{C_{n,j}}i_j(t), \quad (2) $$
<figure><img src="image_4.png" /><figcaption>Fig. 2. ECM model of the battery cell.</figcaption></figure>

where $C_{n,j}$ is the j-th battery nominal capacity. The expression of the terminal voltage is given as

$$v_j(t) = v_{oc,j}(t) - v_{1,j}(t) - R_{0,j}i_j(t). \quad (3)$$

Each cell composing the SB can be either be connected or bypassed to the load by opportunistly commuting the switching signals of the half-bridge. We define the switching signal of the j-th cell as the discrete variable $s_j \in \{0, 1\}$ that is equal to 1 when the cell is connected and 0 when bypassed.

Hence the current flowing from the j-th cell at a certain time instant k can be defined as

$$i_j(k) = i(k) \cdot s_j(k), \quad (4)$$

where $i(k)$ is the output current of the SB.

To facilitate the real-time implementation, the governing equations of the electrical model can be discretized using zero-order holding, which are given as follows:

$$SOC_j(k+1) = SOC_j(k) - \frac{\Delta t}{C_{n,j}} i(k) \cdot s_j(k) \quad (5)$$

$$v_{1,j}(k+1) = e^{-\frac{\Delta t}{R_{1,j}C_{1,j}}} v_{1,j}(k) + \left(1 + e^{-\frac{\Delta t}{R_{1,j}C_{1,j}}}\right) R_{1,j}i_j,$$

where $\Delta t$ is the sampling interval and set to be 1 s in this study.

## B. Battery Thermal Model

To capture the battery temperature changes under operations, a thermal model consisting of heat generation, heat accumulation, and heat dissipation should be developed. Typically, the temperature distribution inside the battery cell is not uniform due to the limited thermal conductivity of the cell. However, in control-oriented applications, the volume average temperature (bulk temperature) can be adopted to represent the

<figure><img src="image_5.png" /><figcaption>Fig. 3. Diagram of battery thermal model.</figcaption></figure>

thermal behavior. In this regard, the governing equation for the thermal energy balance of the battery can be expressed as:

$$mc_p \frac{dT_j(t)}{dt} = Q_{internal,j}(t) - hA(T_j(t) - T_f(t)) \quad (6)$$

where $m$ is the battery mass, $c_p$ is the specific heat capacity, and $T_j$ the bulk temperature of the j-th battery, $Q_{internal,j}$ is the internal heat generation, $h$ is the equivalent heat transfer coefficient for heat dissipation, $A$ is the battery surface area and $T_f$ is the temperature of the cooling fluid. Eq. 6 indicates that the battery temperature change is a combined result of heat generation and heat dissipation, as illustrated in Fig. 3.

The heat generation inside the battery $Q_{internal,j}$ consists of several electrochemical processes, and for simplicity, it can be calculated using the Bernardi equation, which is expressed as:

$$Q_{internal,j}(t) = i_j(t)(v_j(t) - v_{oc,j}) + i_j(t)T_j(t)\frac{\partial v_{oc}}{\partial T}(SOC_j)$$

where the heat generation is comprised of irreversible heat due to the current flow and ohmic losses, as well as reversible heat due to entropy changes, described by the entropic heat coefficient $\frac{\partial v_{oc}}{\partial T}$, which is a function of the battery $SOC_j$.

Similar to the electrical model development, the discrete-time representations of thermal can be derived by applying zero-order holding and can be expressed as:

$$T_j(k+1) = T_j(k)e^{-\frac{hA}{mc}\Delta t} + \left(1 - e^{-\frac{hA}{mc}\Delta t}\right) \left(\frac{Q_j(k)}{hA} + T_f(k)\right) \quad (7)$$

## C. Model Parameters Identification

Model parameters are of great importance to the fidelity of the developed model and therefore should be determined. To identify the parameters of the equivalent circuit model and the entropic heat coefficient $\frac{\partial v_{oc}}{\partial T}$, the OCV test and hybrid pulse power characterization (HPPC) test are conducted on a real battery cell.
For the thermal model, the OCV data, the entropic heat coefficient data, and the temperature data under dynamic current profiles such as the worldwide harmonized light vehicles test procedure (WLTP) are used to identify the heat transfer coefficient h. Details of the model parameter identification can be found in ref. [14]. The relationship between the entropic heat coefficient $\frac{\partial v_{oc}}{\partial T}$ and battery SOC can be modeled by applying a third-order polynomial, which is expressed as

$$ \frac{\partial v_{oc,j}(SOC_j(k))}{\partial T_j} = \bar{k}_3 SOC_j(k)^3 + \bar{k}_2 SOC_j(k)^2 + \bar{k}_1 SOC_j(k) + \bar{k}_0 \quad (8) $$

### D. Control of the Smart Battery

This work proposes the use of the control algorithm presented in [8] to connect or bypass the battery cells to set the output voltage of the SB to the desired level while balancing the SOC and temperature of the battery cells.

Given N cells, the goal is to optimally choose the subset of $K \le N$ cells following the principle of the K-nearest neighbor (KNN) classification algorithm.

Given a dataset of points and a reference point, the K-nearest neighbor algorithm calculates the distances from all the points in the dataset and the reference point. The distances are then sorted and the K nearest neighbors, i.e., the points with the minimum distance from the reference point, are computed. By appropriately setting K, the reference point and the distance metric, the KNN technique can be adapted to the SB balancing problem. Within the SB context, the dataset is represented by the couples $(SOC_j, T_j)$ for $j = 1, ..., N$, the reference point is set to $(SOC_{max}, T_{min})$ and the used distance metric is the weighted Euclidean norm of the error between the j-th point and the reference.

The number K is given by the number of cells needed to supply the desired overall voltage $v_{ref}$ to the SB output terminals.

The steps of the control algorithm are the following:

* given the $(SOC_j, T_j)$ for $j = 1, ..., N$, values of all cells, compute a reference point by choosing the sampled maximum SOC and the minimum temperature, i.e., $(SOC_{max}, T_{min})$;

* calculate the distance vectors as:

$$ d_j = k_S (SOC_j - SOC_{max})^2 + k_T (T_j - T_{min})^2 $$

where: $k_S, k_T$ are weighting factors used to make a trade-off between the SOC and temperature balance;

* sort the distances $d_j$ in ascending order to create an array of the sorted distances;

<figure><img src="image_6.png" /><figcaption>Fig. 4. KNN balancing algorithm flow chart.</figcaption></figure>

* select the first K elements of the sorted array such that:

$$ v^{out} = \sum_{j=1}^{K} v_j \equiv v^{ref} $$

and compute the switching signal as:

$$ S_j = \begin{cases} 1 & \text{for } j = 1, ..., K \\ 0 & \text{for } j = K + 1, ..., N, \end{cases} $$

with j the index of the sorted distances array.

Fig. 4 summarizes the flow chart of the KNN balancing algorithm.

### III. VIRTUAL PLATFORM

This paper presents a virtual platforms setup to test the modular smart battery master/slave communication and validate the control algorithm performance in a hardware in the loop fashion, which is a crucial propedeutic step towards the implementation on a real battery system. The system is designed to emulate the behaviour of the modular smart battery by running a simulations of the battery cell on each slave DSPs and implementing the actual control algorithm on the main controller board. The studied system is composed of n = 7 slave boards equipped with DSPs Texas Instruments CC2652R communicating with a main control board composed of a DSP of the same model and a Google Coral Dev Board Mini.

The master DSP is responsible to handle the communication with the slave DSPs. Since the controlled variables,
<figure><img src="image_7.png" /><figcaption>Fig. 5. Virtual platform architecture.</figcaption></figure>

i.e., SOC and temperature, have a relatively slow dynamics, the communication protocol does not require a fast sampling rate. Moreover, since the DSPs are supplied by the battery cells, a communication strategy with low power consumption is preferable.

Due to the aforementioned reasons, a time slotted channel hopping (TSCH) communication protocol was chosen for the low power consumption wireless master/slave communication.

The master DSP communicates via UART to the Google Coral Dev Board Mini, which is responsible for the main computations of the control algorithm.

A PC is connected to the Google Coral board via USB connection, and used to monitor the battery system performance, as summarized by the system architecture in Fig. 5.

### A. Slave Cells

The *j*-th slave receives the packet from the master DSP, which is decoded to extract the switching signal $S_j(k)$. Then, the *j*-th battery cell model is updated and the states [$SOC_j(k+1), v_j(k+1), T_j(k+1)$] are computed according to equation 5 and 10.

Finally, the new values of the state variables are stored into the next packet that will be transmitted to the master DSP at the next communication.

Fig. 6 shows the key functions of the battery cells.

### B. Main Control Platform

The main aim of the master DSP is to manage the THSC communication with the cells and to provide the information on the state variables to the Google Coral boards, which will send back the computed control input. Every 3.2 s, the master DSP handles the TSCH communication and sequentially establishes the data transmission with the cells from 0 to 6.

The master DSP receives packets containing the state variables [$SOC_j(k+1), v_j(k+1), T_j(k+1)$] for $j = 1, ..., N$ from the cells and forward them to the Google Coral board via UART communication. The Google

<figure><img src="image_8.png" /><figcaption>Fig. 6. Main functions of the *j*-th DSP cell.</figcaption></figure>

<figure><img src="image_9.png" /><figcaption>Fig. 7. Main functions of the control board.</figcaption></figure>

Coral board waits for the acquisition of the data from all the cells and computes the control action to balance SOCs and temperatures.

Finally, the Google Coral board sends packets containing the switching signals $S_j(k)$ for $j = 1, ..., N$ to the master DSP and packets containing the information on the state variables to the PC via USB.

Hence, the master DSP forwards the computed control actions at the next TSCH transmission.

The key functions of the main board are summarized in Fig. 7.
<figure><img src="image_10.png" /><figcaption>Fig. 8. Monitoring of the smart battery.</figcaption></figure>

### C. Monitoring PC

The state packets collected by the master DSP from the individual slave cells are forwarded to a PC via USB for monitoring. As new data from a cell becomes available it gets plotted in a graphical user interface (GUI) along with data collected from the other cells. Additionally, the GUI allows the user to record the data collected from the master DSP and subsequently store it to file for later use. The monitoring procedure is summarized in Fig. 8.

### D. Results

Since the DSPs are simulating the dynamics of the output voltage, SOC and temperature of the battery cells, it is needed to visualize them in order to validate the proper behaviour of the controller. Fig. 9 shows the plot of the key variables of interest of the modular smart battery, i.e., output voltages, SOCs, temperatures, for two different tuning of the control parameters. In both the scenarios, the initial SOCs are randomly chosen in an interval [0.8, 1] pu, while the temperature is set to an ambient temperature of 25 °C. The plot shows a simulation of about 12 minutes.

Fig. 9 shows the results of the KNN balancing when setting the tuning parameters to $k_s = 1, k_t = 10^{-6}$ to make a trade-off between the SOC and temperature balance. As underlined by the figure, the battery gradually discharge while supplying the 100 A current to the load and the control algorithm selects the best cells to insert and bypass at every instant. After about 6 s, the SOCs reach the balance, i.e., the spread of the SOCs remain inside a fixed bound for the whole duration of the simulation. At the same time, the KNN method takes into account the temperature of the cells and limits the temperature spread.

<figure><img src="image_11.png" /><figcaption>Fig. 9. Monitoring of the smart battery when prioritizing SOC.</figcaption></figure>

## IV. CONCLUSION

This paper presents a virtual prototyping platform to validate the control and management of a modular smart battery system without involving real battery cells. The developed setup aims to study the performance of the controller by taking into account the computations and communications errors and delay and allowing a real-time emulation of the system, while ensuring safety testing conditions. The presented platform has a crucial importance for the validation of the system, preliminary to the validation on the real setup.

## REFERENCES

[1] F. Simonetti, A. D'Innocenzo, and C. Cecati, "Neural network model-predictive control for chb converters with fpga implementation," *IEEE Transactions on Industrial Informatics*, vol. 19, no. 9, pp. 9691-9702, 2023.

[2] F. Simonetti, A. D'Innocenzo, and C. Cecati, "Simple explicit solution of finite control set model predictive control for cascaded h-bridge inverters," *IEEE Transactions on Industrial Electronics*, pp. 1-11, 2023.

[3] F. Simonetti, S. Mohamadian, C. Buccella, and C. Cecati, "Dc current suppression in chb-statcom with model predictive control employing current transformers," *IEEE Transactions on Industrial Electronics*, pp. 1-11, 2024.

[4] R. Di Fonso and C. Cecati, "Test cycle simulation of an electric car with regenerative braking," in *2020 AEIT International Conference of Electrical and Electronic Technologies for Automotive (AEIT AUTOMOTIVE)*, 2020, pp. 1-5.

[5] M. Dezhbord, M. Babalou, V. Marzang, P. Alavi, S. H. Hosseini, and S. Mohammadi, "A new high step-up three-port dc-dc structure for hybrid pv/battery energy systems," in *2019 10th International Power Electronics, Drive Systems and Technologies Conference (PEDSTC)*, 2019, pp. 509-514.
[6] G. Bossi, A. Floris, N. Campagna, R. Miceli, and A. Damiano, "Design of a battery pack for the power system of an all-electric aircraft by cell characterization," in *2023 International Conference on Clean Electrical Power (ICCEP)*, 2023, pp. 76-82.

[7] R. D. Fonso, R. Teodorescu, C. Cecati, and P. Bharadwaj, "A battery digital twin from laboratory data using wavelet analysis and neural networks," *IEEE Transactions on Industrial Informatics*, vol. 20, no. 4, pp. 6889-6899, 2024.

[8] R. Di Fonso, X. Sui, A. B. Acharya, R. Teodorescu, and C. Cecati, "Multidimensional machine learning balancing in smart battery packs," in *IECON 2021 – 47th Annual Conference of the IEEE Industrial Electronics Society*, 2021, pp. 1-6.

[9] L. Guo, J. Li, and Z. Fu, "Lithium-ion battery soc estimation and hardware-in-the-loop simulation based on ekf," *Energy Procedia*, vol. 158, pp. 2599-2604, 2019.

[10] F. Ren, T. Cox, and H. Wang, "Thermal runaway risk evaluation of li-ion cells using a pinch-torsion test," *Journal of power sources*, vol. 249, pp. 156-162, 2014.

[11] L. Jiang, Z. Luo, T. Wu, L. Shao, J. Sun, C. Liu, G. Li, K. Cao, and Q. Wang, "Overcharge behavior and early warning analysis of liion0. 5co0. 2mn0. 3o2/c lithium-ion battery with high capacity," *Journal of The Electrochemical Society*, vol. 166, no. 6, p. A1055, 2019.

[12] M. Lammer, A. Königseder, and V. Hacker, "Holistic methodology for characterisation of the thermally induced failure of commercially available 18650 lithium ion cells," *RSC advances*, vol. 7, no. 39, pp. 24425-24429, 2017.

[13] Q. Wang, P. Ping, X. Zhao, G. Chu, J. Sun, and C. Chen, "Thermal runaway caused fire and explosion of lithium ion battery," *Journal of power sources*, vol. 208, pp. 210-224, 2012.

[14] Y. Zheng, Y. Che, X. Hu, X. Sui, and R. Teodorescu, "Online sensorless temperature estimation of lithium-ion batteries through electro-thermal coupling," *IEEE/ASME Transactions on Mechatronics*, 2024.

[15] X. Sui, S. He, D.-I. Stroe, X. Huang, J. Meng, and R. Teodorescu, "A review of sliding mode observers based on equivalent circuit model for battery soc estimation," in *2019 IEEE 28th international symposium on industrial electronics (ISIE)*. IEEE, 2019, pp. 1965-1970.