Core Temperature Estimation Method for Lithium-ion Battery Based on Deep Learning and Particle Swarm Optimization

In the operation of energy storage systems and electric vehicles, the real-time monitoring of the internal state of a li ion battery is paramount for safety and reliability. Among all parameters, the core temperature is a direct and critical indicator. During charge and discharge cycles, electrochemical reactions and ohmic losses generate heat. If this heat is not dissipated effectively, it leads to a rise in the li ion battery‘s internal temperature. This temperature increase can accelerate degradation mechanisms, reduce lifespan, and in extreme cases, trigger thermal runaway—a dangerous chain reaction that can result in fire or explosion. Therefore, accurate knowledge of the core temperature is essential for implementing effective thermal management strategies and ensuring safe operating boundaries.

However, directly measuring the core temperature of a li ion battery in practical applications is highly challenging. Invasive methods, such as embedding thermocouples into the cell, alter its structure, pose sealing challenges, and are not cost-effective for mass-produced battery packs. Surface temperature measurements, commonly available in Battery Management Systems (BMS), are insufficient because there can be a significant lag and gradient between the surface and the core, especially under high-power operations where differences can exceed 20°C. Consequently, developing accurate, non-invasive estimation methods for the core temperature has become a significant research focus.

Existing estimation approaches can be broadly categorized into model-based and data-driven methods. Model-based methods, such as thermal-electrochemical coupling models or impedance-based models, rely on a deep understanding of the li ion battery‘s physical and chemical principles. While potentially accurate, these models often involve complex partial differential equations, require numerous hard-to-measure parameters, and incur high computational costs, making them difficult to implement in real-time BMS applications. Impedance spectroscopy methods, though highly correlated with temperature, need specialized equipment to obtain spectra, rendering them impractical for online estimation.

Data-driven methods offer a promising alternative. They bypass the need for explicit physical modeling by learning the complex, non-linear relationship between easily measurable operational variables (like current, voltage, surface temperature, and ambient temperature) and the target core temperature. With the advent of powerful computational resources, deep learning techniques have shown remarkable success in various li ion battery state estimation problems, including State of Charge (SOC), State of Health (SOH), and Remaining Useful Life (RUL) prediction. Their ability to automatically extract hierarchical features from sequential data makes them particularly suited for time-series forecasting tasks like temperature estimation.

Among deep learning architectures, Recurrent Neural Networks (RNNs) are designed to handle sequential data. However, standard RNNs suffer from the vanishing/exploding gradient problem, which limits their ability to learn long-term dependencies. Long Short-Term Memory (LSTM) networks overcome this by incorporating gating mechanisms (forget, input, and output gates) that regulate the flow of information. A further enhancement is the Bidirectional LSTM (Bi-LSTM), which processes data in both forward and backward temporal directions. This allows the network to capture patterns from past and future contexts relative to any point in the sequence, leading to a richer understanding of the dynamics affecting the li ion battery core temperature.

Nevertheless, the performance of a Bi-LSTM model heavily depends on the configuration of its hyperparameters, such as the number of neurons, the batch size for training, and the dropout rate to prevent overfitting. Manually tuning these parameters is a time-consuming and often suboptimal trial-and-error process. To address this, optimization algorithms can be employed for automatic hyperparameter search. The Particle Swarm Optimization (PSO) algorithm is a popular, robust, and efficient metaheuristic inspired by the social behavior of bird flocking or fish schooling. It works by having a population (swarm) of candidate solutions (particles) move through the hyperparameter space, guided by their own best-known position and the swarm’s best-known position, to find an optimal or near-optimal configuration.

In this work, we propose a novel core temperature estimation method for li ion battery that synergistically combines a Bi-LSTM neural network with the PSO algorithm. The Bi-LSTM model learns the temporal dynamics from measurable inputs to predict the core temperature, while the PSO algorithm automatically optimizes the Bi-LSTM’s key hyperparameters to maximize prediction accuracy. This approach aims to deliver a highly accurate, data-driven estimator that is suitable for online implementation in BMS, enhancing the safety management of li ion battery systems across a wide range of operating conditions.

