Application of Deep Neural Networks for Lithium-Ion Battery Surface Temperature Estimation Under Driving and Fast Charge Conditions

The temperature of lithium-ion batteries (LIBs) is a critical factor that significantly impacts the performance of the battery. One of the essential roles of the battery management system (BMS) is to monitor and control the temperature of the cells in the battery pack. In this article, two deep neural network (DNN) modeling approaches are used to predict the surface temperature of LIBs. The first model type is based on a feedforward neural network (FNN) enhanced with external filters, while the second model is based on a recurrent neural network (RNN) with long short-term memory (LSTM). These models are trained and tested using experimental data from two batteries, one cylindrical cell, and one pouch cell at a range of driving, fast charging, and health conditions. The proposed models are shown to be capable of estimating temperature with less than 2 °C root-mean-square error (RMSE) for challenging low ambient temperature drive cycles and just 0.3 °C for 4 C rate fast charging conditions. In addition, a model which was trained to estimate the temperature of a new battery cell was found to still have a very low error of just 0.8 °C when tested on an aged cell. Both models are deployed to an NXP S32K344 microprocessor to measure their execution time and memory use. The FNN executes significantly faster on the microprocessor than the LSTM, 0.8 ms compared with 2.5 ms for models with around 3000 learnable parameters, and uses less random access memory (RAM), 0.4 kB compared with 1 kB.


I. INTRODUCTION
O NE of the essential functions of the battery management system (BMS) is to monitor the performance of lithium-ion batteries (LIBs). Battery temperature is a critical factor that should be monitored to ensure safe and reliable battery operation [1]. The temperature of the battery also impacts the accuracy of battery state estimation, including state of charge (SOC) [2] and state of health (SOH) [3].
Temperature monitoring of the battery pack is essential to avoid, in the worst case, thermal runaway and destruction of the pack. Temperature sensors are widely used to measure the temperature of battery cells. However, it is often impractical to sense the temperature of every cell due to cost, number of sensor inputs, and wiring complexity. Robust temperature estimation models can be used as an alternative to physical sensors or can perform as a redundant monitoring system for the existing sensors. In addition, these models can be applied to detect battery thermal and short circuit faults [4], [5] by monitoring the residual of the estimated and measured cell temperatures.
Several methods for estimating cell temperature have been investigated in prior research. These methods include electrochemical impedance spectroscopy (EIS)-based methods [6], [7], [8], partial differential equation (PDE) thermal-based methods [9], [10], [11], [12], and data-driven methods [13], [14], [15], [16]. In the EIS methods, one or several frequencies of ac current are injected into the battery. Then, based on the ac voltage response, the impedance of the battery is measured and is correlated with the temperature. The EIS method requires complex BMS hardware though, and cannot easily be performed during operation [6]. The PDE methods are multistate models that capture the thermal behavior of the batteries with reasonable accuracy. These models emulate the generation and transfer of heat in the battery considering the thermal boundary conditions. These methods are shown to be capable of modeling the temperature distribution of LIBs with lumped [9] or multidimensional 1-D [10], 2-D [11], and 3-D [12] models. However, the more complex versions of these methods are not easily implemented in real time on a BMS because they involve a high number of parameters and complex mathematical operations.
Recently, data-driven methods, which are based on machine learning, have been used to model nonlinear, time-dependent system behavior and are a promising alternative for battery temperature estimation. Machine learning-based models are trained with measured battery data, with inputs such as voltage and current and outputs such as SOC or temperature. Such models learn to mimic LIB behavior and have been used for terminal voltage modeling [17], SOC [2] and SOH [3] estimation, and recently for temperature estimation [13], [14], [15], [16]. In [13], a recurrent neural network (RNN) model, This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ with measured current, SOC, and ambient temperature as inputs, estimates battery cell voltage and surface temperature. The RNN model was shown to estimate the battery surface temperature during a portion of a low-temperature drive cycle, where battery temperature was between 1 • C and 8 • C, with an error of less than 2 • C.
The work in [14] investigated different artificial neural network (ANN) model inputs to estimate battery surface temperature. The study concluded that feeding the model with measured voltage, current, and the prior time step of the predicted temperature led to predicting the battery surface temperature with a maximum estimation error (MAXE) of less than 3 • C and less than 0.3 • C root-mean-square error (RMSE). While this study does show very low error, it is not clear if unique data was used for training and testing the network, and only temperatures of 25 • C or greater were investigated, so the proposed methodology may not achieve as good of results under more realistic scenarios. The work in [15] uses a radial basis function feedforward neural network (FNN) model with a Kalman filter to estimate the internal core temperature of a battery. The inputs to the model have measured surface temperature, voltage, and current, and a very low RMSE of less than 0.1 • C and MAXE of less than 0.3 • C are achieved for estimating internal core temperature. The reported results are excellent, but since the measured surface temperature is an input to the model, it is not really comparable to algorithms that aim to estimate surface temperature like [13] and [14], and the algorithms proposed in this study. In [16], a preliminary investigation of the application of nonrecurrent and RNNs for battery surface temperature estimation was presented. Different combinations of network inputs were investigated, and around 3 • C MAXE was achieved to drive automotive drive cycles.
While multiple studies have investigated neural networks (NNs) for temperature estimation, these studies have only examined a limited range of operating conditions, and none have investigated the practicality of implementing the algorithms in a BMS microprocessor. Hence, the main contributions of this article are summarized as follows.

