Scenario-based Analysis and Ultra-short-term Forecasting of Electric Vehicle Charging Load

Abstract This paper presents a novel approach for ultra-short-term forecasting of electric vehicle (EV) charging loads by integrating scenario-based analysis with an improved Transformer-long short-term memory (TransLSTM) model. The objective is to enhance prediction accuracy by capturing spatiotemporal characteristics of EV charging behavior. We first use the K-means clustering algorithm to categorize charging scenarios based on EV users’ travel habits and charging data. Then, a TransLSTM model is developed to leverage the self-attention mechanism of Transformer for feature interaction and LSTM for temporal dependency modeling. Experimental results on real-world data from Shijiazhuang validate the effectiveness of the proposed method, demonstrating superior performance compared to traditional LSTM and Transformer models.

Keywords: electric vehicle; charging load forecasting; clustering analysis; Transformer; LSTM; scenario-based modeling

1. Introduction

The proliferation of electric vehicles (EVs) has become a pivotal strategy for addressing global energy and environmental challenges. As EV adoption grows, accurate forecasting of their charging loads is critical for power grid stability, resource optimization, and integration of renewable energy sources. Ultra-short-term forecasting, in particular, is essential for real-time grid dispatch and responsiveness to dynamic charging demands.

Existing methods for EV charging load forecasting can be broadly categorized into statistical spatiotemporal distribution models and machine learning (ML)-based approaches. Statistical methods, while effective in modeling complex interactions between traffic flow, charging infrastructure, and user behavior, often struggle with short-term prediction accuracy. ML-based methods, such as LSTM and Transformer, have shown promise in capturing temporal patterns, but they face challenges in handling multi-dimensional features and long-range dependencies simultaneously.

In this study, we propose a hybrid approach that combines scenario-based analysis with an improved TransLSTM model. By clustering charging data into distinct scenarios (e.g., residential, workplace, high-traffic areas), we tailor forecasting models to specific behavioral patterns. The TransLSTM model integrates the self-attention mechanism of Transformer to capture cross-dimensional feature relationships and LSTM to model temporal dynamics, thereby enhancing prediction precision across different time scales.

2. Scenario-based Analysis Using Clustering

2.1 K-means Clustering Algorithm

Clustering is a fundamental step in our framework to identify homogeneous charging patterns. The K-means algorithm is chosen for its simplicity and efficiency in partitioning data into K clusters by minimizing the within-cluster sum of squared distances:

\(J(c, \mu) = \sum_{i=1}^{n} \left\| x_i – \mu_{c_i} \right\|^2\)

where \(x_i\) is the data point, \(c_i\) is the cluster index for \(x_i\), and \(\mu_{c_i}\) is the centroid of cluster \(c_i\). The algorithm iteratively refines cluster centroids until convergence, ensuring high intra-cluster similarity and low inter-cluster similarity.

2.2 Scenario Construction

We categorize EV charging scenarios based on daily charging patterns and urban functional zones. Using charging data from 22,488 EV chargers in Shijiazhuang, we analyze charging records across three time intervals:

  • Nighttime (22:00–06:00)
  • Noontime (11:00–15:00)
  • Other periods (06:00–11:00 and 15:00–22:00)

By applying K-means with the elbow method to determine the optimal cluster number (\(K=4\)), we define four scenarios:

  1. Low-frequency usage: Chargers with sparse charging activity in all intervals, typically in remote areas or private installations.
  2. Workplace scenario: Higher charging activity during noontime, aligning with office hours.
  3. Residential scenario: Peak charging at nighttime, reflecting home-based charging habits.
  4. High-traffic scenario: Uniformly high charging activity across all intervals, located in commercial districts or transportation hubs.

Table 1 summarizes the key characteristics of each scenario.

Table 1. Charging Scenarios Identified by K-means Clustering