Proposed Methodology: Bi-LSTM-PSO Framework

The core of our estimation strategy is a data-driven model that maps a sequence of readily available measurements to the corresponding li ion battery core temperature. We define our input vector at time step t as comprising four crucial operational variables:

$$ \mathbf{x}_t = [I_t, V_t, T_{a,t}, T_{s,t}] $$

where \( I_t \) is the current (A), \( V_t \) is the voltage (V), \( T_{a,t} \) is the ambient temperature (°C), and \( T_{s,t} \) is the surface temperature (°C). The target output is the core temperature \( T_{c,t} \). The objective is to learn a function \( f \) such that:

$$ \hat{T}_{c,t} = f(\mathbf{x}_{t-k:t}) $$

where \( \hat{T}_{c,t} \) is the estimated core temperature and \( \mathbf{x}_{t-k:t} \) represents a historical sequence of inputs from time \( t-k \) to \( t \).

Bidirectional Long Short-Term Memory (Bi-LSTM) Network

The LSTM unit is designed to remember information over long time intervals. At its heart are three gates that control the cell state \( \mathbf{c}_t \). The forget gate \( \mathbf{f}_t \) decides what information to discard from the previous cell state \( \mathbf{c}_{t-1} \). The input gate \( \mathbf{i}_t \) and a candidate cell state \( \tilde{\mathbf{c}}_t \) determine what new information to store. Finally, the output gate \( \mathbf{o}_t \) controls what part of the cell state is output to the hidden state \( \mathbf{h}_t \). The mathematical formulation for a single LSTM layer is as follows:

Forget Gate: $$ \mathbf{f}_t = \sigma(\mathbf{W}_f \cdot \mathbf{x}_t + \mathbf{U}_f \cdot \mathbf{h}_{t-1} + \mathbf{b}_f) $$

Input Gate: $$ \mathbf{i}_t = \sigma(\mathbf{W}_i \cdot \mathbf{x}_t + \mathbf{U}_i \cdot \mathbf{h}_{t-1} + \mathbf{b}_i) $$

Candidate State: $$ \tilde{\mathbf{c}}_t = \tanh(\mathbf{W}_c \cdot \mathbf{x}_t + \mathbf{U}_c \cdot \mathbf{h}_{t-1} + \mathbf{b}_c) $$

Cell State Update: $$ \mathbf{c}_t = \mathbf{f}_t \odot \mathbf{c}_{t-1} + \mathbf{i}_t \odot \tilde{\mathbf{c}}_t $$

Output Gate: $$ \mathbf{o}_t = \sigma(\mathbf{W}_o \cdot \mathbf{x}_t + \mathbf{U}_o \cdot \mathbf{h}_{t-1} + \mathbf{b}_o) $$

Hidden State Output: $$ \mathbf{h}_t = \mathbf{o}_t \odot \tanh(\mathbf{c}_t) $$

Here, \( \sigma \) denotes the sigmoid activation function, \( \tanh \) is the hyperbolic tangent function, \( \odot \) represents the Hadamard (element-wise) product, \( \mathbf{W} \) and \( \mathbf{U} \) are weight matrices, and \( \mathbf{b} \) are bias vectors.

A standard LSTM processes sequences in the forward direction only. A Bi-LSTM enhances this by employing two separate LSTM layers: one processing the sequence from start to end (forward layer), and another processing it from end to start (backward layer). For each time step \( t \), the final hidden representation is a concatenation of the forward hidden state \( \overrightarrow{\mathbf{h}_t} \) and the backward hidden state \( \overleftarrow{\mathbf{h}_t} \):

$$ \mathbf{h}_t = [\overrightarrow{\mathbf{h}_t}; \overleftarrow{\mathbf{h}_t}] $$