II. OVERVIEW OF DNNS
In recent years, ANNs have shown strong capability in extracting features from nonlinear complex mathematical relationships. DNNs are ANNs containing more than one hidden layer. There are several types of ANNs including FNNs, RNNs, and convolutional NNs (CNNs). Each NN type varies in structure, characteristics, and application. FNNs are commonly used in fault diagnosis of power systems [18] and pattern recognition [19]. RNNs were developed to model problems requiring memory so that past information is considered when calculating the current output. RNNs have shown strong performance in stock market forecasting [20], battery SOC estimation [2], and speech recognition [21]. For very large inputs, such as images, FNNs would have a large, complex structure for which determining the model weights and biases is challenging. CNNs, which utilize convolution on the inner layers, were developed to deal with image recognition and classification problems in an efficient and effective manner [22]. LIB modeling and state estimation are considered regression problems where FNNs and RNNs are commonly used. This section presents an overview of the FNN and the LSTM-RNN which are used in this study. The hyperparameters and framework for training the models is discussed as well.

A. Feedforward Neural Network
FNNs are a type of ANN where data is fed in a forward direction from the input to the output [18]. The simplest FNN has input and output layers where each layer has a certain number of neurons (n). Multiple intermediate layers (l) can be used in larger, more complex problems. The inputs fed to the first layer neurons are x 1 to x NI , where NI is the number of inputs, as shown in Fig. 1. The inputs are multiplied with the respective weight, w l,n i , summed, and added to the bias value (b l,n i ) and output hidden state value h. Each neuron also uses an activation function, F l,n , to improve the performance of the network. Activation functions include the hyperbolic tangent, clipped rectified linear unit (CRELU), and leaky rectified linear unit (LRELU). Different activation functions are presented in [23] along with more details regarding the FNN. Equation (1) Unlike the LSTM, the FNN does not have a memory cell embedded in the model and, therefore, does not encode information from the previous time steps. Several studies addressed improving the FNN performance by adding some filtered data to the inputs, such as voltage and current [23], [24]. In this study, the accuracy of the FNN is evaluated with one or two first-order low-pass Butterworth filters applied to the voltage and current measurements. The Butterworth filter is selected due to its smooth frequency response roll-off and less phase delay. The frequency response [H ( f )] of the filter is described in the following equation: where f c is the chosen cutoff frequency, maximum passband gain ε is equal to 1, and the filter order n is equal to 1.

B. RNN With LSTM Layer
The LSTM layer is commonly used to overcome the vanishing or exploding gradient issue which can occur during the backpropagation training process for some RNN types [20]. An LSTM layer comprises a memory cell (C k ), a memory candidate (C k ), an input gate (V k ), an output gate (U k ), and a forget gate ( F k ), as shown in Fig. 2. The memory cell is utilized to save information from past time steps, and the three gates control the flow of information to and from the cell. The LSTM layer utilizes the input data at the present time step ( k ) and hidden state values from the preceding time step ( H k−1 ) to update the current hidden states (H k ). The number of learnable parameters (LP LSTM ) for an RNN with a single hidden LSTM layer can be calculated as a function of the number of hidden units (HU) and the number of inputs using the following equation [23]:

