You are on page 1of 9

Expert Systems With Applications 229 (2023) 120444

Contents lists available at ScienceDirect

Expert Systems With Applications


journal homepage: www.elsevier.com/locate/eswa

Digital twin for electric vehicle battery management with incremental


learning
Naga Durga Krishna Mohan Eaty, Priyanka Bagade ∗
Department of Computer Science & Engineering, Indian Institute of Technology Kanpur, Kanpur, India

ARTICLE INFO ABSTRACT

Keywords: The current Industry 4.0 revolution promotes the use of cyber–physical systems to enhance manufacturing
Digital Twin and other industrial processes via automation, real-time analysis, etc. Data communication between individual
SoH (State of Health) systems plays an important role in this revolution’s success. As defined by researchers, Digital Twin is the digital
SoC (State of Charge)
representation of a physical system that enables predictive maintenance. Due to the increase in environmental
Continual learning
pollution, battery-powered electric vehicles (EVs) are regarded as the urgent solution to internal combustion
Internet of things
Cloud computing
engines in the transportation business, despite obstacles such as safety concerns and range estimation. State
Microsoft Azure of Health (SoH) and State of Charge (SoC) are two battery metrics that, when precisely anticipated, permit
safer and longer battery use. Predicting these parameters online is computationally and financially expensive.
Alternately, some of these factors could be predicted in the cloud rather than on the vehicle, hence cutting
costs. Consequently, the EV business is one example where cloud-to-vehicle data connection saves total costs.
A digital twin for an EV battery would aid in the estimate of battery parameters for predictive maintenance.
This paper presents a Digital Twin paradigm for EV battery management in which SoH is predicted in the
cloud and SoC is estimated on-vehicle. A continuous learning method is also proposed for forecasting SoH,
whereas the Kalman filter is used to estimate SoC. The proposed framework predicts the SoH with a mean
square error of 0.022.

1. Introduction used to show the present battery’s health; it aids in avoiding prolonged
usage and promotes improved battery recycling. In general, the battery
In recent years, artificial intelligence (AI) has demonstrated its of an electric vehicle should be discarded and its depreciation can take
influence in a variety of engineering applications, including healthcare, 4 − 5 years (depending on battery usage style) (Smith et al., 2017). The
autonomous vehicles, and robots, among others. Due to the rapid SoH and SoC parameters are currently estimated using electrochemical
changes in global environmental circumstances caused by the pro- and electrical circuit-based methods (Lin, Tang, & Wang, 2015). These
duction of hazardous gases and the increase in the amount of CO2 , methods involve precise battery modeling and intensive computations.
an electric vehicle is seen as an alternative to internal combustion SoH estimation is more computationally intensive than SoC estimation,
engines (ICEs) to counter these emissions Lithium-ion batteries are and SoC estimation should be real-time because range predictions need
commonly utilized in electric vehicles due to their high energy density, it. The idea is to split the computational load between the cloud and
low maintenance requirements, and extended lifespans (Ren, Ma, &
on-vehicle by transferring SoH predictions to the cloud and estimating
Cong, 2015). EVs reduce pollution, however they have downsides like
SoC on-vehicle and exchanging data between the cloud and vehicle at
range anxiety and electrical safety risks. These drawbacks are the
service stations.
primary impediment to a quicker transition to electric automobiles. The
NASA defined the term ‘Digital Twin’ to describe a virtual rep-
challenge of predicting the vehicle’s range can be resolved by precisely
resentation of a physical system that can be used for simulations,
assessing the remaining battery capacity. SoC measures the remaining
analytics, and predictive maintenance (Tao, Zhang, Liu, & Nee, 2018),
battery capacity. Therefore, a correct estimation of SoC would assist
drivers to have faith in the estimated range. By actively monitoring which encourages data communication between systems in order to
temperatures and doing predictive maintenance, it is possible to pre- improve some of the current industrial processes. A digital twin for
vent overheating and short-circuiting. The overuse of batteries can be an electric vehicle would help to distribute the computational load,
avoided by checking the health of the batteries. SoH is the parameter perform predictive maintenance by monitoring parameters, provide

∗ Corresponding author.
E-mail addresses: krishnamohan0602@gmail.com (N.D.K.M. Eaty), pbagade@iitk.ac.in (P. Bagade).

https://doi.org/10.1016/j.eswa.2023.120444
Received 14 August 2022; Received in revised form 10 February 2023; Accepted 7 May 2023
Available online 24 May 2023
0957-4174/© 2023 Elsevier Ltd. All rights reserved.
N.D.K.M. Eaty and P. Bagade Expert Systems With Applications 229 (2023) 120444