ScenarioPrimary Time IntervalCharging Behavior PatternTypical Location
Low-frequencyAll intervals (low)Sparse, irregular chargingRural areas, private homes
WorkplaceNoontime (high)Daytime charging during work hoursOffice complexes
ResidentialNighttime (high)Evening and early morning chargingResidential neighborhoods
High-trafficAll intervals (high)Continuous, high-demand chargingCommercial centers, hubs

3. TransLSTM Model for Charging Load Forecasting

3.1 Model Architecture

The TransLSTM model combines the strengths of Transformer and LSTM. The encoder uses self-attention to capture relationships between multi-dimensional features (e.g., historical load, weather data), while the decoder employs LSTM to model temporal dependencies.

3.1.1 Encoder with Self-Attention

The encoder processes a sequence of input features \(X = [x_1, x_2, \dots, x_T]\) augmented with positional encoding P to retain temporal information:

\(X’ = X + P\)

Query (Q), key (K), and value (V) matrices are generated via linear projections:

\(Q = W_q X’, \quad K = W_k X’, \quad V = W_v X’\)

The scaled dot-product attention mechanism computes attention scores and outputs:

\(\text{Attention}(Q, K, V) = \text{softmax}\left( \frac{QK^T}{\sqrt{d_k}} \right) V\)

Multi-head attention combines multiple attention heads to capture diverse feature interactions. Residual connections and layer normalization ensure training stability:

\(A’ = \text{LayerNorm}(X’ + \text{MultiHead}(Q, K, V))\)

A feed-forward network further processes the output:

\(f = \text{ReLU}(W_1 A’ + b_1) W_2 + b_2\)

The final encoder output \(h_{\text{Encoder}}\) is:

\(h_{\text{Encoder}} = \text{LayerNorm}(A’ + f)\)

3.1.2 Decoder with LSTM

The decoder integrates LSTM to model sequential dependencies. At each time step t, the encoder output \(h_{\text{Encoder}}\) and previous LSTM hidden state \(h_{t-1}\) are concatenated and projected to form a aggregated state \(h’_{t-1}\):

\(h’_{t-1} = W \cdot [h_{\text{Encoder}}, h_{t-1}] + b\)

This state is fed into the LSTM cell, which updates its hidden state \(h_t\) and cell state \(C_t\) using forget, input, and output gates:

\(\begin{align*} f_t &= \sigma(W_f \cdot [h’_{t-1}, x_t] + b_f) \\ i_t &= \sigma(W_i \cdot [h’_{t-1}, x_t] + b_i) \\ \tilde{C}_t &= \tanh(W_C \cdot [h’_{t-1}, x_t] + b_C) \\ C_t &= f_t \cdot C_{t-1} + i_t \cdot \tilde{C}_t \\ o_t &= \sigma(W_o \cdot [h’_{t-1}, x_t] + b_o) \\ h_t &= o_t \cdot \tanh(C_t) \end{align*}\)

The final prediction \(O_t\) is generated via a linear layer:

\(O_t = \text{Linear}(h_t)\)

3.2 Model Training

The model is trained using the Adam optimizer with a learning rate of 0.001 and a batch size of 32. We optimize for mean squared error (MSE) as the loss function:

\(\text{MSE} = \frac{1}{n} \sum_{t=1}^{n} (A_t – F_t)^2\)

where \(A_t\) is the actual load and \(F_t\) is the forecasted load.

4. Experimental Setup and Results

4.1 Dataset

We use real-world EV charging data from Shijiazhuang (January 1 to July 12, 2023), including:

  • Charging load: 15-minute interval data from 22,488 chargers.
  • Weather data: Temperature, humidity, wind speed, wind direction, and precipitation.

The dataset is split into training (80%) and testing (20%) sets.

4.2 Feature Selection

Pearson and Spearman correlation analyses are performed to identify significant features. Table 2 shows that humidity, wind speed, and wind direction are strongly correlated with charging load, while temperature and precipitation have weak correlations. Thus, we include load, humidity, wind speed, and wind direction as input features.

Table 2. Correlation Analysis Results

