Keywords

1 Introduction

Secondary batteries play an extremely important role in the emerging power and energy systems, e.g., smart grid and electric vehicles, where batteries can be discharged to support the load or charged to store the excessive energy [1]. Dominated secondary batteries in the market include Lead-Acid batteries, Li-ion batteries, and supercapacitors, where each of them has different applications, e.g., Lead-Acid batteries have been utilized in the automotive industry for the starting, lighting and ignition (SLI) purposes, and Li-ion batteries are popular in the electric vehicles, and supercapacitors are mostly used in fast/discharging application scenarios [2].

Battery management systems (BMS) are crucial for the safe and efficient operation of batteries [3]. The BMS is actually an embedded system, where various sensors can be applied to collect the voltage, current and temperature of batteries. The measurements are transmitted to the micro-controller, and based on which the control signal is generated to manage battery cells. The functions of BMS include state measurement and estimation, cell balancing, charging/discharging control [4].

The design of BMS includes two aspects: one is the hardware design and the other is software design [5]. In the hardware design, different physical components need to be analyzed and connected in a logical way, e.g., each cell needs to be connected with corresponding sensors, where the sensor output is connected with the analog-to-digital port of the micro-controller. Similarly, the control signal from the micro-controller needs to drive the actuators (e.g., switches) of the BMS through the electric wire. In the software design, two flows need to be considered: one is the state estimation and the other is the state management. In the state estimation flow, both the state-of-charge (SoC) and state-of-health (SoH) need to be estimated, which is preferred in a collective way [6,7,8,9]. In the state management flow, different control algorithms, e.g., cell balancing/charging control/discharging control algorithms are designed to achieve the corresponding purposes [10,11,12].

Although extensive studies have been conducted on battery management systems for the battery modeling [13], SoC estimation [6, 7], SoH estimation [8, 9], cell balancing [10, 11], charging/discharging control [12], to name a few, existing explorations are still restricted in an ad-hoc way. Actually, in a battery management system, different factors are coupled together, which needs to be considered in a collective way. For instance, the accuracy SoC estimation affects the battery balancing, and the cell balancing control also affects SoC estimation accuracy. Thus, the battery modeling, battery state estimation, and state management of BMS need to be analyzed and designed in a systematic way, which in turn, requires a systematic model to represent the BMS.

A digital twin is digital counterpart of a physical system [14], where the digital counterpart can be used to estimate and predicate the states of the physical system, which can be further used to manage the physical system [15]. In the digital twin framework, the physical part consists of the battery cells, balancing circuits, and additional electrical components; and the digital twin consists of battery modeling, battery state estimation, and battery state management [16,17,18]. In this sense, if we can build the digital twin model of the battery management system, we can explore the battery modeling, battery state estimation and battery state management in a single model, which provides the insight to designing advanced BMSs.

In this paper, a digital twin model is proposed for battery management systems. We first introduce the concepts of the BMS digital twin. Then, the battery modeling, SoC estimation, SoH estimation algorithms are presented and analyzed in detail. Thereafter, we introduce the digital twin platform used in the performance evaluation. Experiment results verify that the proposed digital twin model can characterize the BMS accurately.

The remainder of this paper is organized as follows. In Sect. 2, we introduce the basic concept of the BMS digital twin. Section 3 presents the digital twin algorithms. The digital twin model is proposed in Sect. 4. Experiment results are provided in Sect. 5. We conclude the paper in Sect. 6.

2 BMS Digital Twin Model

In this section, we introduce some basic concepts about the digital twin model of the battery management systems. As shown in Fig. 1, the whole system consists of three subsystems: battery cells, micro-controller, and the digital twin. The details are introduced as follows.

Fig. 1
figure 1

The digital twin model of the battery management system

2.1 Battery Cells

In a practical battery storage system, multiple battery cells are connected in series and parallel to satisfy the voltage and power requirement of the application scenario. Additional circuits are typically embedded in battery systems to achieve the balancing of cells. Two categories of balancing circuits can be employed, i.e., passive balancing circuit and active balancing circuit. In the passive balancing circuit, passive components, e.g., resistors or diodes, are connected with cells to dissipate the excessive energy of high-voltage ones [19]. The energy efficiency of the passive balancing circuit is relatively low, but the circuit benefits from the low cost and small size, which is favored in low power applications. In the active balancing circuit, energy storage units, e.g., inductors or DC-DC converters, are applied to transfer the energy from the high-voltage cells to low-voltage ones [20]. The active balancing circuit benefits from high efficiency, but both the size and cost are high, and thus is typically applied in high power applications. Recently, the reconfigurable battery system has emerged as a new BMS, where the configuration of the battery cells can be adjusted dynamically according to the load requirement [21]. These balancing circuits provide various choices for the designer when designing battery management systems.