C. Neural Network Training Framework
In this section, the training of the proposed NNs and the corresponding hyperparameters are presented. The NN model parameters, i.e., weights and biases, are updated iteratively during the backpropagation phase based on the loss (L) between the estimated and the actual output according to the following equation: where P is the total length of the input training data, O k is the actual output that is the measured surface temperature of the battery at each time step k, and Ô k is the estimated output which is battery surface temperature at time k in this study.
The initial learning rate for the training process, which specifies how much the weights and biases can be adjusted for each epoch, is set to 0.01. The learning rate drop factor is 10%, and the patience is 1000 epochs, meaning that the learning rate is dropped by 10% every 1000 epochs. The training and testing datasets are resampled to 1 Hz and normalized so their values are between 0 and 1. All the training data is used as one minibatch for each update of the training parameters. The training process stops after the validation dataset accuracy does not improve for 300 consecutive epochs. Most trainings continued for around 5000 epochs, taking approximately 3 h for the FNN and 13 h for the LSTM models. The network's learnable parameters are randomly initialized at the start of each training. Each network configuration is trained between three and 20 times with different initial parameters each time, helping to ensure a global-or near-global optimal solution is achieved. The network was created and trained with a similar script to that shared in [24] using MATLAB 2020b, the MATLAB Deep Learning Toolbox, and an Intel Core i7 CPU. Table I lists the different parameters used in the training process of the proposed NN models.

III. TEST SETUP AND DATASETS
Two batteries with different chemistries are used to train and validate the proposed models. The first battery is a Panasonic  18650PF LIB cell with lithium nickel cobalt aluminum oxide (NCA) chemistry and 2.9-Ah rated capacity, as shown in Fig. 3. This battery is cycled at different dynamic conditions with a range of drive cycles at different ambient temperatures. One temperature sensor was placed on the outer surface to monitor the temperature of the cell. The second cell is a Kokam lithium nickel manganese cobalt oxide (NMC) pouch cell, which is tested at different fast charging rates in a liquidcooled module with three parallel (3P1S) cells, as shown in Fig. 4(a). Between each cell is a 0.26-cm-thick aluminum plate for cooling and fifteen T-type thermocouples are placed throughout the module. Seven of the thermocouple measurements are used in this study, including four placed on the face of the middle cell as shown in Fig. 4(b) and one on the coolant inlet and another on the outlet. A 200-W chiller with a 15-L/min coolant flow rate is used to cool the module and is connected to copper cooling tubes attached to the edges of the fixture as illustrated in Fig. 5. The thermocouple temperatures are logged in LabVIEW and measured with a National Instruments NI-9213 thermocouple module. Table II presents the specifications of each cell [25], [26], while the battery cycler and thermal chamber specifications are listed in Table III.
Two types of datasets were collected for the Panasonic battery, one of which has −20 • C, −10 • C, 0 • C, 10 • C, and 25 • C fixed ambient temperature and the other of which has varied ambient temperature, as described in Table IV. The battery is cycled using four standard drive cycles, namely, Urban Dynamometer Driving Schedule (UDDS), Unified     5.5/5.5, and 7.5/20.8 A, respectively. The mixed cycles are referred to as Mix 1-5. The varied ambient temperature tests start at either −20 • C or 10 • C, and the temperature rise throughout the tests is achieved by turning the cooling system off while leaving the circulating fans on. The varied ambient temperature tests are used to test how the temperature estimation models perform when the thermal conditions around a battery are changing. The drive cycle power profiles are generated from a model of an electric truck with a 35-kWh battery pack and are scaled for a single 18650PF cell. The battery was fully charged at 25 • C prior to each drive cycle test. Each drive cycle was repeated until the battery SOC reached between 10% and 30% depending on the temperature. This final SOC value was selected based on when the battery can no longer provide enough power to continue. The five mixed drive cycles at each fixed ambient temperature are used to train the proposed NN models and are labeled listed as Training data in Table IV. The four standard drive cycles with fixed ambient temperature are used for Validation and the mixed drive cycles with varied ambient temperature are used for Testing the best trained NN models and are referred to as the Fixed Ambient Temperature and Varied Ambient Temperature datasets, respectively.
The Kokam module is charged at currents ranging from 1-5 C, which is 93-465 A. For all the tests the thermal chamber ambient temperature and the chiller coolant temperature are regulated to 20 • C. Fig. 6 shows the temperature collected from the thermocouples for a 5-C charge. The thermocouple measurement which reaches the highest temperature, TC3, is used when training and testing the temperature estimation algorithms in this study. The 1-, 3-, and 5-C rate charge data is used for training, while the 2-C charge is used for validation and the 4 C for testing, as listed in Table IV. Fig. 7 shows the battery temperature versus amp-hours discharged or charged for the training, validation, and testing datasets of both batteries. The figure shows that the training data covers the whole capacity range of the battery and that the NN model will need to in effect interpolate between the trained temperature data in almost all test cases and extrapolate beyond 30 • C for a few of the Panasonic tests.