FeaturePearson CorrelationSpearman Correlation
Temperature-0.0413-0.0285
Humidity0.26930.2574
Wind Speed-0.2549-0.2576
Wind Direction0.23820.2397
Precipitation0.05600.0111

4.3 Model Comparison

We compare the following models:

  • Transformer: Pure Transformer model.
  • LSTM: Pure LSTM model.
  • TransLSTM: Transformer encoder + LSTM decoder.
  • Scenario-LSTM: LSTM with scenario-based clustering.
  • Scenario-TransLSTM: TransLSTM with scenario-based clustering.

4.4 Evaluation Metrics

Four metrics are used to assess performance:

  • Mean Squared Error (MSE)
  • Mean Absolute Error (MAE)
  • Mean Absolute Percentage Error (MAPE)
  • Coefficient of Determination (R²)

Their formulas are:

\(\begin{align*} \text{MAE} &= \frac{1}{n} \sum_{t=1}^{n} |A_t – F_t| \\ \text{MAPE} &= \frac{1}{n} \sum_{t=1}^{n} \left| \frac{A_t – F_t}{A_t} \right| \times 100\% \\ R^2 &= 1 – \frac{\sum_{t=1}^{n} (A_t – F_t)^2}{\sum_{t=1}^{n} (A_t – \bar{A})^2} \end{align*}\)

4.5 Results

Table 3. Prediction Performance for 15-Minute Forecasting

ModelMSE (kW²)MAE (kW)MAPE (%)
Transformer0.001070.01988.980.941
LSTM0.0006910.01798.340.958
TransLSTM0.0005700.01517.480.972
Scenario-LSTM0.0005630.01556.120.989
Scenario-TransLSTM0.0005260.01376.360.992

Table 4. Prediction Performance for 1-Hour Forecasting

ModelMSE (kW²)MAE (kW)MAPE (%)
Transformer0.002110.046915.20.836
LSTM0.001720.038814.60.897
TransLSTM0.001290.032012.50.908
Scenario-LSTM0.001080.028911.30.931
Scenario-TransLSTM0.0009040.01728.340.955

Table 5. Prediction Performance for 4-Hour Forecasting

ModelMSE (kW²)MAE (kW)MAPE (%)
Transformer0.01360.112717.210.614
LSTM0.01150.099115.970.679
TransLSTM0.009440.091415.440.701
Scenario-LSTM0.008730.086014.230.733
Scenario-TransLSTM0.006700.075313.910.752

5. Discussion

5.1 Model Performance

The Scenario-TransLSTM model outperforms all other models across all time scales. For 1-hour forecasting, it achieves a 38.8% reduction in MSE compared to Transformer and a 25% reduction compared to LSTM. This demonstrates the effectiveness of combining scenario-based clustering with the TransLSTM architecture.

5.2 Impact of Scenario-based Analysis

Clustering significantly improves prediction accuracy. Scenario-LSTM and Scenario-TransLSTM models consistently outperform their non-scenario counterparts. For example, in 15-minute forecasting, Scenario-TransLSTM reduces MSE by 7.7% compared to TransLSTM, highlighting the value of tailoring models to specific charging behaviors.

5.3 Feature Contribution

Including weather features (humidity, wind speed, direction) enhances accuracy. Multi-feature input reduces MSE by 52.17% in Scenario-TransLSTM compared to single-feature (load only) input, confirming the importance of multi-dimensional data in EV load forecasting.

6. Conclusion

This study presents a robust framework for ultra-short-term forecasting of electric vehicle charging loads. By integrating K-means clustering for scenario analysis and an improved TransLSTM model, we effectively capture both spatial-temporal charging patterns and multi-dimensional feature interactions. Experimental results on real-world data validate the superiority of the proposed Scenario-TransLSTM model, which achieves higher prediction accuracy than traditional LSTM and Transformer models across various time scales.

Future research directions include extending the framework to larger datasets, incorporating real-time traffic data, and exploring advanced deep learning architectures for enhanced scalability and generalization.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top