driver-specific feedback by analyzing their driving styles, and so on. In • Predictive maintenance and diagnostics: Monitoring important
our previous work (Eaty & Bagade, 2022), we proposed a Digital Twin parameters will aid in determining the system’s condition and aid
framework for electric vehicle batteries in which the digital model is in taking preventative measures. This can increase the system’s
hosted in the cloud and the battery management system (BMS) acts overall service life and help troubleshoot faster.
as the physical system. SoH is predicted on the cloud using a deep • Accessibility: Digital twin provides remote access to the physical
learning model based on an incremental learning technique using data system, enabling designers and operators to control from different
transferred from the on-vehicle BMS, while SoC is estimated on the BMS locations (Singh et al., 2021).
using a primitive coulomb counting technique. The data received from
the vehicle are preprocessed to produce time–frequency scalograms, DT has multiple applications in the electric vehicle industry. Using
which are inputs to the SoH prediction algorithm. The issue with the speed and time as inputs, Venkatesan, Manickavasagam, Tengenkai,
employed prediction algorithm for SoH is that it functions optimally and Vijayalakshmi (2019) developed a DT for ML-based predictive
in situations with a small number of incremental data samples. In the maintenance of an electric vehicle’s permanent magnet synchronous
motor. Rather than the current plug-and-play system, Shikata et al.
future, a number of vehicles will be deployed on the road, and the
(2019) proposed that EVs be charged wirelessly. A DT for this ap-
amount of incremental data will be so large that few-shot learning will
plication will assist in simulating the reorientation of the vehicle by
be inefficient. So, there is a need for a fine-tuning approach that is
utilizing the relative error between the current position and the de-
independent on the amount of incremental data available. The issue
sired position for wireless charging. An example of cost-effective and
with the coulomb counting algorithm used for SoC estimation is that
time-efficient DT for EVs is battery manufacturing, where health and
it is extremely primitive, and estimation errors accumulate over time,
fault predictions of running batteries will help manufacturers regulate
causing the estimate to deviate significantly from the actual (Eaty &
production, thereby indirectly increasing profits and manufacturing
Bagade, 2022).
efficiency (Valdez Parra et al., 2021). Using DT for fault prediction
In this paper, we extend our previous work (Eaty & Bagade, 2022)
and root cause analysis also saves service technicians time diagnosing
to address the shortcomings of SoH prediction and SoC estimation
the issue and reduces service costs (Kamran et al., 2022). DT for
algorithms. We propose a continual learning approach for SoH predic-
autonomous vehicles assists in simulating a virtual car using techniques
tion that is independent of the amount of incremental data available.
such as 3-D rendering, virtual sensors, and artificial intelligence for the
This approach is inspired by transfer learning and fine-tunes the base
diagnosis and prognosis of EV devices. Rassõlkin et al. (2022) proposed
model by creating a fine-tuning sample with incremental and base
a digital twin which monitors the performance of the electric vehicle
data samples from reservoir sampling. This helps to combat the two motor in which a virtual model is created and data is exchanged on
primary issues associated with transfer learning, namely over-fitting internet. This helps in analysis and simulations with less cost and time.
and catastrophic forgetting. We also propose a Kalman filter technique The above works validate that a digital twin for an electric vehicle that
for SoC estimation that uses a combination of coulomb counting and monitors key parameters and reacts in case of faults enables prolonged
open-circuit voltage methods to provide a close estimate of the actual usage of the electric battery, thus extending the useful life of the
value. In this work, we also describe the implementation of the digital battery. Two of the key parameters that give the battery status are SoH
twin, which, upon receiving new data, performs continuous learning on and SoC. These parameters help in understanding the current battery’s
the cloud, updates the cloud-based model to provide SoH predictions, health and the remaining charge in the current charging–discharging
and communicates with the on-vehicle BMS. cycle. So accurate prediction and monitoring of these parameters are
The remaining paper is organized as follows: Section 2 talks about key for making better prognostics.
the related work in this area, Section 3 explains the Proposed Frame- Three main techniques for predicting the SoH of batteries. One
work, Section 4 talks about Digital Twin implementation on Azure technique uses the electrochemistry of the battery and predicts SoH
cloud services, Section 5 details Experimental details and Results, by solving partial differential equations (PDEs). These techniques are
followed by Future Work and Conclusion. termed Electrochemical models (EMs). The second type of model is
Equivalent Circuit based models (ECMs), these model the batteries
2. Related work using electrical components like capacitors and resistors. These two
techniques can predict health accurately but require heavy computa-
Multiple definitions of Digital Twin have been proposed in various tion (Lee & Lee, 2021). Also these models, once developed are frozen
studies. Some refer to it as the data and information links that connect and cannot be tuned on new data. Data-driven models are the third
the virtual and physical systems (Singh et al., 2021). A digital twin technique that uses battery cycling data to build statistical or machine
should consist of three primary components: (1) the physical system, learning-based models for predicting SoH. These models rely on data
(2) virtual model, and (3) data interface between the physical and and do not require extensive domain knowledge relating to batteries. By
virtual systems. In general, the following characteristics should be simulating the battery with resistance, capacitors, and voltage sources,
possessed by any digital twin: Guo and Shen (2021) offered many ECM-based strategies. These models
do not account for the dynamic behavior of driving patterns, which
• Accurate Modeling: Accurate and generalized digital models aid leads to less precise SoH prediction. The EM-based model captures the
in simulating physical system scenarios that may occur. dynamic behavior while considering the electrochemical phenomena
• Self-evolving: The virtual model must be updated with new data inside the battery (Bartlett, 2015). For the price of requiring extensive
from the physical system operating in different conditions. computations to solve numerous partial differential equations for SoH
• Secure: Data privacy is a top priority, it is necessary to use proper prediction, these models offer good accuracy. In low-compute hardware
encryption techniques during data transfer and authentication typically found in EVs, electrochemical models are not practical.
techniques for the data access (Singh et al., 2021). By using machine learning and artificial intelligence techniques like
KNN (K-nearest neighbors), Logistic Regression, ANN (artificial neural
The main advantages of building a digital twin with the above network) (Khumprom & Yodo, 2019), Random Forest, and Decision
characteristics are: Tree (Xu et al., 2018), numerous attempts have been made to predict
SoH (Jo, Jung, & Roh, 2021). These methods call for very little domain
• Faster prototyping and re-designing: With the aid of simula- expertise. LSTM-based models (Hong, Kang, Jeong, & Baek, 2020) have
tions, it would be easier and faster to make iterations during the also been employed for SoH prediction because the battery data is time-
design phase helping reduce developing costs. series. These models provided optimistic outcomes and inspired the use

2
N.D.K.M. Eaty and P. Bagade Expert Systems With Applications 229 (2023) 120444