2.2 Micro-controller

Micro-controller plays a vital role in collecting battery states and in sending control signals to the battery cells. To do that, a correct and logical physical connection is necessary. In the state monitoring flow, corresponding sensors, e.g., voltage/current/temperature sensors are connected to each cell to measure the battery state. The output of the sensors is connected to the analog-to-digital port of micro-controllers, and then are stored therein. With the measured states, the digital twin algorithms can be implemented to model, estimate and control the battery states. In the state management flow, the GPIO port of the micro-controller is connected to the actuator of the BMS, e.g., switch, relay, or DC-DC converter. Different control strategies including switching control, PWM control can be applied to regulate the states of circuits and batteries.

2.3 Digital Twin

A digital twin represents the mathematical abstraction of the BMS. Micro-controllers provide a physical platform for the digital twin to be implemented. Recently, with the information technology development, the digital twin model can also be implemented in the cloud server, where the role of micro-controllers becomes a “flow channel” to transmit the battery state to cloud, and send cloud computing result to BMS.

A digital twin model including the algorithms: battery modeling algorithm, SoC estimation algorithm, and SoH estimation algorithm, battery balancing algorithm, and battery charging/discharging control algorithm. In the battery modeling algorithm, the equivalent electrical model of the battery can be applied, which is further discretized and programmed in micro-controller or cloud servers. In the SoC estimation algorithm, classical observer-based approach and the emerging machine learning method can be applied to estimate the SoC of batteries in real time. In the SoH estimation algorithm, different recursive methods can be adopted to estimate the SoH in the long term. In the battery balancing algorithm, feedback control law is designed to balance the voltage/SoC of batteries based on the designed active or passive balancing circuit. In the charging/discharging control algorithm, a bidirectional DC-DC converter is typically adopted to achieve the energy flow between batteries and the load.

In the following, we emphasize three digital twin algorithms, battery modeling, battery SoC estimation, and battery SoH estimation.

3 BMS Digital Twin Algorithms

3.1 Battery Modeling

The existing battery models can be usually divided into two categories, i.e., electrochemical model and equivalent circuit model. Among them, the electrochemical model has high precision but many parameters and complex structure, which is not suitable for SoC online estimation scenarios. Neural network model needs a large number of experimental data for learning and training, and needs strong computing ability. In comparison, the equivalent circuit model has fewer parameters and is easy to identify, and has high estimation accuracy. As shown in Fig. 2, the Thevenin model is applied to characterize the battery dynamics:

$${\dot{\text{U}}}_{1} = - \frac{{{\text{U}}_{1} }}{{{\text{R}}_{1} {\text{C}}_{1} }} + \frac{{\text{I}}}{{{\text{C}}_{1} }}$$
(1)
$${\text{U}} = {\text{U}}_{{{\text{oc}}}} - {\text{U}}_{1} - {\text{IR}}_{0}$$
(2)
Fig. 2
figure 2

Thevenin battery model

Thevenin model consists of a voltage source \(U_{oc}\), resistance \(R_{0}\) and the parallel network \(R_{1} C_{1}\). \(U_{1}\) and \(U\) are the terminal voltage of RC circuit and the terminal voltage of Thevenin model respectively. The structure of this model is relatively simple, the parameters are less and easy to identify, and it can characterize the dynamics of the battery, so it has good practical engineering application value.

3.2 SoC Estimation

The EKF was developed on the basis of the Kalman filter, which extends the Kalman filter algorithm to nonlinear Gaussian systems.

Generally, the two main components of Kalman filtering are the prediction part and the update part. As shown in Eqs. (3) and (4) are the prediction equations of the Kalman filter, where \(A\) is the state transition matrix, \(B\) is the input control matrix, \(\hat{x}_{k}^{ - }\) is a prior estimate of the state, \(\hat{x}_{k}\) is the posterior estimate of the state, \(u_{k}\) is the input, \(P_{k}^{ - }\) is covariance matrix of prior estimation error \(e_{k}^{ - } = x_{k} - \hat{x}_{k}^{ - }\). \(Q\) is the covariance matrix of process noise \(w_{k}\).

$${\hat{\text{x}}}_{{\text{k}}}^{ - } = {\text{A}}{\hat{\text{x}}}_{{{\text{k}} - 1}} + {\text{Bu}}_{{{\text{k}} - 1}}$$
(3)
$${\text{P}}_{{\text{k}}}^{ - } = {\text{AP}}_{{{\text{k}} - 1}} {\text{A}}^{{\text{T}}} + {\text{Q}}$$
(4)