IV. NEURAL NETWORK MODEL STRUCTURES AND FNN FILTER FREQUENCY DETERMINATION
In this section, the structure of the investigated FNN and LSTM is presented. In addition, a study is performed to determine the optimal filter frequency values used for the filtered voltage and current inputs to the FNN. Two hidden layers with 50 neurons each are used, which is expected to be a sufficient number of neurons and layers to achieve good accuracy [24]. The output layer consolidates all the neuron outputs to create a single output value for the network, estimated temperature (T s ). The investigation in this section focuses on determining the proper corner frequency for the optional filtered input values. A wide range of corner frequencies, for both one and two sets of filtered inputs, is considered. First, a single set of filtered voltage and current inputs is investigated, such that inputs are {V f 1 , I f 1 , SOC, T a }. Twentyone networks are trained with the Panasonic cell Training data and filter frequencies varying from 0.01 to 100 mHz. These cover the range of frequencies over which the LIB electrical and thermal time constants are likely to occur. The average Validation dataset error is shown in Fig. 9 for all three trainings performed for each filter frequency value. The figure shows that the standard deviation of the three training repetitions is quite small, from 0.02 • C to 0.11 • C, verifying that three trainings are sufficient to ensure the best solution is achieved. With a filter frequency of 1 mHz, the least error is achieved, just 1.16 • C, which is 43% less than the 2.05 • C error achieved for the FNN without filtered voltage and current as inputs, where inputs are instead {V, I, SOC, T a }. The error is high for both low-and high-frequency filter values because with a high-frequency filter, the signal is similar to the unfiltered signal, and when the filter frequency is very low the output of the filter is essentially a dc value and provides no meaningful additional information. The similar error for the studied highand low-frequency filters also shows that a sufficiently wide range of filter values was investigated.

A. Determination of Optimal Corner Frequency for Filters on FNN Input Data
Next, voltage and current filtered at 1 mHz, the filter value which achieved the best results with a single filter, are used along with voltage and current filtered at a second frequency, such that inputs are {V f 1 , I f 1 , V f 2 , I f 2 , SOC, T a }. Networks are trained for 12 frequencies, ranging from 0.01 mHz to 100 Hz, and the results are presented in Fig. 10. The addition of the second set of filtered values is shown to achieve a 0.14 • C, 12% reduction in error for filter frequencies equal to 4 and 8 mHz.
For the in-depth analysis in Sections V and VI, three FNN model structures are used based on the above analysis, the four-input model with no filtered inputs, the four-input model with 1-mHz filtered inputs, and the six-input model with 1-and 4-mHz filtered inputs, as listed in Table V. Importantly, the model filter frequencies are selected purely based on the analysis of the Validation dataset error above, and the testing dataset which will be used in Section V is kept blinded from the selection of the optimal filter frequencies.