This bidirectional context allows the model to capture dependencies from both past and future inputs relative to every point in the sequence, which is highly beneficial for understanding the thermal dynamics of a li ion battery, where temperature is influenced by both recent and imminent power demands.

The output from the Bi-LSTM layers is then fed into a fully connected (Dense) layer to produce the final scalar output: the estimated core temperature \( \hat{T}_{c,t} \).

Hyperparameter Optimization using Particle Swarm Optimization (PSO)

The predictive accuracy of the Bi-LSTM model is sensitive to several key hyperparameters. We focus on optimizing three:

  1. Number of Neurons (N): The dimensionality of the hidden state in the LSTM layers.
  2. Dropout Rate (D): The fraction of neurons randomly dropped during training to prevent overfitting.
  3. Batch Size (B): The number of samples processed before the model’s internal parameters are updated.

Manually tuning these parameters is inefficient. We employ PSO to find an optimal set \( \mathbf{P} = [N, D, B] \). In PSO, a swarm of \( M \) particles explores the hyperparameter space. Each particle \( i \) has a position \( \mathbf{X}_i \) (representing a candidate hyperparameter set) and a velocity \( \mathbf{V}_i \). Each particle remembers its personal best position \( \mathbf{Pbest}_i \) and the swarm knows the global best position \( \mathbf{Gbest} \). The velocity and position are updated iteratively according to the following equations:

Velocity Update:
$$ \mathbf{V}_i^{(k+1)} = \omega \cdot \mathbf{V}_i^{(k)} + c_1 \cdot r_1 \cdot (\mathbf{Pbest}_i – \mathbf{X}_i^{(k)}) + c_2 \cdot r_2 \cdot (\mathbf{Gbest} – \mathbf{X}_i^{(k)}) $$

Position Update:
$$ \mathbf{X}_i^{(k+1)} = \mathbf{X}_i^{(k)} + \mathbf{V}_i^{(k+1)} $$

where \( k \) is the iteration index, \( \omega \) is the inertia weight, \( c_1 \) and \( c_2 \) are cognitive and social acceleration coefficients, and \( r_1, r_2 \) are random numbers uniformly distributed in [0,1]. The fitness of a particle’s position is evaluated by training a Bi-LSTM model with those hyperparameters on a training dataset and measuring its error on a validation set. We use the Root Mean Square Error (RMSE) as the fitness function \( F \):

$$ F(\mathbf{X}_i) = \text{RMSE} = \sqrt{ \frac{1}{N_v} \sum_{j=1}^{N_v} (T_{c,j} – \hat{T}_{c,j})^2 } $$

where \( N_v \) is the number of validation samples. The PSO algorithm seeks to minimize this fitness value.

Integrated Bi-LSTM-PSO Estimation Framework

The overall workflow for building the li ion battery core temperature estimator is as follows:

  1. Data Preparation: Collect time-series data of {I, V, Ta, Ts, Tc} from experiments under various conditions. Split the data into training, validation, and test sets.
  2. PSO Initialization: Define the search boundaries for N, D, and B. Initialize the PSO swarm with random positions and velocities.
  3. Iterative Optimization:
    • For each particle’s position (hyperparameter set), construct and train a Bi-LSTM model on the training data.
    • Evaluate the trained model on the validation set to compute the RMSE (fitness).
    • Update each particle’s Pbest and the swarm’s Gbest based on the fitness.
    • Update particle velocities and positions using the PSO equations.
  4. Termination: Repeat step 3 until a maximum number of iterations is reached or the Gbest fitness meets a predefined accuracy threshold.
  5. Final Model: The hyperparameters from the final Gbest are used to train the final Bi-LSTM model on the combined training and validation data. This model is then evaluated on the independent test set.

This automated framework ensures that the Bi-LSTM model is configured for optimal performance without manual guesswork, leading to a robust and accurate estimator for the li ion battery core temperature.

Experimental Validation and Analysis