Correspondingly, the updated equations for Kalman filtering are (5)–(7), Where \(P_{k}\) is covariance matrix of posterior estimation error \(e_{k} = x_{k} - \hat{x}_{k}\), \(Q\) is the covariance matrix of measurement noise \(v_{k}\).

$${\text{K}}_{{\text{k}}} = {\text{P}}_{{\text{k}}}^{ - } {\text{H}}^{{\text{T}}} \left( {{\text{HP}}_{{\text{k}}}^{ - } {\text{H}}^{{\text{T}}} + {\text{R}}} \right)^{ - 1}$$
(5)
$${\hat{\text{x}}}_{{\text{k}}} = {\hat{\text{x}}}_{{\text{k}}}^{ - } + {\text{K}}_{{\text{k}}} \left( {{\text{y}}_{{\text{k}}} - {\text{H}}{\hat{\text{x}}}_{{\text{k}}}^{ - } } \right)$$
(6)
$${\text{P}}_{{\text{k}}} = \left( {{\text{I}} - {\text{K}}_{{\text{k}}} {\text{H}}} \right){\text{P}}_{{\text{k}}}^{ - }$$
(7)

EKF is applicable to nonlinear systems. The space-state equations of EKF are (8) and (9).

$${\text{x}}_{{\text{k}}} = {\text{f}}\left( {{\text{x}}_{{{\text{k}} - 1}} ,{\text{u}}_{{{\text{k}} - 1}} } \right) + {\text{w}}_{{{\text{k}} - 1}}$$
(8)
$${\text{y}}_{{\text{k}}} = {\text{g}}\left( {{\text{x}}_{{\text{k}}} } \right) + {\text{v}}_{{\text{k}}}$$
(9)

The primary expression of EKF can be derived by linearization of multivariate function with the first-order expansion of Taylor series.

In summary, the \(I\) is selected as the input, \(SoC\) and \(U_{1}\) as the state, and the terminal voltage \(U\) as the measurement, so the state equation and measurement equation can be expressed as Eqs. (10) and (11):