B. LSTM Model Structure
The LSTM has internal memory embedding information from past time steps, so it is not necessary to include filtered data as an input as was done for the FNN. Fig. 8(b) shows the LSTM temperature estimation model structure used in this study, including the layers and activation functions. Voltage, current, SOC, and ambient temperature are used as inputs. One hidden layer is used, and it includes 25 hidden units, where each hidden unit is the LSTM structure shown in Fig. 2. Twenty-five hidden units are used so that the total number of learnable parameters, 3026 as listed in Table V, is similar to the FNN.
In summary, the LSTM and the three FNN configurations Section IV will be compared in the analysis for varied Temperature estimation error of each model for fixed ambient temperature Panasonic drive cycle Validation data. ambient temperature operation in Section V and fast charging in Section VI. The acronym, number of inputs and types, and number of parameters for each of the four models are presented in Table V.

V. TEMPERATURE ESTIMATION FOR PANASONIC CELL ELECTRIC VEHICLE DRIVE CYCLES
In this section, the temperature estimation models with configurations discussed in Section IV are trained with the Panasonic cell drive cycle Training data, as defined in Table IV. Each of the four models, three FNNs, and one LSTM, as listed in Table V, is trained 20 times. The error of each of the trained models is calculated using the Validation dataset, which consists of the Fixed Ambient Temperature dataset. The trained model with the lowest validation error is then selected and evaluated using the Testing dataset, which consists of the Varying Ambient Temperature dataset which is more representative of conditions in an actual electric vehicle.

A. Training Process With Multiple Training Repetitions to Select Best Trained Model via Validation Data
Each of the four models is trained 20 times with unique initial parameters to ensure that the global optimum solution is reached and that a fair comparison between the model types is performed. The average of the rms temperature estimation error for all the Validation cycles is calculated and is plotted for each model type and training repetition in Fig. 11. The figure shows that is important to perform multiple training repetitions, since the difference between the best and worst trained FNN with 1-and 4-mHz filters is quite significant, around 0.5 • C. The difference is even greater for the LSTM, around 1.1 • C. The trained model with the lowest Validation error-an error of 2.00 • C for FNN (N/F), 1.12 • C for FNN (1 mHz), 0.96 • C for FNN (1 and 4 mHz), and 0.50 • C for LSTM-is selected for evaluation in Section VI. Notably, the error decreases substantially as more filtered inputs are added to the FNN, and the LSTM achieves about half the estimation error of the best FNN.

B. Temperature Estimation Accuracy for Best-Trained Models and Varying Ambient Temperature Test Data
In this section, the four best-trained models are evaluated using the independent set of Testing data, the Varying Ambient Temperature drive cycle data, as described in Section III and Table IV. These drive cycles start at −20 • C or 10 • C and have a temperature rise of as much as 35 • C. The temperature estimated by the FNN with 1-mHz filters and by the LSTM is plotted for two of the drive cycles in Fig. 12. Even though the temperature rise is quite significant, the error is around 2.5 • C or less for the LSTM and 4 • C or less for the FNN for this Mix 1 cycle. The rms error for each of the eight Testing cycles is then plotted in Fig. 13, showing that the LSTM typically achieves around 5%-10% lower error than the FNN. Besides, both models show a stable error for the testing drive cycles with the FNN average error of 1.8 • C and the LSTM error of 1.6 • C. The average rms and maximum error of the eight Testing cycles for each model type are then plotted in Fig. 14, showing that the LSTM still achieves the best accuracy, although by a smaller margin than was observed for the Validation data. While the error for the Testing data is much higher than for the Validation data, nearly twice as high for the FNN and three times as high for the LSTM, the results demonstrate that the models can estimate temperature for data which is very different than the data which the model was trained with. This is an important characteristic for electric vehicle applications, where a wide range of operating conditions exist across different climates, terrain, and use cases. Overall, the accuracy of the temperature estimation is still quite reasonable, with less than 2 • C rms error for all but the FNN with no filters, less than 4.5 • C max error for the FNNs with filters, and less than 4 • C max error for the LSTM. Considering that low-cost physical temperature sensors are often rated for several degrees Celsius of error, the machine learning algorithms appear to be an excellent alternative. Finally, one unexpected result was that the FNN error is slightly higher with two input filters, suggesting that when only marginal benefits of a second filter are observed during validation it may not be beneficial to include the additional filter.