To validate the proposed Bi-LSTM-PSO method, comprehensive experimental data is required, including the true core temperature of a li ion battery. This necessitates an invasive but controlled setup for ground truth measurement.

Battery Instrumentation and Test Platform

A commercial 18650 cylindrical li ion battery with a LiNi0.5Co0.2Mn0.3O2 cathode and a nominal capacity of 2.5 Ah was used. To measure the internal core temperature, a small hole was carefully drilled along the central axis of the cell, and a fine-gauge K-type thermocouple was inserted. The hole was then sealed with epoxy resin to prevent electrolyte leakage. Validation tests confirmed that this modification had a negligible impact on the electrical characteristics (voltage and current profiles) of the li ion battery during standard charge-discharge cycles.

The test platform consisted of:

  • A high-precision battery cycler for applying charge/discharge profiles and logging current and voltage data at 1 Hz.
  • K-type thermocouples attached to the battery surface and placed in the ambient environment.
  • A thermal chamber to control and maintain a constant ambient temperature during tests.
  • A data acquisition system to synchronously record all thermocouple readings (core, surface, ambient).

Test Protocols and Data Collection

To ensure the model’s robustness across diverse real-world scenarios, tests were conducted under a wide range of conditions:

  • Ambient Temperatures: 5°C, 15°C, 25°C, 35°C, and 45°C.
  • Operational Profiles:
    1. Constant Current Constant Voltage (CCCV) Charge: At rates of 0.5C, 1C, and 2C.
    2. Constant Current (CC) Discharge: At rates of 0.5C, 1C, and 2C.
    3. Dynamic Stress Test (DST): A standardized profile representing variable power demand.
    4. Urban Dynamometer Driving Schedule (UDDS): A driving cycle representing city driving conditions.

Sufficient rest periods were included between cycles to allow the li ion battery to return to thermal equilibrium. This comprehensive testing generated a rich dataset capturing the dynamic thermal behavior of the li ion battery under varying loads and environmental conditions.

Model Implementation and Training Details

The Bi-LSTM-PSO framework was implemented in Python using the Keras library with TensorFlow backend. The PSO search space for the hyperparameters was defined as follows:

Hyperparameter Search Range
Number of Neurons (N) 16 to 128
Dropout Rate (D) 0.05 to 0.14
Batch Size (B) 160 to 640

The PSO parameters were set as: swarm size M=4, cognitive and social coefficients \( c_1 = c_2 = 0.5 \), inertia weight \( \omega = 0.5 \). The optimization loop was set to terminate if the RMSE on the validation set fell below 0.08°C or after a fixed number of iterations. Data from CCCV, CC, and part of the dynamic profiles were used for training and validation. The remaining dynamic profile data (DST and UDDS) were held out as a completely independent test set to evaluate the model’s generalization capability.

Estimation Performance and Results

The proposed method’s performance was evaluated on the independent test sets featuring the complex DST and UDDS profiles. The PSO algorithm efficiently found optimal hyperparameter combinations, typically converging within 8 iterations for the various temperature conditions. The estimation accuracy was quantified using three metrics:

  • Mean Absolute Error (MAE): \( \text{MAE} = \frac{1}{n} \sum |T_c – \hat{T}_c| \)
  • Root Mean Square Error (RMSE)
  • Maximum Error (ME)

The following table summarizes the performance of the Bi-LSTM-PSO model across different ambient temperatures for the two dynamic profiles:

Profile Ambient Temp. (°C) PSO Iterations ME (°C) RMSE (°C) MAE (°C)
UDDS 5 3 0.319 0.076 0.061
15 4 0.208 0.049 0.038
25 7 0.175 0.041 0.033
35 6 0.145 0.041 0.033
45 4 0.172 0.047 0.039
DST 5 5 0.249 0.071 0.062
15 3 0.171 0.041 0.032
25 6 0.289 0.090 0.079
35 8 0.162 0.033 0.026
45 3 0.191 0.042 0.034