Table 1
Summary of recent works in predicting SoH for battery health prognostics.
Paper Title Model used Description Experimented dataset Accuracy
Wu, Zhang, and Chen Single layer feed forward neural Voltage signal is sampled by charging the battery Not public dataset MAE 29.4218
(2016) network in constant current mode to predict the remaining MSE 1.6184e+03
useful life. The training data does not consider the
variations in current during the charging and
discharging of the battery.
Zhou, Liu, Peng, and Combination of single SVR and Voltage, current, temperature and impedance NASA battery dataset MAE: 0.020
Peng (2012) online SVR, without any sampling techniques are used as
inputs to the model. A Combined learning
approach (offline+online) is used to reduce the
computational complexity when the data is
updated. The dataset used for training does not
consider the rest times for the batteries and thus
fails to emulate the actual battery operating
conditions.
Choi, Ryu, Park, and Feed forward neural network, CNN Multiple neural network models have NASA battery dataset RMSE: 0.0246
Kim (2019) and LSTM are experimented. Model experimented. Inputs to the model are sampled MAE: 0.0159
is selected using RMSE and MAE voltage, current and temperature signals. All
metrics experimented models are static and do not learn
on incremental data.
Xu, Peng, and Su Decision tree and random forest The models are trained with the time required for NASA battery dataset MSE for decision
(2018) models are experimented. charging, discharging, maximum temperature tree: 0.0006
Bootstrapping technique is used for during the process. The proposed models are static MSE for random
training. in nature. This work considers the peak values of forest: 0.0002
parameters but not the sudden change in them,
which is the main cause of battery degradation.
Salucci, Bakdi, Glad, 2 layer LSTM is experimented. Initial voltage in charging cycle, change in voltage, NASA randomized RMSE: 0.015
Vanem, and De Bin Another model experimented for duration of the cycle, maximum temperature, dataset
(2021) comparison with LSTM is a statistical minimum temperature, the average value of
model (a variation of multivariate currents during the cycle are given as inputs for
linear regression) training the model. LSTM model is good on
time-series data, but the model is static.
Roman, Saxena, A pipeline is created in which four Set of more than 30 features based on the domain All open datasets RMSE: 0.027
Robu, Pecht, and models have experimented. Bayesian knowledge and charging signals are derived and MAPE: 2.17
Flynn (2021) ridge regression, Gaussian process are passed to models and random forest performed
regression, ensemble of deep neural better. This work indirectly considers the stress on
networks,and random forest the battery by sudden changes, but the proposed
model is not incremental.
Proposed approach Continual learning ML model. Voltage, current and temperature signals are NASA randomized MSE: 0.022
sampled and CWT images are generated to train dataset MAE: 0.095
the ML model. The proposed model is a continual
learning model which does not depend on the size
of incremental data. The CWT images capture the
battery stress points during battery charging and
discharging to emulate real-life conditions.

of data-driven strategies. However, the lack of open-source data pre- In this work, we created a digital twin of EVs that can collect
vents models from being adequately trained and assessed. Zhou et al. data from EVs operating in various conditions, predict battery health
(2012) suggested an Online-SVR-based technique that incrementally and provide manufacturers with feedback. To provide timely feedback
learns from new data to assist the model generalize. These models, about the battery’s health to the EV owner and manufacturer, it is
however, were developed using datasets that rely on constant current proposed to periodically transfer battery data to the cloud and perform
flow throughout charging and discharging, which is not compatible compute-intensive SoH predictions. The proposed method reduces the
with the situation that would exist in the actual world. Venugopal et al. on-vehicle compute requirements and the overall cost by obviating
(2019) suggested an RNN-based method developed on a dataset that the need to add additional computing power and memory to the
discharges random currents to produce patterns near to those found EV circuitry. The proposed prediction SoH method uses randomized
in the actual world. Another approach extracts the input signal’s time-
current, voltage, and temperature of the battery as inputs to depict
based properties to improve SoH predictability. To further improve SoH
real-life settings, unlike state of the art methods. In addition, we
prediction models, El-Dalahmeh et al. created time–frequency images
developed a Kalman filter method for the SoC estimation computed by
from the voltage data and carried out image analysis using deep learn-
the on-vehicle BMS. The computed parameters SoH and SoC are then
ing (El-Dalahmeh, Al-Greer, El-Dalahmeh, Short, et al., 2020). Table 1
exchanged via a cloud-based interconnection.
presents the overview of recent works in battery health prognostics
using data-driven techniques. Most of these models are trained on lab-
based battery data that does not emulate real-life conditions. Also the 3. Proposed framework
currently available SOH estimation methods are static and cannot work
with small incremental data to provide timely feedback to the vehicle
owner. The proposed framework overcomes the issues of training the In this section, we describe the proposed approach in detail. We
ML model with less incremental data on digital twin with a continual focus on the primary responsibilities of each component of the digital
learning approach and randomized battery cycling data to emulate twin, as well as the estimation and forecasting techniques for SoC and
real-life electric vehicle battery conditions on roads. SoH.

3
N.D.K.M. Eaty and P. Bagade Expert Systems With Applications 229 (2023) 120444

3.1.1. Proposed data preprocessing approach - Wavelet transforms


This approach aims to capture the underlying transients from the
voltage and current signals using both time and frequency domains
instead of only time or frequency domains. Time–frequency methods
provide several specific domain features in both time and frequency
domains, thereby extracting more information from the input sig-
nal (Sejdić, Orović, & Stanković, 2018). Some techniques like Fourier
transformation can decompose a complex signal into multiple sinu-
soidal components, but these sinusoidal components are continuous
and not localized in space and time. For this reason, they are not that
effective in analyzing the transient behavior of the signal. A special
function called wavelets which are localized and exist for a particular
duration is better for studying the transients. One of the most popu-
lar techniques for conducting time–frequency analysis using wavelet
functions is continuous wavelet transform (CWT). After applying CWT
on the measured signal in 1-D is transformed into time–frequency
images, which contain information about energy concentrations at
different frequency components over time (Yan, Gao, & Chen, 2014).
The continuous wavelet transform is the convolution of the wavelet
basis function over the measured signal. Mathematically, CWT can be
represented using Eq. (1)
( )
1 𝑡−𝑏
Fig. 1. Proposed framework for EV battery management using digital twin.
𝜓𝑎,𝑏 (𝑡) = √ 𝜓 (1)
𝑎 𝑎

where 𝜓𝑎,𝑏 (𝑡) is called the child wavelet which is shifted in time by 𝑏 and
scaled in frequency by 𝑎. The wavelet function 𝜓(𝑡) is called the mother
3.1. Battery digital twin
wavelet. Two conditions that the wavelet function has to satisfy are
∞ ∞
∫−∞ 𝜓(𝑡)𝑑𝑡 = 0 and ∫−∞ |𝜓(𝑡)|2 𝑑𝑡 = 1 (Cai, Yang, Deng, Zhao, & Deng,
As mentioned in Section 1, for safer and longer use of electric 2018).
vehicles, it is necessary to estimate SoC and SoH parameters accurately. The child wavelets are convoluted over the measured signal to get
SoC is used to make range predictions, therefore this value must be the wavelet coefficients. This is given by Eq. (2)
computed in real-time. The battery health and remaining useful life ∞ ( )
1 𝑡−𝑏
are determined by SoH. It can be computed remotely but requires an 𝑤(𝑎, 𝑏) = √ 𝑥(𝑡)𝜓 ∗ 𝑑𝑡 (2)