VI. TEMPERATURE ESTIMATION FOR KOKAM CELL FAST CHARGING
During fast charging, the battery is charged at a high rate for a short time, resulting in significant loss and temperature rise which is challenging to capture in battery thermal models. This section investigates and highlights the NN model's capability to capture the temperature transients associated with fast charging. Similar to Section V, each network is first trained multiple times, then the best trained networks are selected using the validation data, and finally, the error is evaluated for independent test data. Error is also presented as a function of the number of learnable parameters, giving insight into network sizing.

A. Training Process With Multiple Training Repetitions to Select Best Trained Model via Validation Data
Each model is trained 20 times with unique initial parameters to ensure the global optimum solution is reached, just as was done for the Panasonic drive cycle data. The model is trained with a 1-, 3-, and 5-C fast charge, and a 2-C fast charge is used for validation, as specified in Table IV. The validation error for each training repetition is shown in Fig. 15. Each FNN training repetition has a similar error, while   4 mHz), and 0.29 • C for LSTM. The FNN performance again improves as more filters are added, even though the filter frequencies were selected using an analysis of Panasonic cell data. This suggests that if the filter frequencies are close to the electrical and thermal time constants of the battery system, this should be sufficient to improve the performance of the FNN.

B. Temperature Estimation Accuracy for Best-Trained Models and 4-C Fast Charge Test Data
In this section, the best-trained models as identified in Section V are evaluated for the 4-C fast charge Testing data. Fig. 16 shows the estimated temperature of the FNN (1 mHz) and LSTM models for the 4-C fast charge, as well as the other C-rate fast charges used for training and validation. The FNN error is exceptionally low for the 4-C fast charge Testing case, never exceeding 1 • C, which is impressive considering that the 1-, 3-, and 5-C fast charges used for training have quite different temperature rise. The LSTM error is quite a bit higher, exceeding 2 • C at one point. Both models struggle to fit the 1-C fast charge training data accurately, but this is likely due to fluctuations in the coolant and battery temperature caused by on and off cycling of the chiller when the loss is very low. Fig. 17, shows the rms error and maximum error of the four models for the 4-C fast charge. Overall, the FNN with the 1-and 4-mHz filtered inputs has the lowest error, just 0.3 • C rms error and 0.65 • C maximum error. This error is very low, which demonstrates that the FNN temperature estimation model could effectively be used along with a terminal voltage estimation model for predicting temperature for different fast charge profiles, enabling temperature to be regulated during fast charging with model predictive control for example. The LSTM, which performed best for the drive cycles tested in Section V, had a somewhat higher RMSE of 0.41 • C and more than three times higher maximum error of 2.29 • C. The fast charge dataset is smaller in size compared with the drive cycle, typically around 7% as long (29 341 data points for fast charge versus 434 797 data points for drive cycles). The LSTM performs worse in this case because the smaller amount of training data may not be sufficient to fully train the memory aspects of the LSTM. The fast charging voltage/current profiles are also less dynamic than the drive cycles which makes the fast charge a less complex problem for a simple FNN to efficiently extract system features. There are not many numerical studies comparing the FNN and LSTM, but the study in [27] showed that for modeling dynamic systems, the FNN shows better performance than an RNN when the inputs are noise-free. While the experimental data is essentially noise-free due to the high accuracy of the battery cycler measurements, the drive cycle data could be considered similar to noise since it is highly dynamic, while the output is a smooth signal. In this way, the research in [27] could be considered to support the LSTM performing better than the FNN for drive cycle data in Section V.

C. Impact of Number of Learnable Parameters on Temperature Estimation Accuracy
In Sections IV-VI-B, each temperature estimation model was configured with around 3000 learnable parameters. To investigate whether this number of parameters is necessary to achieve the best accuracy, FNN and LSTM models with   Table VI.
The error versus number of learnable parameters is plotted in Fig. 18 for the best model out of the 20 training repetitions, showing that both the FNN and LSTM error decreases as the learnable parameters increase. The FNN error decreases only slightly though, while the LSTM error decreases by about half as learnable parameters increase from 149 to 5236. It is notable that even the smallest FNN, with just 171 learnable parameters, has better accuracy than any of the LSTM models. These results clearly show that the FNN is well suited for estimating the temperature of constant current, constant voltage fast charges, achieving higher accuracy than the LSTM with a much smaller network.
Overall, the FNNs with filtered data inputs are shown to be more accurate for the fast charging cases, while the LSTM is more accurate for the more complex dynamic, varied temperature drive cycles. In Section VII, the execution time and the memory use will be measured for each model when it is deployed to a BMS microprocessor.

