Lithium-ion energy battery storage is the enabling subsystem behind electric-vehicle performance, and its state of charge (SOC) is the variable that connects driver-facing range estimates with pack-level safety control. SOC is not measured directly; it must be inferred from voltage, current, temperature, and operating history. That inference is difficult because lithium-ion cells are nonlinear, history-dependent, and sensitive to temperature and load dynamics. BMS requirements are correspondingly tight: SOC error above about 3% is often treated as a risk threshold for overcharge or over-discharge protection, and a one-percentage-point reduction in error has been associated with roughly 200 additional cycles in some cycle-life studies.

Why conventional SOC estimators struggle
Coulomb counting integrates current over time, so its accuracy depends on a known initial SOC, accurate current sensing, and stable coulombic efficiency. Small sensor biases accumulate, and the method has no independent mechanism for correcting drift. Open-circuit voltage (OCV) methods exploit the relationship between resting voltage and SOC, but they require sufficiently long rest periods and are poorly suited to continuous vehicle operation. Electrochemical impedance spectroscopy can reveal internal cell states, but its hardware and measurement burden place it mainly in laboratory characterization rather than onboard monitoring.
Recurrent neural networks address part of this problem because they learn temporal dependencies directly from measured sequences. Long short-term memory (LSTM) networks add input, forget, and output gates around a cell state, allowing relevant history to persist across many time steps and reducing the vanishing-gradient problem of plain recurrent networks. A single LSTM, however, still compresses history into hidden states without explicitly reweighting the most informative time steps at the output stage. In a drive cycle, voltage transitions, current peaks, and recovery periods do not carry equal information for SOC. A model that treats every hidden state with the same importance can therefore miss the moments that matter most.
LSTM–Attention architecture
The hybrid model couples an LSTM sequence encoder with an attention layer. The LSTM processes the input window and produces a sequence of hidden states that encode time-dependent behavior. The attention layer then scores each hidden state, normalizes the scores with a softmax function, and forms a weighted context vector. That context vector is passed to a fully connected output layer that predicts SOC for the window. The design is intended to assign larger weights to informative segments—such as voltage steps, current peaks, and charge/discharge transitions—while retaining the LSTM’s ability to model long-range temporal dependence.
The training objective uses a Huber loss rather than plain squared error. Huber loss behaves quadratically for small residuals and linearly for large ones, which limits the influence of sensor spikes and other outliers. This is relevant for vehicle data, where communication dropouts, current transients, and temperature-dependent disturbances can produce isolated large errors. The attention mechanism and the robust loss address different problems: attention changes how temporal features are aggregated, while Huber loss changes how prediction errors influence parameter updates.
Dataset, features, and validation protocol
Validation uses the public CALCE lithium-ion battery dataset from the Center for Advanced Life Cycle Engineering at the University of Maryland. The cell is an INR 18650-20R ternary lithium-ion cell with a nominal capacity of 2,000 mAh and a nominal voltage of 3.6 V. The dataset includes controlled charge–discharge tests at 0 °C, 25 °C, and 45 °C, with US06 high-speed/high-load and FUDS urban drive cycles at each temperature. Data are sampled at 1 Hz and include voltage, current, and temperature time series.
The reported validation is restricted to 25 °C. Preprocessing removes invalid points caused by sensor noise or communication interruption and applies min–max normalization to map voltage, current, and temperature into [0, 1]. A sliding window of 100 time steps—100 s at 1 Hz—converts the continuous records into many-to-one supervised samples: each input contains 100 historical steps, and each output is the corresponding SOC value. The core inputs are voltage, current, and sampling interval; instantaneous power, cumulative discharge, and voltage change rate are added to strengthen the feature representation. For each drive cycle, the first 70% of the data form the training set and the remaining 30% form the test set. The chronological split preserves temporal order and avoids leakage from future samples into training.
Error metrics and comparative results
Model accuracy is reported with mean absolute error (MAE) and root mean square error (RMSE):
$$ \mathrm{MAE}=\frac{1}{n}\sum_{i=1}^{n}\left|y_i-\hat{y}_i\right| $$
$$ \mathrm{RMSE}=\sqrt{\frac{1}{n}\sum_{i=1}^{n}\left(y_i-\hat{y}_i\right)^2} $$
Here, \(n\) is the number of samples, \(y_i\) is the measured SOC, and \(\hat{y}_i\) is the predicted SOC. Lower values indicate better agreement. The comparison includes LSTM, GRU, GRU-Attention, and LSTM-Attention models under the same two 25 °C drive cycles.
| Model | US06 MAE (%) | US06 RMSE (%) | FUDS MAE (%) | FUDS RMSE (%) |
|---|---|---|---|---|
| LSTM | 2.02 | 2.47 | 1.54 | 2.33 |
| GRU | 3.73 | 5.30 | 1.91 | 2.48 |
| GRU-Attention | 6.27 | 6.43 | 4.28 | 4.74 |
| LSTM-Attention | 1.44 | 2.12 | 1.28 | 1.67 |
Values are percentage points of SOC; lower is better.
LSTM-Attention gives the lowest errors in both cycles: MAE 1.44% and RMSE 2.12% on US06, and MAE 1.28% and RMSE 1.67% on FUDS. Relative to the plain LSTM, the hybrid reduces MAE by 0.58 percentage points on US06 and 0.26 percentage points on FUDS. The residual errors are described as small and relatively balanced across the test windows, which supports the claim of stable behavior under both the high-load US06 profile and the stop-and-go FUDS profile.
What the comparison shows—and what it does not
The results support a specific architectural claim: LSTM temporal encoding plus attention-based weighting performs better than the recurrent baselines in these two 25 °C drive cycles. The comparison also contains a useful negative result. GRU-Attention is substantially worse than both GRU and LSTM, with MAE of 6.27% on US06 and 4.28% on FUDS. Attention is therefore not a plug-in improvement. Its benefit depends on the recurrent backbone, the training configuration, and the data regime; adding attention can degrade performance when the added flexibility is not matched by appropriate regularization or optimization.
The table reports point errors only. It does not provide confidence intervals, statistical significance tests, or an ablation that separates the effect of attention from the effect of the Huber loss. Because LSTM-Attention differs from plain LSTM in both feature aggregation and training objective, the isolated contribution of each change is not established by the table alone. The accuracy comparison also does not quantify inference latency, memory footprint, or energy cost, all of which matter for embedded BMS deployment.
Engineering scope and open questions
The validation scope is deliberately narrow: one cell type, one temperature, and two drive cycles. The CALCE dataset contains 0 °C and 45 °C tests, but the reported comparison uses only 25 °C. Cell dynamics, available capacity, and internal resistance change with temperature, so accuracy at 25 °C cannot be extrapolated directly to cold-start or high-temperature operation. Aging introduces a second shift: as the cell degrades, the mapping from voltage and current history to SOC changes, and a model trained on one aging state may drift when applied to another.
These limits define the next technical questions rather than invalidate the architecture. Temperature transfer, aging-aware training, and joint estimation of SOC and state of health are the natural extensions. For vehicle application, the attention layer’s computational cost must also be weighed against the BMS processor budget and the required update rate. The central lesson is that SOC estimation for lithium-ion energy battery storage is a sequence-modeling problem with strong operational constraints: temporal dependence must be captured, informative transients must be weighted, and the resulting model must remain stable when the drive cycle, temperature, or cell condition moves away from the validation set.
Conclusion
LSTM–Attention offers a coherent way to combine long-range temporal modeling with dynamic weighting of informative time steps. On the CALCE INR 18650-20R data at 25 °C, it achieves the lowest MAE and RMSE among the compared models under both US06 and FUDS cycles, with MAE of 1.44% and 1.28% and RMSE of 2.12% and 1.67%, respectively. The GRU-Attention result shows that attention alone is not a reliable performance guarantee. The evidence supports the hybrid model as a promising estimator under the tested conditions, while temperature generalization, aging robustness, ablation of architecture versus loss, and embedded inference cost remain open engineering questions.