𝑎 −∞ 𝑎
accurate forecast because battery degradation is a slow process. The
current Industry 4.0 revolution emphasizes the use of the digital twin where 𝑤(𝑎, 𝑏) is the wavelet coefficient and 𝜓 ∗ means the complex
conjugate of the child wavelet functions.
concept to simplify and streamline operations. This work proposes a
Scalograms are the result of applying the CWT to the measured
Digital Twin framework for the management of EV batteries. Fig. 1
signals (current and voltage). Scalograms are two-dimensional plots
depicts the block diagram of the proposed Digital Twin framework for
of the CWT coefficients over time and frequency. The time–frequency
batteries and briefly describes the functions of each component. In this
images generated by CWT from the measured signals (both current and
framework, the three primary DT components are (1) On-Vehicle BMS voltage) are inputs to the deep learning models for predicting the SoH
(physical system), (2) Battery Digital Model (virtual system), and (3) of the battery.
cloud-based interconnection (data link). The primary responsibility of
the on-vehicle BMS is to calculate the SoC in real-time and transmit 3.1.2. Proposed approach — continual learning approach
the current, voltage, and SoC information to the virtual model. The Continual learning algorithms are another class used to solve life-
cloud-hosted virtual model predicts SoH based on data collected from long learning problems on incremental data. Using some sampling
the EV, performs analytics and transmits data back to the physical techniques, continual learning algorithms create a memory buffer from
system. By computing SoH in the cloud, we reduce the on-vehicle com- the already available training data and then incrementally train the
pute demand, thereby indirectly reducing overall costs. By computing model on batches of data comprising samples from the memory buffer
SoH in the cloud, we reduce the on-vehicle compute demand. SoH and incremental samples. The problem of catastrophic forgetting is
would not be a concern because it fluctuates very slowly. A cloud- addressed using a combination of samples from new data and memory
based interconnection connects the physical system and virtual model, buffers. A proportional number of samples from both new data and the
enabling data transfer. In this paper, we propose a continual learning memory buffer can prevent overfitting.
method for predicting SoH. This strategy employs incremental data Reservoir sampling is used to generate a memory buffer from the
to train the model, enabling the model to generalize to all operating training data in this implementation. If the training set contains 𝑁
samples and we are required to create a memory buffer containing 𝑀
conditions. SoC is estimated using Kalman filter techniques that employ
samples, then the probability of selection in random sampling will be
both Coulomb counting and Open Circuit Voltage (OCV) techniques for 𝑀
. In this algorithm, the first 𝑀 entries are directly copied into a data
precise estimations. SoC and SoH data are exchanged via cloud-based 𝑁
array 𝐷𝑀 , and from 𝑀 + 1 to 𝑁 times, a random number is generated.
interconnections so that the user can obtain information regarding both
The entry corresponding to that random number in 𝐷𝑀 is replaced with
parameters. an entry in 𝐷𝑁 . Algorithm 1 is the pseudo-code representation of the
SoH represents a battery’s current capacity in proportion to its Reservoir sampling technique. The generated reservoir sample is used
rated capacity. SoH provides data on battery degradation and aids for fine-tuning the base model using a continual learning algorithm.
in preventing accidents through predictive maintenance. Generally, a Using the memory buffer sampled from training data, the model is
battery is considered degraded when its current capacity falls between trained on 𝑘 size data batches upon receiving incremental data. These
70 − 80% of its initial capacity (Lin et al., 2015). batches of size 𝑘 are composed of a single instance of incremental

4
N.D.K.M. Eaty and P. Bagade Expert Systems With Applications 229 (2023) 120444