D. Impact of SOC Error on Temperature Estimation Accuracy
The proposed models utilize SOC as one of the inputs, where SOC is calculated from current measured using an accurate battery cycler in the laboratory. However, SOC estimation algorithms implemented in the vehicle cannot be 100% accurate. Hence, a robustness test case with SOC error is investigated in this subsection. A ±5% offset in SOC is added  to the 4-C fast charge data. Temperature is estimated using the FNN with a 1-mHz filter for the correct and offset SOC inputs, as shown in Fig. 19. The RMSE obtained by the FNN (1 mHz) for +5% and −5% offset in SOC are 0.35 • C and 0.28 • C, respectively, and the error is 0.3 • C with no SOC error. The error for the +5% SOC offset is just 15% greater than the error with the correct SOC, demonstrating that SOC error has a small impact on temperature estimation error. The maximum error obtained for both offset cases is still within 1 • C, which is quite acceptable given the fairly large SOC error. An accurate SOC estimation algorithm may achieve an error of less than 2% for most cases, which would result in even less temperature estimation error.

VII. MICROPROCESSOR EXECUTION TIME AND MEMORY USE
In this section, the three FNN models and the LSTM model with approximately 3000 learnable parameters and an FNN model with 171 learnable parameters, as listed in Table V, are deployed to a BMS microprocessor. The BMS microprocessor used in this study is an NXP S32K344 with a 32-bit 160-MHz Arm Cortex-M7 processor, as shown in Fig. 20 [28]. The microprocessor has 4 MB of flash memory and 512 kB of random access memory (RAM). The MATLAB/Simulink environment is used to generate C-code from the models which are implemented in Simulink. The C-code is generated using the MATLAB model-based design toolbox and is deployed to the microprocessor evaluation board using a universal asynchronous receiver-transmitter. The model execution time and memory use are then measured using a Simulink profile block. All the input signals are transferred from the host computer to the deployed algorithm executing on the microprocessor. Fig. 20 shows an example of the deployment of the FNN (1 mHz) model with 2851 parameters. The resulting error for the FNN (1 mHz) model is completely identical to the results attained with the algorithm running on a PC as presented in Figs. 16(a) and 17.
The microprocessor execution time to run one instance of each model is listed in Table VII. For the models with around 3000 learnable parameters, the execution time is around 0.8 ms for the FNNs and 2.5 ms for the LSTM, indicating that despite the models having the same number of learnable parameters the computational complexity of the LSTM, which includes nonlinear hyperbolic tangent and exponential gate functions, is higher. The results show that adding filtered inputs to the FNN results in a negligible execution time increase of a few microseconds. The execution time is much less for the FNN with 171 learnable parameters, just 0.09 ms, demonstrating that if slightly higher error is acceptable, a very computationally efficient algorithm can be used.
To implement one instance of each algorithm on the microprocessor, between 4 and 9 kB of flash memory are needed for the FNNs, while 53 kB is needed for the LSTM. This is just a fraction of the 4 Mb of flash memory available on the processor, demonstrating that the flash memory use of the proposed models is not a significant limitation to running them on a BMS. The models only require 0.2 to 1 kB of RAM, which again is just a small fraction of the 512 kB of RAM available on the processor and indicates that these algorithms could easily be implemented in a BMS.
In summary, execution time may be more of a limitation than memory use. Running the models 100 times, as would be needed to estimate the temperature of 100 cells, would consume between 8% and 25% of the processor time for a 1-Hz update rate and the 3000 parameter models. Fortunately, for the fast charging case at least, a significantly smaller FNN model can be used which would reduce the overall execution time substantially, requiring just 0.8% of processor time to run 100 models each second. The smaller FNN could also easily be run with a low-cost NXP S32K1 series microprocessor, which was observed in [29] to require about a factor of eight greater execution time compared with the NXP S32K3.