$$\left\{ \begin{aligned} SoC\left( {\text{k}} \right) & = {\text{w}}_{{{\text{oc}}}} So{\text{C}}_{{{\text{oc}}}} \left( {\text{k}} \right) + {\text{w}}_{{{\text{ah}}}} So{\text{C}}_{{{\text{ah}}}} \left( {\text{k}} \right) \\ {\text{U}}_{1} \left( {\text{k}} \right) & = \left( {1 + \frac{1}{{{\text{R}}_{1} \left( {{\text{SoC}}\left( {{\text{k}} - 1} \right)} \right){\text{C}}_{1} \left( {{\text{SoC}}\left( {{\text{k}} - 1} \right)} \right)}}} \right){\text{U}}_{1} \left( {{\text{k}} - 1} \right) \\ & \quad + \frac{1}{{{\text{C}}_{1} \left( {{\text{k}} - 1} \right)}}I\left( {{\text{k}} - 1} \right) \\ \end{aligned} \right.$$
(10)
$${\text{U}}\left( {\text{k}} \right) = {\text{U}}_{{{\text{oc}}}} \left( {{\text{SoC}}\left( {\text{k}} \right)} \right) - {\text{U}}_{1} \left( {\text{k}} \right) - {\text{I}}\left( {\text{k}} \right){\text{R}}_{0} \left( {{\text{SoC}}\left( {\text{k}} \right)} \right)$$
(11)

where \(T\) is the sampling period, and there are:

$${\text{SoC}}_{{{\text{oc}}}} \left( {\text{k}} \right) = \frac{{{\text{U}}\left( {\text{k}} \right) + {\text{U}}_{1} \left( {\text{k}} \right) + {\text{I}}\left( {\text{k}} \right){\text{R}}_{0} \left( {{\text{SoC}}\left( {{\text{k}} - 1} \right)} \right) - {\upbeta }_{{\text{n}}} \left( {\text{k}} \right)}}{{{\upalpha }_{{\text{n}}} \left( {\text{k}} \right)}}$$
(12)
$${\text{SoC}}_{{{\text{ah}}}} \left( {\text{k}} \right) = {\text{SoC}}\left( {{\text{k}} - 1} \right) - \frac{{{\text{I}}\left( {\text{k}} \right){\text{T}}}}{{{\text{Q}}_{{{\text{rated}}}} }}$$
(13)

3.3 SoH Estimation

Particle swarm optimization (PSO) can find more suitable parameters by simulating the behavior of the group. It is widely used because of its high adaptability and anti-interference ability. The main flow of particle swarm optimization is as follows: Firstly, the position xi and velocity vi of all particles are randomly generated and initialized, and the appropriate initial value is determined according to the number of parameters. Then, in the algorithm iteration, the position and velocity are updated according to the best solution of each particle in previous generations and the best solution of all particles in previous generations.

The residual capacity of the battery will decrease during the operation of batteries, resulting in the capacity attenuation of the battery. The SoH of the battery indicates the aging level of the battery. The SoH of a battery can be defined as the ratio of the nominal capacity to the remaining capacity.

Based on the current and voltage measurement data of particle swarm optimization algorithm, according to the fitness function \(f\), resistance \({R}_{\mathrm{0,1}}\), capacitance \({C}_{1}\) and other parameters can be identified.

$$F = \frac{1}{N}\sum\limits_{i = 1}^{N} {(U_{t,i} - \hat{U}_{t,i} )^{2} }$$
(14)

where \(N\) is the number of particles, \(U_{t,i}\) is the voltage of the battery, and \(\hat{U}_{t,i}\) is the estimated battery voltage. When the estimated parameters converge, the algorithm will stop. Then the SoH can be calculated with the identified parameters.

4 BMS Digital Twin Platform

As shown in Fig. 3, the hardware platform is composed of four parts: main board, switching resistance board, voltage measurement board, power supply and data acquisition module.

Fig. 3
figure 3

Hardware setting of the digital twin platform

  1. 1.

    Main Board: Considering the weight and price, Raspberry Pi was selected as the main control module. It has a ARM Cortex-A72 CPU with 8 GB LPDDR4 SDRAM, 5.0 Bluetooth, 2.4 GHz and 5 GHz dual-band WiFi and other resources.

  2. 2.

    Switching Resistor Board: Three lithium-ion batteries are parallel connected with the resistor through the corresponding relay channel.

  3. 3.

    Voltage Measurement Board: The ADS1256 chip is utilized with a 8-channel analog-to-digital converter (ADC) and sampling rate of 30 kHz.

  4. 4.

    Power Sources: The power sources supply is divided into two parts. The constant-current power supply charge batteries with a constant current. The DC 24 V power supply provides the operating voltage for the micro-controller and sensors.

  5. 5.

    Acquisition Platform: The data acquisition module includes PXI equipment, measurement board and LabView of upper computer. The PXI platform measures the battery voltages through the measurement board and displays the voltage profiles in the upper computer.

The parameter settings in the circuit are as follows: the rated capacity of the battery is 2600 mAh, the reference voltage \(v_{0} = 3.6\,{\text{V}}\), the charging current \(i_{c} = 3.6\,{\text{A}}\), balancing resistance \(R = 1\,\Omega\), and sampling period \(T = 0.001\,{\text{s}}\).

We briefly discuss how the testbed operates during the charging process. As the main control module, Raspberry Pi measures the terminal voltage of each cell by controlling the high-precision voltage sampling module. Through measurement, the controller adjusts the switching state according to the programming algorithm. The measurement data of the battery is sent to the cloud server through HTTPS protocol and stored in the database for data visualization in the Web application. HTTPS protocol adds SSL layer on top of TCP/IP model. The client encrypts the data and sends it to the server. The server obtains the data after decryption, which ensures the security and privacy. On the Raspberry Pi operating system, Python development and software programs are used to convert the cloud control signals into physical values.

5 BMS Digital Twin Evaluation

In this section, we provide the experiment of the digital twin model of the battery management system. The performance of the SoC estimation and SoH estimation algorithms are evaluated.

Figure 4 shows the results of SoC estimation result based on Thevenin battery model and OCV method. It is in fact an open-loop estimation method, where the SoC is computed based on the battery mathematical model and OCV. Figure 5 shows the results of SoC evaluation based on the extended Kalman filter approach. Using the Thevenin battery model, the Kalman filter compares the model output with the actual output, which is further used to update the estimation. It can be seen that the SoC estimation method has a good estimation performance.

Fig. 4
figure 4

The SoC estimation based on Thevenin battery model and OCV method

Fig. 5
figure 5

The SoC estimation based on extended Kalman filter

Figure 6 shows the state of health estimation results when the test data of different batteries are intercepted at a shorter voltage segment. The particle optimization method is applied to estimate the SoH of batteries. The absolute error of the estimation results of most test samples is less than 5%. It can be seen that the shorter the intercepted voltage segment, the worse the estimation accuracy of the model. Therefore, in order to ensure the estimation accuracy of the model, a longer voltage segment should be selected as much as possible.

Fig. 6
figure 6

The SoH estimation based on the particle optimization method

6 Summary

In this paper, a digital twin model is proposed for battery management systems. We discuss the basic concepts of the digital twin model, including the physical layer and the cyber layer. The digital twin model, algorithms and platforms are presented in detail. The experiment results of the proposed digital twin model show that the SoC and SoH can be estimated accurately. Future work will focus on the development of digital twin model of the battery management system with the cell balancing.