Algorithm 1: Reservoir Sampling from the battery, and the battery must rest before measurement, which
Input : Complete Data of size N and required sample size M is impossible in real-time. Due to their drawbacks, the two methods de-
Output: Sample of size M scribed above cannot be used independently. The Kalman filter method
1 Let array 𝐷𝑁 is complete data and array 𝐷𝑀 is sample computes estimates using the aforementioned techniques. The Kalman
2 for 𝑖 ← 1 to 𝑀 do filter assumes that the Gaussian distributions of the two preceding tech-
3 𝐷𝑀 [𝑖] = 𝐷𝑁 [𝑖] niques are independent. Estimates derived from combining these two
4 end will result in a new Gaussian distribution with a new mean and reduced
5 for 𝑖 ← 𝑀 + 1 to 𝑁 do variance. It is well known that Kalman filter approaches provide precise
6 j = randomNumber(0, N) measurements (Welch, Bishop, et al., 1995).
7 if 𝑗 ≤ 𝑀 then The Kalman filter method consists primarily of three steps: pre-
8 𝐷𝑀 [𝑗] = 𝐷𝑁 [𝑖] diction, measurement, and updating. Using these steps, the Kalman
9 end filter recursively generates a new estimate based on the previous and
10 end measured values. In the estimation of SoC using Kalman filter methods,
11 return 𝐷𝑀 the SoC-OCV mapping technique is regarded as the measurement step.
The coulomb counting step will be the prediction step, and the next
best estimate will be computed based on the previous estimate using
Algorithm 2: Continual Learning with Reservoir Sampling these two variables. The mathematical formula for the Kalman filter is:
Let the state estimate and estimate variance matrix be 𝑥𝑡−1 and 𝑃𝑡−1
Input : Incremental training data pushed into Blob Storage
at time 𝑡 − 1 given in Eq. (3) and (4). The state equations are problem
Output: Latest model after incremental training session
specific and can vary in a different problem setting
1 𝐷𝑀 ← 𝑅𝑒𝑠𝑒𝑟𝑣𝑜𝑖𝑟𝑆𝑎𝑚𝑝𝑙𝑖𝑛𝑔(𝐷𝑁 , 𝑁, 𝑀)
[ ]
2 for (𝑥, 𝑦) in 𝐷𝑡 do 𝑆𝑜𝐶(%)
𝑥𝑡−1 = (3)
/* Create random batch of size k */ 𝐶𝑢𝑟𝑟𝑒𝑛𝑡(𝐼)
3 𝐷𝑏 ← 𝑟𝑎𝑛𝑑𝑜𝑚𝑆𝑎𝑚𝑝𝑙𝑒(𝐷𝑀 , 𝑥, 𝑦, 𝑘, 𝑀) [ 2 ]
𝜎 0
/* Mini-batch SGD */ 𝑃𝑡−1 = 𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑒 2 (4)
0 𝜎𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑒
4 𝜃 ← 𝑚𝑖𝑛𝑖 − 𝑆𝐺𝐷(𝐷𝑏 , 𝜃, 𝑙𝑒𝑎𝑟𝑛𝑖𝑛𝑔𝑟𝑎𝑡𝑒)
/* Add new sample to train data */ Next in the prediction step, the change in 𝑆𝑜𝐶(%) is accounted for
5 𝐷𝑁 ← 𝐷𝑁 ∪ (𝑥, 𝑦) using the coulomb counting method, which is the charge taken out from
6 end the battery. This is represented as a transformation matrix 𝐹𝑡 given by
[ ]
𝛥𝑡
1 − 10800 × 100
𝐹𝑡 = (5)
0 1
data and 𝑘 − 1 randomly sampled data from the memory buffer. The The new state estimate 𝑥𝑡 and estimate variance 𝑃𝑡 after the predic-
model is trained using mini-batch Stochastic Gradient Descent (mini- tion step is given by
batch SGD) to update the model weights using a specific learning rate. [ ]
In mini-batch SGD gradients are computed on smaller batches instead 𝑆𝑜𝐶(%)
𝑥𝑡 = 𝐹𝑡
of the complete data sample. Finally, the new incremental data sample 𝐼
is pushed into the training data set that will be used for generating the [ 2 ]
𝜎 0
next reservoir sample. Algorithm 2 is the pseudo-code explanation of 𝑃𝑡 = 𝐹𝑡 𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑒 2 𝐹𝑇
0 𝜎𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑒 𝑡
the continual learning algorithm.
SoC is expressed as a proportion of the battery’s current capac- Next, in the measurement step, using the SoC-OCV mapping, the
ity to its capacity when fully charged. Therefore, SoC must be es- change in SoC is computed by multiplying the observation matrix with
timated in real-time in an EV to determine the vehicle’s remaining the state estimate. Here observation matrix would be an identity matrix
range. In addition, accurate range estimation would prevent roadside as we are not performing any manipulation on the measurements.
breakdowns. [ ]
1 0
𝐻̄ = (6)
0 1
3.1.3. Kalman filter approach [ ]
SoC can be estimated using primitive techniques like Coulomb 𝑆𝑜𝐶(𝑂𝐶𝑉 )
𝑦𝑡 = 𝐻̄ (7)
Counting and Open Circuit Voltage (OCV). The coulomb counting 𝐼
method calculates the amount of charge leaving or entering a battery
where 𝐻̄ is the observation matrix, and 𝑦𝑡 is the state measurement.
by integrating the current over time. SoC decreases due to the current
Also, we consider noise in measurements, and this is an input of how
drawn from the battery during discharging. During charging, current
much weight measurement is given than prediction while computing
flows into the battery, increasing its SoC.
the final estimate.
The coulomb counting method has a few problems: [ 2 ]
𝜎 0
𝑅̄ = 𝑚𝑒𝑎𝑠 (8)
• The estimates depend on the initial SoC value. Incorrect initial- 0 2
𝜎𝑚𝑒𝑎𝑠
ization would lead to erroneous estimates.
• The current values measured by sensors can be erroneous, causing A low value in observation noise 𝑅̄ indicates that we assign more
a drift in estimates. weight to measurements than predictions. Finally, compute the next
• It does not account for self-discharging. Current sensors cannot best estimate by computing Kalman Gain, multiply it with residual, and
capture self-discharging. add it to the previous estimate.
The residual vector 𝑧𝑡 is given as the difference between the state
The open-circuit voltage is calculated using a look-up table, and measurement and state prediction.
a reference discharge/charge is performed to construct the SoC-OCV
̄ 𝑡
𝑧𝑡 = 𝑦𝑡 − 𝐻𝑥 (9)
mapping. Like the Coulomb counting method, the Kalman filter can
exhibit drift in estimations based on inaccurate measurements. In ad-
dition, to precisely measure the OCV, the load must be disconnected 𝑆𝑡 = ⟨𝐻|𝑃
̄ 𝑡 |𝐻̄ 𝑇 ⟩ + 𝑅̄ (10)

5
N.D.K.M. Eaty and P. Bagade Expert Systems With Applications 229 (2023) 120444

Fig. 2. Digital twin flow using azure technologies.