VIII. AGING STUDY AND MODELS BENCHMARKING VERSUS STUDIES IN THE LITERATURE
In the previous test cases, the proposed models were tested using experimental data from cells at the beginning of life (BOL). However, in any realistic scenario, the battery will experience aging while deployed in the vehicle. Therefore, in this test case, one of the proposed temperature estimation models is trained using charge profiles from a battery at BOL and is tested both at BOL and under aged conditions. Testing the NN under aged conditions shows if the correlation between input voltage, current, and SOC and the temperature rise is consistent throughout the life of the battery. An FNN (1 mHz) NN is used and is trained with experimental data from a 3-Ah capacity Samsung INR21700-30T cylindrical cell. The cell was subjected to an aging test performed at 25 • C over six months until the cell reached 80% SOH. For the aging tests, the cell is discharged with drive cycle power profiles and then boost charged (4-C rate followed by 2-C rate). Fig. 21(a) shows the measured voltage, current, and SOC during the boost charge for the cell at 100% and 80% SOH conditions.
The measured temperature and the temperature estimated by the FNN (1 mHz) model and the corresponding estimation error are shown in Fig. 21(b). The FNN (1 mHz) model error is quite low at 100% SOH, just 0.5 • C rms, and 1.15 • C max, and it only increases slightly at 80% SOH to 0.8 • C rms and 1.56 • C max. This demonstrates that the model, which was only trained on new data, successfully learned the correlation between terminal voltage, current, SOC, and temperature. The model essentially translated the higher terminal voltage of the more resistive aged cell to a higher temperature rise. To improve accuracy throughout the life of the cell, the proposed model can always be updated or calibrated either onboard in the cloud using data collected from a fleet of vehicles.
The proposed models are compared in Table VIII to other machine learning algorithms presented in the literature, including an LSTM, ANN, and FNN. The models are compared in terms of algorithm type, studied ambient temperatures, largest temperature rise case, and error.
The maximum error of these models varies from 1.5 • C to 7 • C, which is greater than the 0.7 • C-4 • C maximum error observed for the proposed models. Considering that the temperature rise reached up to 35 • C, which is twice as high as the studies in the literature. Besides, the proposed model showed around a 35% increase in estimating the temperature of an aged battery as compared to [14], where the model showed a 130% higher error for an aged battery. The FNN in our study has the advantage of decoding some memory information than in [30] by adding some selected filter frequencies. Besides, the LSTM model with voltage as an input in this study shows better performance than the LSTM in [13] with only current, SOC, and ambient temperature. The table also shows the superiority of the proposed study over other studies due to including a variety of dynamic and fast charge conditions which challenge any modeling approach.

IX. CONCLUSION
In this article, two DNN modeling approaches were proposed to predict the surface temperature of LIBs. The first model type is based on an FNN enhanced with external filters, while the second model is based on an RNN with LSTM. These models were trained and tested at a range of driving, charging, and health conditions, with up to 35 • C of temperature rise and 450 A of current for the fast charge tests. The models were also deployed to an NXP S32K344 BMS microprocessor to benchmark the models in terms of execution time and memory use. Including filtered voltage and current inputs to the FNN models considerably improved their performance, resulting in errors close to or better than for the LSTM. The proposed FNN with 1-mHz filter model is shown to be capable of predicting the temperature with a maximum error of no more than 4.5 • C for challenging, low-temperature drive cycles and no more than 0.7 • C for 4 C rate fast charges. Besides, the proposed model showed around a 35% increase in estimating the temperature of an aged battery than the beginning of life error. When running the models with around 3000 learnable parameters on the BMS microprocessor, the FNNs required about 1/3 the execution time, showing that the LSTM is much more computationally complex than the FNN. The results also showed that both flash and RAM memory use of the FNN is much lower than the LSTM.
Overall, the results show that machine learning algorithms are very effective at learning the relationship between battery temperature and measured terminal parameters, reducing the need to create complex battery loss and thermal models. The machine learning algorithms can also easily be implemented to a BMS microprocessor, and do not require excessive execution time or memory.