The results demonstrate exceptional accuracy. Across all tested conditions, the RMSE remained below 0.09°C, and the MAE was below 0.08°C. The largest maximum error observed was 0.319°C. More importantly, the model’s prediction curves closely tracked the measured core temperature throughout the highly dynamic DST and UDDS cycles, effectively capturing both the slow thermal drift and rapid temperature fluctuations caused by sudden current changes. This confirms the model’s ability to generalize across a wide ambient temperature range (5°C to 45°C) under realistic, variable-load driving conditions.

Comparative Analysis with Other Methods

To highlight the superiority of the proposed Bi-LSTM-PSO approach, its performance was compared against three other established estimation methods using the DST data at 35°C:

  1. Thermal Model (TM): A simplified lumped-parameter thermal model based on energy balance.
  2. Decision Tree (DT): A non-linear regression model based on tree structures.
  3. Random Forest (RF): An ensemble learning method using multiple decision trees.

Each comparative model was tuned to its best performance via cross-validation. The results are summarized below:

Estimation Method ME (°C) MAE (°C) RMSE (°C)
Thermal Model (TM) 0.6375 0.2400 0.2787
Decision Tree (DT) 0.4259 0.0969 0.1195
Random Forest (RF) 0.2989 0.0656 0.0773
Bi-LSTM-PSO (Proposed) 0.1625 0.0262 0.0334

The comparative analysis clearly shows that the data-driven methods (DT, RF, Bi-LSTM-PSO) significantly outperform the simplified physical model (TM). Among the data-driven techniques, the proposed Bi-LSTM-PSO method achieves the lowest error across all metrics. Its MAE (0.0262°C) is less than half that of the next best method (RF at 0.0656°C), and its RMSE (0.0334°C) is similarly superior. This demonstrates that the Bi-LSTM’s ability to learn complex temporal dynamics, enhanced by PSO-driven hyperparameter tuning, provides a distinct advantage for accurately estimating the core temperature of a li ion battery under dynamic operating conditions.

Conclusion and Future Work

Accurate real-time estimation of the core temperature is vital for the safe and efficient operation of li ion battery systems. This work successfully developed and validated a novel, non-invasive estimation method by integrating a Bidirectional Long Short-Term Memory (Bi-LSTM) neural network with a Particle Swarm Optimization (PSO) algorithm. The Bi-LSTM model effectively learns the intricate temporal relationship between measurable operational variables—current, voltage, ambient temperature, and surface temperature—and the internal core temperature. The PSO algorithm automates the critical but tedious process of hyperparameter tuning, ensuring the Bi-LSTM model operates at its peak performance.

Experimental validation on a commercial 18650 li ion battery under a wide range of ambient temperatures (5°C to 45°C) and dynamic load profiles (DST, UDDS) confirmed the method’s high accuracy and robustness. The model achieved very low estimation errors, with RMSE consistently below 0.09°C and often as low as 0.033°C. A comparative study demonstrated that the proposed Bi-LSTM-PSO method significantly outperforms other common estimation techniques, including thermal modeling, decision trees, and random forests. The primary advantages of this approach are its high accuracy, applicability to complex real-world driving cycles, and suitability for online implementation in battery management systems without the need for specialized measurement hardware.

For future work, several directions can be explored to enhance the practicality and scope of this method. First, the model should be validated on a larger and more diverse dataset, including different li ion battery chemistries (e.g., LFP, NMC), formats (pouch, prismatic), and aging states to improve its generalizability. Second, transfer learning techniques could be investigated to adapt a pre-trained model to a new li ion battery type with minimal additional data. Third, the integration of this core temperature estimator with other state estimation functions (like SOC and SOH) within a unified BMS framework would be a valuable step towards developing more intelligent and comprehensive battery management solutions. Finally, exploring the model’s performance under extreme fault conditions, such as those leading to thermal runaway, could further contribute to advanced safety warning systems.

Scroll to Top