The Kalman gain is computed using the residual variance, observa- A client–server architecture is designed with the server hosting the
tion, and prediction variance matrices are given by web application and the Vehicle BMS as the client (implemented on
Raspberry Pi). Voltage, current signals, and SoC data are transmitted
𝐾𝑡 = 𝑃𝑡 𝐻̄ 𝑇 𝑆𝑡−1 (11)
to the cloud via a web-socket connection between the server and the
Using Kalman gain, the final state estimates 𝑥𝑡 and state variance client.
matrices are updated as given in Eqs. (12) and (13)
Algorithm 3: Azure Session Training Pipeline
𝑥𝑡 = 𝑥𝑡 + 𝐾𝑡 𝑧𝑡 (12)
Input : Incremental training data pushed into Blob Storage
Output: Latest model after incremental training session
𝑃𝑡 = (1 − 𝐾𝑡 )𝑃𝑡 (13) 1 Pull the session training code from the GitHub repository to the
The above steps are recursively applied to get the next best esti- Azure virtual machine.
mates from the previous estimate. 2 Install the required Python version.
3 Install required packages Eg:- Azure CLI, Pytorch.
4. Digital twin implementation on cloud 4 Download the latest model from Azure ML workspace.
5 Download new incremental data from Azure blob storage.
Digital twin consists of three primary elements: physical system, vir- 6 Register the updated model on ML workspace.
tual representation, and an interconnection between the physical and
virtual systems. The physical system collects sensor data and computes
required real-time quantities for smooth operation. The physical system Finally, a web application is developed to display the information to
uses the connection interface to transmit sensor data to the cloud. administrators and end users. The web application displays the number
This data is utilized by the digital/virtual system for data analytics, of healthy batteries, the health of a specific battery (SoH), and the SoC
predictive maintenance, and simulations to comprehend the physical data sent by the on-vehicle BMS.
system. In the case of a digital twin for an EV battery, the physical
system will be the central ECU (electronic control unit), which collects 4.1. Continual learning on digital twin
battery data from the on-vehicle BMS and vehicle information such
as torque, speed, etc., from controllers via the CAN (controller area Initially, the base model will be trained using battery testers and
network) communication protocol. From the perspective of a battery, indoor experimentation data. The base model is then registered on
the primary function of the physical system is to estimate the SoC, as Azure ML workspace, which will be used to make predictions. In a
the SoC is an important parameter that provides an estimate of the real-world scenario, the incremental battery data running in different
remaining range. The cloud-hosted digital representation is a battery operating conditions can be acquired from service centers or vehicles by
model that performs predictive analysis, such as predicting the battery’s connecting to the internet. This incremental training data is pushed into
SoH, using data from the physical system (see Fig. 2). Azure blob storage and stored as containers. A continuous integration/
In this work, a digital twin for an EV battery is developed in which continuous deployment(CI/CD) pipeline described in Algorithm 3 is
the physical system is implemented on Raspberry Pi, and the digital developed to conduct incremental training on newer data. The pipeline
model is hosted on the Microsoft Azure cloud platform. The digital is termed CI/CD because even when the model is deployed, the model
representation is built using several modules from the Azure cloud gets updated on newer data. Soon after the update, the model gets
platform, which are briefed below: instantaneously deployed to make predictions. The main functionality
of the pipeline is to download data from blob storage, fetch the latest
• Azure Blob Storage: Microsoft’s storage service for storing mas- model from the Azure ML workspace, train the fetched model on the
sive amounts of unstructured data. Blob storage enables the cre- incremental data, and update the trained model back to the azure ml
ation of data lakes, which can aid in data analytics. workspace. On getting new data into blob storage, azure logic apps are
• Azure Logic Apps: A PaaS (Platform as a Service) tool capable used to trigger the DevOps pipeline to start the incremental training
of connecting multiple applications and services. The primary session. Azure logic apps periodically check for updates in the blob
function is to create automated workflows that do not require storage and generate triggers on noticing differences in blob storage
human intervention to initiate processes upon the occurrence of content. After the incremental training session, further battery health
an event. predictions are made using the updated model. This helps generalize
• Azure ML Workspace: A cloud-based machine learning service the model even after the model is deployed to make predictions.
that enables the creation of datasets, registration of different
model versions, and the execution of experiments using cloud 5. Experimental setup & results discussion
computing resources.
• Azure DevOps: A Microsoft service that enables development 5.1. Dataset description
teams to collaborate and create pipelines that execute a sequence
of events on Azure compute resources. It enables developers Among several available battery cycling datasets, not all are close
to build continuous integration/continuous deployment (CI/CD) to practical operating conditions because the batteries are cycled with
pipelines and deploy cloud-based applications. constant charging/discharging currents. In realistic scenarios, the EV

6
N.D.K.M. Eaty and P. Bagade Expert Systems With Applications 229 (2023) 120444

after a few sessions, the model is generalized as the reservoir samples


contain data from all batteries in some session or other. Fig. 4 shows
the model’s actual versus SoH prediction curves after five sessions of
continual learning with reservoir sampling. From the images and error
values it can be concluded, the model can trace most of the actual
SoH degradation patterns, and it can be concluded that the model can
generalize on the battery data.

5.3. State of Charge (SoC) estimation results

Fig. 5 shows the change in SoC of battery RW1 during the initial
few charging and discharging cycles. In the first discharge cycle, the
SoC of the battery is 100% and gradually decreases to 45%. In the
next cycle, the battery SoC suddenly moves to close to 93%, this
is because that particular cycle corresponds to charging. Since the
Fig. 3. Capacity degradation pattern of two battery sets cycles in different operating charging and discharging cycles are completely random, the fall of SoC
conditions. during discharge is not uniform. Sometimes, the gradient of the fall is
high, and some other times it is low. Also, the battery is not charged
or discharged to the same SoC levels since the currents drawn from
battery undergoes random cycling with varying currents, as the current the batteries are random, as mentioned in the dataset description (Bole
drawn from the battery depends on accelerations and decelerations. et al., 2014).
The NASA Prognostics Center for Excellence compiled a random battery
dataset by cycling Lithium-ion (Li-ion) cells at various operating tem- 6. Pipeline timelines
peratures (Bole, Kulkarni, & Daigle, 2014). This dataset is the closest
publicly accessible representation of a real-world operational scenario. Fig. 6 shows the time taken by each step in the incremental training
Fig. 3 shows the capacity degradation curves of eight 2Ah Li- pipeline, from checking out the code to registering the updated model
ion cells cycled with random currents up to 4.5 A. The batteries are back onto the Azure ML workspace. The time taken for executing the
discharged by drawing random currents for 5 min with a rest time complete pipeline is around 7 − 8 min. The majority of this time was
of 1 s between changing currents, and they are charged by drawing contributed by the bash script that installs the required packages. The
random currents until full charge or for a period of 30 min to 3 h. time taken for performing session training is just around 1.5 min. From
After 50 random cycles, a 2A reference cycle is performed on the these timelines, we can infer that the time required for execution is
battery parameters with a common ground. In the pre-processing step, much less if we send data at a period of, say 6 months. This is also
scalograms are generated using the continuous wavelet transform and because of the heavy computing power that is available on the cloud.
passed as inputs to the continuous learning model. Further, the time can be reduced by having a fixed compute and pre-
installing all the requirements one time then the time required would
5.2. State of Health (SoH) prediction results be around 3 − 4 min which is a considerable reduction.

In this experiment, RW1, RW2, RW9, and RW10 batteries are con- 7. Conclusion and future work
sidered available battery data before deploying the model and are
referred to as base data. These batteries’ information is used to pre-train In this work, a Digital Twin framework for electric vehicle batteries
the base model. The base model is a compressed Alexnet (Krizhevsky, to estimate the battery capacity and predict battery health is developed.
Sutskever, & Hinton, 2012) with a fully connected layer converted to a A digital twin is the virtual modeling of the physical system. The
regression layer without pre-trained weights. We use the battery data physical system, i.e., the on-vehicle BMS, collects data from sensors,
of RW7 as the incremental battery data to perform continuous learning. estimates the real-time parameter State of Charge, and sends the data
The RW8 and RW11 batteries are used as test data to evaluate the to the cloud. The digital model hosted on the Microsoft Azure platform
model’s performance after continuous learning. uses this information to build a model to predict the SoH. We also
The RW7 battery data has been partitioned into five sections to proposed a new continual learning approach with experience replay for
simulate continuous learning. Base data is used to generate a random SOH estimation, in which the deep learning network is incrementally
memory buffer. For each sample in the incremental data, an incremen- fine-tuned on new data. The inputs to the model are time–frequency
tal sample is generated using the reservoir sampling method described scalograms generated by CWT transform of voltages and current sig-
in Section 3.1.2. Mini-batch SGD is used to fine-tune the model using nals. First base training is performed on the readily available data
this sample. In mini-batch SGD, the gradient is computed on fixed- covering most operating scenarios but not all. The model then is incre-
size batches of the entire incremental sample. Five partitions of the mentally trained on newer data as and when they come. The proposed
RW7 data are utilized for continuous learning. Two metrics are used framework is experimented on NASA randomized battery, and after five
to evaluate the model’s performance: mean square error (MSE) and incremental training sessions, an MSE of 0.022 is achieved on RW11.
mean absolute percentage error (MAPE). Table 2 shows the MSE and The SoC, which needs to be computed in real-time for range estimation,
MAPE values of the model performance evaluated on all batteries after can be estimated using Coulomb counting or direct circuit voltage
each session of continual learning. The model generalizes after every methods. These have drawbacks and will account for significant losses
session of fine-tuning as the error values of some batteries slightly in the long run. Kalman filter uses both coulomb counting and voltage-
increased, whereas the error values decreased for some batteries. The based techniques to give the best estimate. Finally, the computed SoC
error values of RW1 initially decreased slightly after the first two and SoH are exchanged between cloud and vehicle, completing the
sessions, but in the third session, the error values increased. This is digital twin.
because, during fine-tuning, the model learns a pattern to fit samples The current implementation does not gather real-world data from
from the reservoir sample, including samples from RW7 and random the vehicles running in different conditions, which should be the
samples from base data, and in session 3 there might not be any samples case. To simulate this, we divided complete data into partitions. As
from RW1. This randomness is the only uncertainty in the approach, but part of future work, we will install these frameworks in on-vehicle

7
N.D.K.M. Eaty and P. Bagade Expert Systems With Applications 229 (2023) 120444

Fig. 4. SoH actual and prediction curves produced after five sessions of continual learning using RW7 data. Base training is performed using RW1, 2, 9, and 10. RW8, and 11
are used for testing.

Table 2
Results of SoH estimation produced after five sessions of incremental training using RW7 data. Base training is performed using RW1, 2, 9, and 10. RW8, and 11 are used for
testing.
Battery name Base training Session 1 Session 2 Session 3 Session 4 Session 5
MSE MAPE (%) MSE MAPE (%) MSE MAPE (%) MSE MAPE (%) MSE MAPE (%) MSE MAPE (%)
RW1 0.01 5.05 0.009 5 0.009 5.03 0.0089 5.07 0.0089 5.13 0.012 5.75
RW2 0.019 7.49 0.019 7.52 0.017 7.32 0.019 7.63 0.017 7.16 0.014 6.37
RW7 0.065 13.7 0.059 13.1 0.058 12.98 0.059 13.19 0.056 12.86 0.051 12.35
RW8 0.05 11.81 0.05 12.43 0.048 12.22 0.05 12.5 0.047 12.02 0.04 11.2
RW9 0.016 8.65 0.015 8.6 0.015 8.48 0.016 8.77 0.015 8.47 0.013 7.92
RW10 0.013 7.16 0.013 7.14 0.013 7.1 0.013 7.18 0.013 7.08 0.013 7.14
RW11 0.024 9.69 0.023 9.67 0.023 9.64 0.023 9.64 0.022 9.57 0.023 9.65

BMS and collect data from on-road vehicles. We will use driving
pattern information to predict SoH values for individual users. We will
implement additional functionalities such as analytics and driver as-
sistance systems on the digital twin in order to provide the user
with direct feedback and suggestions for altering his driving style in
order to extend the battery life. In addition, manufacturer assistance
will be developed to provide manufacturers with data on the number
of batteries that degrade within a given time period, allowing them
to regulate production quantities. The disadvantage of the continual
learning approach for SoH prediction is the need to store previously
viewed data, which can be costly depending on the size of the data, an
alternative can be devised for storing the data. Current SoC estimation
Fig. 5. SoC estimation for RW1 during the first few discharging/charging cycles. requires matrix inversion, which is expensive and of order 𝑂(𝑛3 );
therefore, a less expensive method would further reduce the overall cost
and hardware requirement. In the near future, we intend to develop a
less complicated technique for SoC estimations.

8
N.D.K.M. Eaty and P. Bagade Expert Systems With Applications 229 (2023) 120444

El-Dalahmeh, M., Al-Greer, M., El-Dalahmeh, M., Short, M., et al. (2020). Time-
frequency image analysis and transfer learning for capacity prediction of lithium-ion
batteries. Energies, 13(20), 5447.
Guo, R., & Shen, W. (2021). A review of equivalent circuit model based online state of
power estimation for lithium-ion batteries in electric vehicles. Vehicles, 4(1), 1–29.
Hong, S., Kang, M., Jeong, H., & Baek, J. (2020). State of health estimation for lithium-
ion batteries using long-term recurrent convolutional network. In IECON 2020 the
46th annual conference of the IEEE industrial electronics society (pp. 1929–1934). IEEE.
Jo, S., Jung, S., & Roh, T. (2021). Battery state-of-health estimation using machine
learning and preprocessing with relative state-of-charge. Energies, 14(21), 7206.
Kamran, S. S., Haleem, A., Bahl, S., Javaid, M., Nandan, D., & Verma, A. S. (2022).
Role of smart materials and digital twin (DT) for the adoption of electric vehicles
in India. Materials Today: Proceedings, 52, 2295–2304.
Khumprom, P., & Yodo, N. (2019). A data-driven predictive prognostic model for
lithium-ion batteries based on a deep learning algorithm. Energies, 12(4), 660.
Krizhevsky, A., Sutskever, I., & Hinton, G. E. (2012). Imagenet classification with deep
convolutional neural networks. Advances in Neural Information Processing Systems,
25.
Lee, J.-H., & Lee, I.-S. (2021). Lithium battery SOH monitoring and an SOC estimation
algorithm based on the SOH result. Energies, 14(15), 4506.
Lin, C., Tang, A., & Wang, W. (2015). A review of SOH estimation methods
in lithium-ion batteries for electric vehicle applications. Energy Procedia, 75,
1920–1925.
Rassõlkin, A., Rjabtšikov, V., Kuts, V., Vaimann, T., Kallaste, A., Asad, B., et al. (2022).
Interface development for digital twin of an electric motor based on empirical
performance model. IEEE Access, 10, 15635–15643.
Ren, G., Ma, G., & Cong, N. (2015). Review of electrical energy storage system for
vehicular applications. Renewable and Sustainable Energy Reviews, 41, 225–236.
Roman, D., Saxena, S., Robu, V., Pecht, M., & Flynn, D. (2021). Machine learning
pipeline for battery state-of-health estimation. Nature Machine Intelligence, 3(5),
Fig. 6. Incremental training pipeline timing. 447–456.
Salucci, C. B., Bakdi, A., Glad, I. K., Vanem, E., & De Bin, R. (2021). Simple statistical
models and sequential deep learning for lithium-ion batteries degradation under
dynamic conditions: Fractional polynomials vs neural networks. arXiv preprint
CRediT authorship contribution statement arXiv:2102.08111.
Sejdić, E., Orović, I., & Stanković, S. (2018). Compressive sensing meets time–frequency:
An overview of recent advances in time–frequency processing of sparse signals.
Naga Durga Krishna Mohan Eaty: Conceptualization, Methodol- Digital Signal Processing, 77, 22–35.
ogy, Writing – original draft. Priyanka Bagade: Writing – review and Shikata, H., Yamashita, T., Arai, K., Nakano, T., Hatanaka, K., & Fujikawa, H. (2019).
editing, Supervision. Digital twin environment to integrate vehicle simulation and physical verification.
SEI Technical Review, 88, 18–21.
Singh, M., Fuenmayor, E., Hinchy, E. P., Qiao, Y., Murray, N., & Devine, D. (2021).
Declaration of competing interest
Digital twin: origin to future. Applied System Innovation, 4(2), 36.
Smith, K., Saxon, A., Keyser, M., Lundstrom, B., Cao, Z., & Roc, A. (2017). Life
The authors declare that they have no known competing finan- prediction model for grid-connected li-ion battery energy storage system. In 2017
cial interests or personal relationships that could have appeared to American control conference (pp. 4062–4068). IEEE.
influence the work reported in this paper. Tao, F., Zhang, H., Liu, A., & Nee, A. Y. (2018). Digital twin in industry: State-of-the-art.
IEEE Transactions on Industrial Informatics, 15(4), 2405–2415.
Valdez Parra, R., Pothureddy, G., Sanitas, T., Krishnamoorthy, V., Oluwafemi, O.,
Data availability Singh, S., et al. (2021). Digital twin-driven framework for EV batteries in auto-
mobile manufacturing. In Transdisciplinary engineering for resilience: responding to
Public dataset has been used for the analysis system disruptions (pp. 181–190). IOS Press.
Venkatesan, S., Manickavasagam, K., Tengenkai, N., & Vijayalakshmi, N. (2019). Health
monitoring and prognosis of electric vehicle motor using intelligent-digital twin. IET
References Electric Power Applications, 13(9), 1328–1335.
Venugopal, P., et al. (2019). State-of-health estimation of li-ion batteries in electric
Bartlett, A. P. (2015). Electrochemical model-based state of charge and state of health vehicle using indRNN under variable load condition. Energies, 12(22), 4338.
estimation of lithium-ion batteries. The Ohio State University. Welch, G., Bishop, G., et al. (1995). An introduction to the Kalman filter.
Bole, B., Kulkarni, C. S., & Daigle, M. (2014). Adaptation of an electrochemistry-based Wu, J., Zhang, C., & Chen, Z. (2016). An online method for lithium-ion battery
li-ion battery model to account for deterioration observed under randomized use. remaining useful life estimation using importance sampling and neural networks.
In Annual conference of the PHM society, Vol. 6. Applied Energy, 173, 134–140.
Cai, Y., Yang, L., Deng, Z., Zhao, X., & Deng, H. (2018). Online identification of lithium- Xu, H., Peng, Y., & Su, L. (2018). Health state estimation method of lithium ion battery
ion battery state-of-health based on fast wavelet transform and cross D-Markov based on nasa experimental data set. In IOP conference series: materials science and
machine. Energy, 147, 621–635. engineering, Vol. 452. IOP Publishing, Article 032067.
Choi, Y., Ryu, S., Park, K., & Kim, H. (2019). Machine learning-based lithium-ion Yan, R., Gao, R. X., & Chen, X. (2014). Wavelets for fault diagnosis of rotary machines:
battery capacity estimation exploiting multi-channel charging profiles. IEEE Access, A review with applications. Signal Processing, 96, 1–15.
7, 75143–75152. Zhou, J., Liu, D., Peng, Y., & Peng, X. (2012). Dynamic battery remaining useful life es-
Eaty, N. D. K. M., & Bagade, P. (2022). Electric vehicle battery management using timation: An on-line data-driven approach. In 2012 IEEE international instrumentation
digital twin (accepted for publication). In IEEE COINS: IEEE international conference and measurement technology conference proceedings (pp. 2196–2199). IEEE.
on omni-layer intelligent systems, Vol. 1 (pp. 1–5). IEEE.

You might also like