Next Article in Journal
Design and Validation of 3D-Printed Personalized Seat Inserts for Truck Drivers
Previous Article in Journal
Computational Study on Complex Wind Field Environments in Urban and Marine Low-Altitude Based on Multi-Wind-Turbine Coordination
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Convolutional Sparse Periodic Transformer Network for Electric Vehicle Charging Demand Forecasting

1
School of Electronic and Control Engineering, Chang’an University, Middle Section of Nan Erhuan Road, Beilin District, Xi’an 710064, China
2
Innovation Center, Shaanxi Hand Auto Axle Co., Ltd., Jingwei Industrial Park, Gaoling District, Xi’an 710201, China
*
Author to whom correspondence should be addressed.
Appl. Sci. 2025, 15(24), 12982; https://doi.org/10.3390/app152412982
Submission received: 10 November 2025 / Revised: 2 December 2025 / Accepted: 6 December 2025 / Published: 9 December 2025

Abstract

Electric vehicle (EV) charging behavior exhibits strong spatio-temporal randomness, often leading to transient peak loads and an elevated risk of distribution network overloads. In addition, existing prediction models still face challenges in achieving high accuracy, computational efficiency, and effective modeling of multi-level periodic patterns. To address these issues, this study proposes a novel architecture termed the Convolutional Sparse Periodic Transformer Network (CSPT-Net). At the front end of the architecture, the model incorporates a one-dimensional convolutional neural network (1D-CNN) to efficiently capture local temporal features. To improve computational efficiency, the traditional global attention mechanism is replaced with a sparse attention module. Furthermore, a customized periodic time-encoding module is designed to explicitly represent multi-scale temporal regularities such as daily, weekly, and holiday cycles. Extensive experiments on a large-scale dataset containing more than 70,000 real-world charging records demonstrate that CSPT-Net achieves state-of-the-art performance across all evaluation metrics. Specifically, CSPT-Net reduces the Mean Absolute Error (MAE) to 12.21 min and enhances training efficiency by over 58% compared with the standard Transformer baseline. These results confirm that CSPT-Net effectively balances predictive accuracy and computational efficiency while demonstrating superior robustness and generalization in complex real-world environments. Consequently, the proposed framework offers a reliable and high-performance data-driven foundation for power grid load management and charging infrastructure planning.

1. Introduction

In the context of the global transition toward low-carbon transportation, the adoption of electric vehicles (EVs) has been accelerating at an unprecedented rate [1]. By the end of 2024, the global EV fleet surpassed 45 million units, confirming large-scale deployment as an irreversible trend [2]. However, the rapid growth in EV ownership and charging infrastructure, combined with uncoordinated charging behaviors, has led to a sharp rise in urban electricity demand. This surge poses new challenges for power grid load forecasting, as inaccurate predictions can directly compromise real-time dispatch and operational planning. Moreover, when the actual peak load exceeds the system’s stability threshold, cascading failures such as voltage instability and transmission line overloads may occur [3]. This problem extends beyond predictive uncertainty and presents a tangible threat to grid reliability and security. Empirical studies show that when EV penetration exceeds 15%, distribution networks are already at risk of overloads [4]. In addition, inadequate charging infrastructure, such as a charger-to-vehicle ratio below 1:10, can lead to irrational charging behaviors among users, thereby amplifying load volatility and unpredictability [5]. However, recent studies indicate that with advanced control strategies, EVs can also function as flexible assets to provide frequency response and inertia support for grid stability [6]. Therefore, developing accurate and computationally efficient prediction models, along with a comprehensive understanding of EV user charging behavior, has become an essential prerequisite for ensuring the safe and stable operation of modern power systems.
Early research on EV charging demand forecasting primarily focused on characterizing the inherent uncertainty of charging behavior using probabilistic and statistical approaches. Several pioneering studies modeled charging stations as queuing systems and applied traffic flow and queuing theories to develop mathematical models for predicting site-specific charging demand [7,8]. To better capture the stochastic characteristics of charging behavior, later studies employed modeling and simulation methods based on stochastic processes. For instance, Goh et al. [9] combined an improved grey model with Monte Carlo Simulation (MCS) to predict charging loads across different EV categories, whereas Dai et al. [10] achieved high-accuracy load predictions using the Monte Carlo method.
To improve predictive accuracy, later studies increasingly focused on modeling the spatio-temporal heterogeneity of EV charging demand, with particular emphasis on identifying critical regions and key influencing factors. For instance, Xing et al. [11] incorporated ride-hailing trajectory data and human decision-making behaviour to forecast urban EV fast-charging demand, while Zhou et al. [12] employed Point of Interest (POI) data to enhance demand predictions in specific areas, such as residential districts. Although these probabilistic approaches have yielded valuable theoretical insights into the mechanisms underlying charging demand, they continue to face several inherent challenges. On one hand, these models often rely on strong prior assumptions and idealized probability distributions, which constrain their ability to accurately represent the complex and dynamic charging behaviors observed in real-world scenarios [13]. On the other hand, efforts to incorporate complex simulation processes or behavioral heterogeneity to enhance predictive precision often lead to substantial computational costs [14]. Consequently, these limitations result in limited predictive accuracy and poor generalization in practical applications.
Developing accurate probabilistic models for electric vehicle (EV) charging demand is challenging. This challenge stems from the complex dynamics of charging systems, numerous influencing factors, and high-dimensional data. Moreover, many existing probabilistic models rely on simplifying assumptions and simulated data. As a result, these models often exhibit low prediction accuracy and fail to capture real-world conditions effectively [15,16,17]. Consequently, data-driven forecasting approaches have gained growing research attention [18]. Early studies adopted conventional deep learning architectures. For instance, Wang et al. [19] applied Long Short-Term Memory (LSTM) and Convolutional Neural Network (CNN) models for time-series forecasting over hourly and daily horizons. Building on these studies, Bharat et al. [20] extended the framework by integrating multivariate LSTM architectures. They further applied explainability techniques such as SHAP to interpret model decisions and identify key influencing factors, thereby enhancing the interpretability and credibility of the predictions.
To further capture long-range dependencies and complex spatio-temporal correlations, research attention has gradually shifted toward more advanced deep learning architectures. Some recent approaches have even introduced self-supervised learning to enhance forecasting resilience against cyberattacks [21]. Koohfar et al. [22] were among the first to apply the standard Transformer model to EV charging demand prediction, leveraging its self-attention mechanism to model long-term dependencies and demonstrating its potential for time-series forecasting. However, their model did not explicitly incorporate multiple periodic patterns, including daily, weekly, and holiday cycles, which are intrinsic to charging behavior and essential for accurate forecasting. In parallel, Gunasekaran et al. [23] proposed a hybrid framework combining an enhanced Gated Recurrent Unit (GRU) with a Graph Convolutional Network (GCN), which achieved significant improvements in prediction accuracy. However, such models primarily focus on spatial interdependencies between regions and are less efficient in modeling long-range temporal dependencies in long-sequence forecasting tasks, while lacking explicit mechanisms to incorporate multi-period temporal features.
To establish performance baselines for complex deep learning models and evaluate their practical advantages, many comparative studies have incorporated traditional machine learning algorithms. For example, Tolun et al. [24] conducted a comprehensive evaluation of multiple models, including Random Forest, LSTM, and Transformer architectures, using real-world datasets. Among these, Linear Regression remains one of the most fundamental predictive models, generating forecasts by establishing linear relationships between explanatory variables and target values. Due to its simplicity, computational efficiency, and high interpretability, it is often used as a benchmark model [25]. However, its linear assumptions prevent it from capturing the inherently complex and nonlinear dynamics of EV charging behavior.
To more effectively address nonlinearity and feature interactions within traditional machine learning frameworks, ensemble models based on Gradient Boosting Decision Trees (GBDT) have been introduced in this field. Specifically, Histogram-based Gradient Boosting (HistGradientBoosting) enhances training speed and memory efficiency by discretizing continuous feature values into histogram bins, making it an effective and scalable predictive tool for large datasets [26]. Furthermore, because forecasting tasks often require both point estimates and the quantification of predictive uncertainty, Quantile Regression has been introduced as a complementary technique. Unlike conventional regression models that estimate only the conditional mean, Quantile Regression predicts arbitrary quantiles of the target variable, providing deeper insights for risk assessment and interval forecasting [27]. Although these machine learning models improve predictive performance, they are still limited in handling complex temporal data with long-range dependencies, often relying on extensive feature engineering and lacking the ability to automatically learn deep temporal representations.
Existing studies on EV charging demand prediction generally consider multiple factors, including traffic flow, weather conditions, and vehicle characteristics, to facilitate efficient dispatch and optimal resource allocation in power systems. However, the predictive accuracy of these approaches remains limited. A key limitation is their inability to effectively capture the intrinsic heterogeneity of EV charging demand, especially in extracting local temporal features from sequential data. Although deep learning approaches have made progress, most models still fail to fully utilize the multiple periodic patterns inherent in charging behavior, including daily, weekly, and holiday cycles. Meanwhile, models such as the standard Transformer incur high computational costs when processing long sequences due to their global self-attention mechanism, which leads to low training efficiency and a higher risk of overfitting. These limitations together hinder further advances in predictive accuracy and computational efficiency.
More specifically, standard Transformer architectures exhibit three notable failure modes in this context. First, they experience attention dilution, in which the global self-attention mechanism smooths sharp, high-frequency local fluctuations by averaging them with longer-term trends. Second, standard positional encodings lack semantic hierarchy and treat time as a continuous sequence without distinguishing among workdays, weekends, and holidays, which results in poor generalization during irregular calendar events. Finally, the quadratic computational complexity ( O ( N 2 ) ) creates a trade-off between efficiency and context length, often limiting the model’s ability to process sufficiently long historical sequences needed to capture seasonal dependencies.
To address these challenges, this study proposes a novel Convolutional Sparse Periodic Transformer Network (CSPT-Net) that introduces three targeted improvements designed to overcome the specific limitations of the standard Transformer in EV charging demand forecasting. First, since the standard Transformer’s global self-attention mechanism is inefficient at capturing local dependencies and short-term temporal patterns, a one-dimensional convolutional neural network (1D-CNN) is incorporated at the model’s front end to strengthen local feature extraction. Second, the standard global attention mechanism is replaced by a sparse attention module that narrows the attention scope to reduce computational complexity and enhances the model’s focus on key temporal segments. Finally, a periodic temporal encoding module is developed to explicitly embed multi-level periodic patterns, including daily, weekly, and holiday cycles, into temporal representations. This design reinforces temporal correlations in the input data, simplifies the model architecture, and substantially improves its ability to capture multi-periodic and trend information.

2. Methodology and Model Design

2.1. Transformer Baseline Model

The Transformer represents a major architectural breakthrough compared with traditional sequence models such as Recurrent Neural Networks (RNNs) and Long Short-Term Memory (LSTM) networks [28]. In time-series data processing, its main advantages are a strong capacity to capture long-range dependencies and significantly enhanced computational efficiency. By eliminating the recurrent structure of RNNs, the Transformer relies solely on self-attention to compute correlations between any two positions in a sequence, effectively mitigating vanishing-gradient and information-bottleneck problems caused by stepwise propagation in recurrent models when processing long sequences. Consequently, this non-sequential processing paradigm enables efficient parallel computation, resulting in significant improvements in training speed [29].
The core of the Transformer architecture is the self-attention mechanism, which computes query (Q), key (K), and value (V) vectors to assess relationships among all positions in a sequence, generating weighted representations enriched with global context. To enhance representational capacity, this mechanism is typically implemented as Multi-Head Attention, allowing the model to learn dependency relationships across multiple representation subspaces simultaneously. Furthermore, the canonical encoder–decoder structure of the Transformer (Figure 1) integrates several key components—Positional Encoding, Feed-Forward Networks, residual connections, and layer normalization—that together ensure model expressiveness and training stability. In time-series forecasting tasks, such as electric vehicle charging demand prediction, the standard Transformer is widely regarded as a strong baseline model because of its ability to capture long-range dependencies. However, the self-attention mechanism has a major limitation: it requires pairwise interactions among all sequence positions, resulting in quadratic computational and memory complexity ( O ( N 2 ) ) , which becomes inefficient for long input sequences [30]. In addition, standard positional encoding cannot explicitly represent the intrinsic periodic regularities—such as daily and weekly cycles—found in charging data. Therefore, this study adopts the Transformer as the baseline framework and introduces targeted architectural enhancements to address its limitations in long-sequence processing and periodic pattern modeling, thereby improving overall predictive performance.

2.2. Model Architecture Design Strategy

2.2.1. One-Dimensional Convolutional Module

Electric vehicle (EV) charging sequence data often display significant local fluctuations and abrupt behaviors, including sudden charging initiation, rapid power increases, and intermittent interruptions. Although the self-attention mechanism in the standard Transformer effectively models global dependencies, it is less capable of capturing fine-grained local patterns. To overcome this limitation, a one-dimensional convolutional (1D-CNN) layer is introduced as a front-end processing module in the Transformer framework. This layer strengthens the model’s capacity to capture short-term dependencies and local temporal features from the input time series. The resulting representations are then passed to the Transformer for global dependency modeling, enabling the joint learning of both local and long-range temporal relationships. Let the input features be denoted by X R N × d i n , and the output of the 1D-CNN be defined as shown in Equation (1):
H = ReLU ( Conv 1 D ( X ;   k ,   s ) )
In this configuration, the convolutional kernel size is set to k = 3 , the stride to s = 1 , and the output channels are mapped to d m o d e l = 64 .
The use of a shallow, single-layer CNN architecture at the front end is intentional. Unlike deep convolutional networks commonly used in computer vision, the CNN in this framework is designed solely to extract fine-grained local ‘micro-patterns’ between adjacent time steps. A single layer with a small kernel size ( k = 3 ) effectively captures these short-range dependencies while avoiding the excessive smoothing of temporal signals often caused by deeper stacks. This design mitigates the risk of overfitting and preserves sharp local features before the sequence is passed to the Transformer, which is responsible for modeling the remaining long-range global dependencies. By synergizing the CNN’s precise local feature extraction with the Transformer’s global context awareness, the proposed architecture enhances overall generalization and adaptability. The complete framework incorporating this 1D convolutional module is illustrated in Figure 2.

2.2.2. Sparse Attention Mechanism Module

In electric vehicle charging demand prediction, while long-term periodic patterns such as daily and weekly cycles exist, the most influential factors for forecasting at any given time are usually concentrated in nearby recent time points and a few historical moments with similar periodic characteristics. However, the global attention mechanism in the standard Transformer indiscriminately computes interactions between all time points in a sequence, leading to redundant computation on temporally irrelevant information. This dense attention mapping results in inefficient use of memory and computational resources. To mitigate the O ( N 2 ) computational and storage overhead and focus attention on the most relevant time points for the current position, a local-plus-global sparse attention mask, denoted as M 0 , 1 N × N , is proposed. Its mathematical formulation is given in Equation (2):
M i j = 1 , | i j | r 1 , j g ( i ) 0 , otherwise
here r is the local neighborhood radius, and g ( i ) represents the global skip-sampling set corresponding to position i.
The sampling is performed at a fixed interval of every ten positions. The formulation of the masked attention computation is presented in Equation (3):
SparseAttn ( Q ,   K ,   V ) = softmax Q K T d k + log M V
In this equation, Q, K, and V represent the query, key, and value matrices, respectively. M denotes the sparse attention mask matrix used to filter out irrelevant temporal dependencies. The term d k refers to the dimension of the key vectors, which serves as a scaling factor to stabilize the attention weight distribution.
Applying these rules substantially reduces computational complexity. The sparse attention mechanism removes the need for global attention over all time steps and instead focuses solely on local temporal segments most relevant to the current prediction task. This targeted approach decreases the density of the attention matrix, reducing computational demands and minimizing redundant calculations. The corresponding model architecture is shown in Figure 3.

2.2.3. Periodic Time Encoding Module

Electric vehicle (EV) charging demand inherently exhibits complex multi-scale temporal regularities, characterized by distinct daily and weekly periodicities as well as irregular holiday effects. However, the traditional Transformer’s positional encoding is limited because it provides only relative or absolute positional information. This approach fails to adequately represent complex real-world temporal attributes within the model’s feature space. To address this limitation, this study introduces periodic time encoding, enabling the model to capture both cyclical and trend-based temporal patterns. Specifically, the daily cycle represents fluctuations in charging demand within a 24-h period. The weekly cycle distinguishes between charging behaviors on weekdays and weekends. Holiday charging behaviors often deviate from regular patterns and therefore require special treatment. Three temporal variables are defined: the hour of the day, τ [ 0 , 24 ) ; the weekday flag, δ w e e k d a y 0 , 1 ; and the holiday flag, δ h o l i d a y 0 , 1 . For each time step, a three-part encoding vector is constructed. First, to encode the daily cycle, two hour-based representations are generated using sine and cosine functions. These representations are subsequently mapped to the model’s feature dimension, as shown in Equation (4).
C t , 2 i sin = sin 2 π τ 24 · W 2 i ( 1 ) C t , 2 i + 1 cos = cos 2 π τ 24 · W 2 i + 1 ( 1 ) i = 0 , 1 , , d model 2 1
The weight vector W ( 1 ) R d m o d e l is a trainable parameter that enables the model to learn different importance weights across the dimensions of the daily cycle information. To encode the weekly cycle, a small fully connected layer maps the binary weekend indicator into an encoding vector. The resulting vector has the same dimensionality as the daily cycle encoding, as shown in Equation (5).
C week = δ w e e k e n d W ( 2 ) + ( 1 δ w e e k e n d ) W ( 3 )
In this equation, W ( 2 ) , W ( 3 ) R d m o d e l are learnable parameters corresponding to the weekend and weekday states, respectively.
For the holiday encoding, a binary mapping of the holiday status is performed, as shown in Equation (6):
C holy = δ h o l i d a y W ( 4 )
In this equation, W ( 4 ) R d m o d e l is a trainable vector that is activated only during holiday time steps.
The aforementioned three encoding components are combined with the standard positional encoding P E t and the temporal convolution output H ˜ t to obtain the final feature vector for the time step, as shown in Equation (7):
Z t = H ˜ t + P E t + C t sin + C t cos + C t week + C t holy
Consequently, the feature vector at each time step, Z t R d m o d e l , integrates local temporal features, absolute positional embeddings, intra-day periodicity, and categorical indicators for weekdays, weekends, and holidays. This integrated representation substantially improves the model’s capacity to accurately capture multi-level periodic patterns in charging demand. The architecture of the periodic encoding process is illustrated in Figure 4.

2.3. Holistic Model Framework

To address the limitations of the standard Transformer in EV charging demand forecasting, CSPT-Net integrates three key modules within a unified encoder–decoder framework: a 1D-CNN, a sparse attention mechanism, and a periodic time encoding module. The overall architecture of the CSPT-Net model is illustrated in Figure 5.
First, the periodic time encoding module encodes the temporal features extracted from the input sequence. It represents daily, weekly, and holiday patterns using sine and cosine functions, fully connected mappings, and binary embeddings, respectively. Next, the 1D-CNN module captures local temporal dependencies and identifies micro-patterns such as short-term fluctuations. The resulting output is fed into the encoder input through a residual connection. This design enhances model stability and facilitates efficient gradient propagation. Finally, the processed sequence is passed to both the encoder and decoder modules. These modules are characterized by a sparse attention mechanism and a simplified layer design. Each layer includes a residual connection prior to generating the final prediction.

3. Experiments

The performance of the CSPT-Net model was rigorously evaluated through a series of experiments conducted on a large-scale real-world dataset [14]. A multi-source heterogeneous data fusion strategy was employed to ensure the diversity and comprehensiveness of the training data [31]. The dataset consists of two main components:
A total of 12,541 synthetic charging records were generated using the Monte Carlo simulation method [32,33], calibrated to the real-world road network of Xi’an. To ensure that the simulated data captured realistic spatio-temporal heterogeneity, the environment was configured with detailed topological and vehicle-level parameters. Geographically, the simulation encompassed 27 functional zones mapped from the urban core, including 9 residential areas, 9 commercial districts, and 9 working zones. This spatial design enabled the dataset to reflect charging demand patterns across diverse land-use categories.
In terms of vehicle characteristics, the simulation agents were calibrated to represent the composition of the local EV market, covering 10 representative battery-electric and plug-in hybrid models. Battery capacities in the generated dataset ranged from approximately 13 kWh to 75 kWh, with most samples concentrated between 40 and 75 kWh—consistent with the specifications of mainstream private and commercial vehicles in the region.
In addition to the synthetic data, 60,000 supplementary charging entries were incorporated from an authoritative public dataset published in Scientific Data [34]. Integrating these two datasets enhanced the diversity and coverage of charging behaviors, thereby improving the model’s generalization capability across different operational environments.
The dataset consists of approximately 71.4% working days, 25.5% weekends, and 3.1% statutory holidays. Although the distribution is imbalanced, the substantial number of non-working-day samples (>20,000) provides adequate support for learning temporal differences. Furthermore, CSPT-Net incorporates independent embedding layers for weekend and holiday indicators, allowing the model to capture event-specific patterns while preventing the dominant workday distribution from overshadowing minority classes, which contributes to stable training.

3.1. Data Preparation and Feature Extraction

3.1.1. Data Normalization and Anomaly Filtering

During the data fusion stage, the two heterogeneous data sources were merged into a unified, timestamp-aligned sample space using feature alignment and dimensional matching techniques. Missing feature values were handled using a null-value flagging strategy, and a sliding window sampling method was applied to construct sequential samples suitable for time-series forecasting. This process produced a unified, multi-dimensional training dataset containing 72,541 records.
A multi-stage data cleaning pipeline was employed to standardize the raw dataset. First, temporal fields were normalized by converting all time identifiers to the “YYYY-MM-DD HH:mm:ss” format to ensure strict time-series alignment. Based on the physical constraints of charging behavior, valid charging durations were defined between 5 min and 24 h, leading to the removal of 572 anomalous records outside this range. Additionally, a sequential conflict detection algorithm was applied to identify and remove 72 invalid entries with overlapping time windows. To ensure continuity in EV charging records, the initial record for each vehicle was removed to establish a complete prior charging history for subsequent sessions. After preprocessing, a cleaned dataset containing 71,520 valid charging sessions was obtained.
Figure 6 shows a three-dimensional scatter plot illustrating the data distribution across start time, charging duration, and average charging load. The data are primarily concentrated between 06:00 and 24:00, representing 76.44% of all sessions. Although charging durations range from a few minutes to 1800 min, 95.92% of sessions lie within the 0–720 min range. The average charging load mainly falls between 0 and 60 kW, with only 2.91% of sessions exceeding this threshold.
Figure 7 illustrates the specific impact of the data-cleaning pipeline on the dataset’s temporal distribution. As shown in Figure 7a, the raw data exhibits significant stochastic noise and discrete outliers, particularly charging durations extending beyond physical limits or anomalous short-duration spikes caused by connection errors. In contrast, Figure 7b demonstrates the efficacy of the applied constraints: the distribution is strictly bounded within the valid [5 min, 24 h] interval, and the sparse ’long-tail’ noise has been effectively truncated. This logical refinement ensures that the training inputs reflect valid charging physics rather than sensor anomalies or data logging errors.

3.1.2. Multi-Dimensional Feature Extraction

From the cleaned dataset, a total of 17 key features were derived and extracted, capturing the spatio-temporal distribution characteristics and associated attributes of the charging load. These features are systematically categorized into six distinct groups: temporal, metadata, environmental, transactional, charging state, and historical features. A representative subset of these features, together with their detailed descriptions, is summarized in Table 1.
The prediction target of the model is the charging duration, which directly represents the user’s trade-off between charging power and time cost. Accurate prediction of charging duration enables operators to dynamically schedule charging resources and provides users with personalized charging time recommendations based on forecast results. The detailed feature descriptions are provided in Table 2.

3.2. Experimental Setup and Result Analysis

3.2.1. Parameter Settings and Evaluation Metrics

To ensure the reproducibility of the experimental results, all models were trained and evaluated on a standardized hardware platform equipped with an Intel Core i7-8700 CPU (Intel Corporation, Santa Clara, CA, USA), 16 GB of RAM, and an NVIDIA GeForce RTX 2080 GPU (8 GB VRAM; NVIDIA Corporation, Santa Clara, CA, USA). The deep learning models were implemented using PyTorch (version 1.13.0) and Python (version 3.8.0). To determine the optimal configuration, a grid search strategy was employed on the validation set, where multiple combinations of learning rates, batch sizes, and optimizer settings were evaluated. To ensure a fair and rigorous comparison, identical optimization protocols were applied to all models, including the proposed CSPT-Net and all baseline architectures. Specifically, a standardized grid search strategy was employed on the validation set to identify the optimal hyperparameters for each individual model. The search space included learning rates in the range of { 1 × 10 4 ,   5 × 10 4 ,   1 × 10 3 } , batch sizes of { 16 ,   32 ,   64 } , and hidden layer dimensions of { 64 ,   128 ,   256 } . Furthermore, to prevent unfair advantages due to training duration, an early stopping mechanism (patience = 10 epochs) was universally implemented, ensuring that all deep learning models converged to their respective optimal states. The resulting optimal hyperparameters for the CSPT-Net, selected from this search process, are detailed in Table 3.
A set of key evaluation metrics was utilized to comprehensively evaluate the predictive performance of the proposed model. To ensure analytical rigor and transparency, the definitions and computational formulas for each metric are provided below.
Absolute Error (AE): This metric quantifies the absolute deviation between the predicted value, y ^ i , and the true value, y i . The formula is shown in Equation (8):
A E i = | y i y ^ i |
Mean Absolute Error (MAE): This is defined as the sum of the absolute errors for all observations i divided by the total number of observations n. The specific formula is shown in Equation (9):
M A E = 1 n i = 1 n A E i
Median Absolute Error (MdAE): In cases where the data distribution is highly skewed and contains a large number of outliers, MdAE is a more robust metric than MAE because the mean is more sensitive to outliers. Its calculation formula is shown in Equation (10):
M d A E = med ( A E i )
Mean Absolute Percentage Error (MAPE) is defined as the mean absolute difference between the predicted and actual values, expressed as a percentage of the actual value. MAPE expresses the prediction error as a percentage, intuitively indicating the deviation of the predicted values from the actual values. Because MAPE is scale-independent, it facilitates comparison across datasets with different magnitudes and measurement units. The calculation formula is provided in Equation (11).
M A P E = 1 n i = 1 n y i y ^ i y i × 100
Median Absolute Percentage Error (MdAPE) is defined similarly to MAPE; it is obtained by calculating the median of the absolute percentage errors.
Symmetric Mean Absolute Percentage Error (SMAPE) quantifies the relative error between predicted and actual values. Its symmetric formulation mitigates the denominator issue that arises in MAPE when actual values approach zero. The detailed calculation is presented in Equation (12).
S M A P E = 1 n i = 1 n 2 | y i y ^ i | | y i | + | y ^ i |
Training Time measures the total duration required for the model to complete all training epochs. It provides a direct measure for evaluating the model’s computational complexity and training efficiency. All comparisons are conducted under a consistent software and hardware environment.

3.2.2. Comparison of Results

Figure 8 presents the learning curve of the CSPT-Net model, depicting the evolution of the loss function across training epochs. During the initial training phase, the loss decreases sharply, indicating the model’s strong early convergence ability. Around the 20th epoch, the ReduceLROnPlateau learning rate scheduler is activated, dynamically adjusting the learning rate and causing a brief fluctuation in the loss curve. After about 40 epochs, the loss reduction slows noticeably but continues a steady downward trend. Between the 60th and 80th epochs, the scheduler continues fine-tuning its parameters to further optimize convergence. After 85 epochs, the loss function stabilizes, and the final training loss converges to 11.02421. The validation loss remains consistently higher than the training loss, eventually stabilizing around 13.14425, which suggests mild overfitting. Using the expanded dataset, the full 100-epoch training completed in only 763 s, demonstrating a significant improvement in training efficiency.
Figure 9 presents a comparative analysis of the charging demand prediction performance across multiple models. As shown in Figure 9a, the proposed model demonstrates high robustness and predictive accuracy, even for anomalous charging sessions with long durations (e.g., over 1000 min). The predicted value distribution closely matches the ground truth, indicating strong generalization capability. This superior performance mainly results from the proposed periodic time encoding, which enables the model to identify atypical temporal patterns related to holidays or special intervals. Meanwhile, the sparse attention mechanism enhances focus on critical time segments and suppresses noise interference. In contrast, Figure 9b shows that the standard Transformer model exhibits a significant accuracy decline for charging durations exceeding 1000 min, though it maintains acceptable performance for shorter sessions. As shown in Figure 9c, the HistGradientBoosting model has a constrained prediction range of about 850 min and exhibits a systematic bias between predicted and actual values. Figure 9d,e shows that the QuantileRegressor and LinearRegression models perform even worse; both completely fail to predict sessions exceeding 600 min, and their short-duration predictions deviate markedly from the ground truth. These results suggest that traditional linear models cannot effectively capture the complex non-linear spatio-temporal dependencies inherent in EV charging behavior.

3.2.3. Comparative Evaluation of Model Performance

Table 4 summarizes the overall performance evaluation results for the charging duration prediction task across all vehicles. Based on 71,520 charging samples, the global error statistics show that CSPT-Net achieves superior overall performance in this task. The Mean Absolute Error (MAE) of 12.21 min represents the smallest overall prediction bias among all compared models. The low Median Absolute Error (MdAE) of 4.92 min further demonstrates the model’s high predictive accuracy for most samples, with large deviations restricted to a few outliers. For relative error metrics, the Mean Absolute Percentage Error (MAPE), Median Absolute Percentage Error (MdAPE), and Symmetric Mean Absolute Percentage Error (SMAPE) all achieved the lowest values, highlighting the model’s superior consistency and reliability.
Among baseline models, the Transformer outperformed both HistGradientBoosting and LinearRegression on key metrics such as MAE and SMAPE, whereas LinearRegression showed clear disadvantages across all evaluation criteria. These results offer a broad comparison of predictive performance across different modeling approaches.
Significant differences were also observed in computational efficiency. Traditional models, such as LinearRegression, completed training in approximately 10–15 s; however, their accuracy remained insufficient for practical deployment. The standard Transformer achieved higher accuracy than traditional approaches but required the longest training time (1850 s), resulting in considerable computational overhead. In contrast, the proposed CSPT-Net achieved the best overall performance across all metrics and completed training in only 763 s, representing a 58% improvement in training efficiency compared with the standard Transformer. These findings demonstrate that CSPT-Net achieves an optimal balance between predictive accuracy and computational efficiency, validating the effectiveness and superiority of the proposed architecture.
Table 5 summarizes the average values of each evaluation metric calculated on a per-vehicle basis. This analytical perspective highlights the distinctive behavioral patterns of individual vehicles, allowing for a more detailed assessment of model performance and providing a solid basis for fine-grained analysis. In this per-vehicle prediction task, CSPT-Net again demonstrates a clear performance advantage over the comparison models.
Based on the observed data characteristics and trends, Figure 10 illustrates the model’s predictive behavior at a microscopic level through a dual-scale distribution analysis of the Absolute Error (AE) and MAE. Similarly, Figure 11 uses boxplots to display the statistical distribution of errors, providing a comprehensive assessment from the perspectives of Absolute Error and Absolute Percentage Error. A combined analysis of these two figures further confirms the model’s superior ability in spatio-temporal feature extraction and its strong adaptability to anomalous patterns, as reflected by its consistent performance across both micro-level structures and macro-level statistical distributions.
According to the Shapley value definition, the SHAP value of a feature represents the weighted average of its marginal contributions across all possible feature subsets. The SHAP value ϕ i for feature i is calculated as
ϕ i = S N { i } | S | ! ( n | S | 1 ) ! n ! ϕ i ( S )
Figure 12 presents the distribution of mean SHAP values for all input features using boxplots. Notably, the features startSin and lastDuration display substantially wider value ranges and higher average contributions. This prominence can be attributed to inherent EV user behavior patterns rather than to any inadequacy in the model’s ability to exploit other input features. startSin encodes the circadian rhythm of human activity and functions as a primary physical constraint governing charging initiation. Similarly, lastDuration serves as a high-fidelity proxy for individual charging habits and battery-capacity limitations, effectively capturing the inertial characteristics of charging behavior. However, this does not imply that other temporal signals are negligible. As reflected in the long-tail portion of the distribution, features such as weekend, holiday, and temperature provide non-trivial marginal contributions, indicating that the model effectively incorporates these variables as scenario-specific refinement signals.

3.2.4. Ablation Study

To rigorously evaluate the effectiveness of each core component in the CSPT-Net architecture and quantify their individual contributions to overall model performance, a series of ablation experiments was performed. Following the principle of controlled experimentation, each key module—namely, the one-dimensional convolution (1D-CNN), Sparse Attention, and Periodic Encoding—was systematically removed or replaced to assess its independent impact.
To ensure experimental fairness and result validity, all model variants were trained on the same dataset using identical hyperparameters and training protocols as the full CSPT-Net, differing only by the ablated component. The performance comparison of these model variants on the test set is summarized in Table 6.
Quantitative analysis shows that the complete CSPT-Net consistently outperforms all ablated variants across all test datasets, emphasizing the necessity of synergy among its core components. A detailed analysis of individual module contributions reveals that removing either the 1D-CNN or the Periodic Encoding module substantially increases prediction error, with MAE rising to 13.58 and 13.92 min, respectively. This finding confirms the pivotal role of the 1D-CNN in capturing fine-grained local temporal dependencies and the importance of the Periodic Encoding module in modeling multi-scale periodic patterns. Second, replacing Sparse Attention with standard global attention dramatically increased training time from 763 to 1810 s, without improving predictive accuracy. This result highlights the inherent advantage of Sparse Attention in improving computational efficiency while maintaining model accuracy.
In summary, the ablation study provides clear empirical evidence for both the independent contributions and the synergistic effects of each CSPT-Net component. Specifically, the 1D-CNN improves local feature extraction, Sparse Attention enhances computational efficiency without sacrificing accuracy, and the Periodic Encoding module allows the model to accurately capture multi-level temporal regularities. Collectively, these findings validate the theoretical foundation and architectural robustness of the proposed CSPT-Net, confirming its reliability and effectiveness in complex time-series prediction tasks.

3.2.5. Impact of Environmental Factors

To further evaluate the robustness of CSPT-Net and its capability to incorporate exogenous variables, we conducted a supplementary experiment by integrating historical meteorological data into the input features. While the primary model relies on historical charging records, environmental factors such as temperature are known to influence EV charging behavior due to battery performance variations and cabin climate control needs [33].
For this experiment, we collected daily average temperature data corresponding to the spatiotemporal range of our charging dataset. The temperature feature was normalized and concatenated with the existing input vector (denoted as X e n in Figure 3) before being fed into the 1D-CNN module. We compared the performance of the standard CSPT-Net (baseline) with the temperature-enhanced version (CSPT-Net+Temp) on the same test set.
Table 7 summarizes the comparative results. The inclusion of temperature data led to a marginal but consistent improvement in predictive accuracy. Specifically, the MAE decreased from 12.21 min to 12.15 min, and the MAPE reduced from 18.40% to 18.32%.
The results indicate that while historical charging patterns remain the dominant predictor, explicit environmental information provides supplementary context that helps the model better capture fluctuations associated with weather-sensitive demand This experiment confirms that the proposed CSPT-Net architecture is flexible and extensible, capable of effectively fusing multi-modal data sources to further enhance forecasting precision.

4. Discussion

The experimental results presented in Section 3 demonstrate that CSPT-Net effectively addresses the challenges of accuracy and efficiency in EV charging demand forecasting. Our findings can be interpreted in the context of existing literature as follows.
First, in terms of predictive accuracy, CSPT-Net achieved an MAE of 12.21 min, significantly outperforming the standard Transformer baseline (MAE 14.27 min). This improvement contrasts with previous studies utilizing standard Transformers, such as [20], which effectively captured long-range dependencies but lacked explicit mechanisms for local periodic fluctuations. Our model addresses this limitation by incorporating the Periodic Time Encoding module, which explicitly captures multi-scale temporal patterns.
Second, regarding computational efficiency, our model demonstrated a 58% reduction in training time compared to the standard Transformer. This result validates the theoretical advantage of the sparse attention mechanism discussed in recent surveys [27]. Unlike the quadratic complexity ( O ( N 2 ) ) inherent in standard self-attention [28], the sparse attention module in CSPT-Net effectively reduces the computational burden, making it more suitable for real-world applications where rapid model retraining is essential.
Third, the supplementary experiment in Section 3.2.5 provides preliminary evidence of the model’s ability to incorporate exogenous variables. When temperature information was included, CSPT-Net achieved a consistent improvement in accuracy (MAE reduced to 12.15 min; Table 7), suggesting that the architecture can effectively integrate multi-modal inputs. Although factors such as traffic intensity and dynamic pricing are also known to influence EV charging behavior, they were not included in this study because high-resolution, time-aligned datasets for the study region were not available within the current data scope, rather than due to any limitation of the model itself.
However, while our model outperforms traditional machine learning baselines [24] in handling non-linear dynamics, these traditional models still possess advantages in interpretability. Although the SHAP analysis in Section 3.2.3 provides insights into feature importance, the internal decision-making process of the deep network remains less transparent than decision tree-based models.

5. Conclusions

This study proposed a novel Convolutional Sparse Periodic Transformer Network (CSPT-Net) to forecast electric vehicle charging demand. By integrating a 1D-CNN for local feature extraction, a sparse attention mechanism for efficiency, and a periodic encoding module for temporal regularity, the proposed model achieves state-of-the-art performance. Extensive experiments on a large-scale real-world dataset demonstrate that CSPT-Net reduces the Mean Absolute Error by 14.4% and training time by 58% compared to the standard Transformer baseline. Furthermore, the supplementary evaluation confirms the model’s robustness and its capability to effectively fuse exogenous environmental features such as temperature.
Given the model’s strong predictive performance, several practical implications can be identified for real-world deployment. The high forecasting accuracy of CSPT-Net allows power system operators to anticipate short-term charging demand more reliably, thereby supporting more efficient power dispatch scheduling and reducing dependence on costly spinning reserves. In addition, the model’s computational efficiency makes it suitable for real-time monitoring environments in which rapid updates are essential. Integrating CSPT-Net into existing monitoring and control platforms enables charging infrastructure operators to update demand estimates continuously as new data become available.
Although the results are robust, limitations in data availability prevented the inclusion of additional influential factors, such as real-time traffic intensity and dynamic electricity tariffs. Future studies should place greater emphasis on developing multi-source datasets that incorporate these variables, thereby improving the model’s adaptability in complex and price-sensitive environments. In addition, the exploration of model compression techniques, including quantization, remains an important direction for facilitating deployment on resource-constrained edge devices.

Author Contributions

Conceptualization, X.L. and L.S.; Methodology, L.S.; Software, L.S.; Validation, L.S., X.L. and R.G.; Formal analysis, L.S. and R.G.; Investigation, L.S.; Resources, X.L.; Data curation, L.S.; Writing–original draft preparation, L.S.; Writing–review and editing, X.L. and R.G.; Visualization, L.S.; Supervision, X.L.; Project administration, X.L.; Funding acquisition, X.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Shaanxi Provincial Department of Education Local Service Special Project (Research on Key Technologies for New Energy Vehicle Charging and Battery Swapping Needs, Project Number: 23JE005); the Shaanxi Qin Chuang Yuan “Scientist + Engineer” Team Construction Project (Grant No. 2023KXJ-297); and the 2024 Xi’an Municipal Program for Collaborative R&D on Generic Technology Platforms (Project on Key Technologies of Charging, Discharging, and Safety for New Energy Vehicle Clusters, Grant No. 24GXPT0002).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request. Due to the ongoing nature of the project and confidentiality agreements, the data cannot be made publicly available.

Conflicts of Interest

Author Ruinian Gao was employed by the company Shaanxi Hand Auto Axle Co., Ltd. The remaining authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest. The funder had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

Abbreviations

The following abbreviations are used in this manuscript:
EVElectric vehicle
CSPT-NetConvolutional Sparse Periodic Transformer Network
1D-CNNone-dimensional convolutional neural network
MCSMonte Carlo Simulation
POIPoint of Interest
LSTMLong Short-Term Memory
CNNConvolutional Neural Network
GRUGated Recurrent Unit
GCNGraph Convolutional Network
GBDTGradient Boosting Decision Trees
RNNsRecurrent Neural Networks
AEAbsolute Error
MAEMean Absolute Error
MdAEMedian Absolute Error
MAPEMean Absolute Percentage Error
MdAPEMedian Absolute Percentage Error
SMAPESymmetric Mean Absolute Percentage Error

References

  1. Un-Noor, F.; Padmanaban, S.; Mihet-Popa, L.; Mollah, M.N.; Hossain, E. A Comprehensive Study of Key Electric Vehicle (EV) Components, Technologies, Challenges, Impacts, and Future Direction of Development. Energies 2017, 10, 1217. [Google Scholar] [CrossRef]
  2. Khaleel, M.; Nassar, Y.; El-Khozondar, H.; Elmnifi, M.; Rajab, Z.; Yaghoubi, E. Electric Vehicles in China, Europe, and the United States: Current Trend and Market Comparison. Int. J. Electr. Eng. Sustain. 2024, 2, 1–20. [Google Scholar]
  3. Hashemi-Dezaki, H.; Sar-Abadi, M.H.; Shoja-Majid, H. Probabilistic impact assessment of high penetration of electric vehicles on distribution network reliability and overload risk. Int. J. Electr. Power Energy Syst. 2022, 137, 107817. [Google Scholar]
  4. Tripathi, S.K.; Kant, R.; Shankar, R. Investigating the Electric Vehicle Adoption Initiatives for Achieving Sustainable Development Goals. Sustain. Futur. 2025, 9, 100469. [Google Scholar] [CrossRef]
  5. Sudev, V.; Sindhu, M.R. State-of-the-art and future trends in electric vehicle charging infrastructure: A review. Eng. Sci. Technol. Int. J. 2025, 62, 101946. [Google Scholar]
  6. Wan, Y.; Wang, N.; Liu, X.; Wang, Y.; Blaabjerg, F.; Chen, Z. Inertia-emulation-based fast frequency response from EVs: A multi-level framework with game-theoretic incentives and DRL. IEEE Trans. Smart Grid 2025, 16, 5353–5364. [Google Scholar] [CrossRef]
  7. Bae, S.; Kwasinski, A. Spatial and temporal model of electric vehicle charging demand. IEEE Trans. Smart Grid 2012, 3, 394–403. [Google Scholar] [CrossRef]
  8. Aghapour, R.; Sepasian, S.M.; Arasteh, H.; Vahidinasab, V.; Catalão, J.P.S. Probabilistic planning of electric vehicles charging stations in an integrated electricity-transport system. Electr. Power Syst. Res. 2020, 189, 106698. [Google Scholar] [CrossRef]
  9. Goh, H.H.; Zong, L.; Zhang, D.; Liu, H.; Dai, W.; Lim, C.S.; Kurniawan, T.A.; Teo, K.T.K.; Goh, K.C. Mid-and long-term strategy based on electric vehicle charging unpredictability and ownership estimation. Int. J. Electr. Power Energy Syst. 2022, 142, 108240. [Google Scholar] [CrossRef]
  10. Dai, X.; Li, H.; Olanrewaju, I.; Kotter, R.; Putrus, G.; Aslam, N.; Bentley, E.; Wang, Y.; Marzband, M.; Das, R.; et al. Data-driven ev charging load forecasting and smart charging. Transp. Res. Procedia 2023, 72, 2832–2839. [Google Scholar] [CrossRef]
  11. Xing, Q.; Chen, Z.; Zhang, Z.; Xu, X.; Zhang, T.; Huang, X.; Wang, H. Urban Electric Vehicle Fast-Charging Demand Forecasting Model Based on Data-Driven Approach and Human Decision-Making Behavior. Energies 2020, 13, 1412. [Google Scholar] [CrossRef]
  12. Zhou, H.; Liu, F.; Chen, H.; Ni, Y.; Yang, S.; Xu, W. Predicting Electric Vehicle Charging Demand in Residential Areas Using POI Data and Decision-Making Model. IEEJ Trans. Electr. Electron. Eng. 2024, 20, 504–513. [Google Scholar] [CrossRef]
  13. Graham, J.; Teng, F. Vehicle-to-grid plug-in forecasting for participation in ancillary services markets. In Proceedings of the IEEE Belgrade PowerTech, Belgrade, Serbia, 25–29 June 2023. [Google Scholar]
  14. Zhang, Y.; Xu, S.; Xu, J.; Zeng, X.; Li, Z.; Xie, C. Robust Charging Demand Prediction and Charging Network Planning for Heterogeneous Behavior of Electric Vehicles. J. Shanghai Jiaotong Univ. (Sci.) 2023, 28, 136–149. [Google Scholar] [CrossRef]
  15. Liu, Y.; Liu, W.; Gao, S.; Wang, Y.; Shi, Q. Fast charging demand forecasting based on the intelligent sensing system of dynamic vehicle under EVs-traffic-distribution coupling. Energy Rep. 2022, 8, 1218–1226. [Google Scholar] [CrossRef]
  16. Eddine, M.D.; Shen, Y. A deep learning based approach for predicting the demand of electric vehicle charge. J. Supercomput. 2022, 78, 14072–14095. [Google Scholar] [CrossRef]
  17. Ma, Q.; Tong, X.; Huang, J.; Wang, P.; Li, J. Nodal charging demand forecast of EVs considering drivers’ psychological bearing ability based on NMC-MCS. IET Gener. Transm. Distrib. 2022, 16, 467–478. [Google Scholar] [CrossRef]
  18. Cao, T.; Xu, Y.; Liu, G.; Tao, S.; Tang, W.; Sun, H. Feature-enhanced deep learning method for electric vehicle charging demand probabilistic forecasting of charging station. Appl. Energy 2024, 371, 123751. [Google Scholar] [CrossRef]
  19. Wang, S.; Zhuge, C.; Shao, C.; Wang, P.; Yang, X.; Wang, S. Short-term electric vehicle charging demand prediction: A deep learning approach. Appl. Energy 2023, 340, 121032. [Google Scholar] [CrossRef]
  20. Bharat, M.; Dash, R.; Reddy, K.J.; Murty, A.S.R.; Muyeen, S.M. Secure and efficient prediction of electric vehicle charging demand using α2-LSTM and AES-128 cryptography. Energy AI 2024, 16, 100307. [Google Scholar] [CrossRef]
  21. Li, D.; Leung, M.-F.; Tang, J.; Wang, Y.; Hu, J.; Wang, S. Generative self-supervised learning for cyberattack-resilient EV charging demand forecasting. IEEE Trans. Intell. Transp. Syst. 2025; early access. [Google Scholar] [CrossRef]
  22. Koohfar, S.; Woldemariam, W.; Kumar, A. Prediction of electric vehicles charging demand: A transformer-based deep learning approach. Sustainability 2023, 15, 2105. [Google Scholar] [CrossRef]
  23. Gunasekaran, R.; Manjunatha, B.; Anand, S.; Pareek, P.K.; Gupta, S.; Shukla, A. Prediction of electric vehicle charging demand using enhanced gated recurrent units with RKOA based graph convolutional network. Discov. Appl. Sci. 2024, 6, 605. [Google Scholar] [CrossRef]
  24. Tolun, Ö.C.; Zor, K.; Tutsoy, O. A comprehensive benchmark of machine learning-based algorithms for medium-term electric vehicle charging demand prediction. J. Supercomput. 2025, 81, 475–507. [Google Scholar] [CrossRef]
  25. James, G.; Witten, D.; Hastie, T.; Tibshirani, R. An Introduction to Statistical Learning: With Applications in R, 2nd ed.; Springer: Berlin/Heidelberg, Germany, 2021. [Google Scholar]
  26. Ke, G.; Meng, Q.; Finley, T.; Wang, T.; Chen, W.; Ma, W.; Liu, T.Y. LightGBM: A highly efficient gradient boosting decision tree. In Advances in Neural Information Processing Systems, Proceedings of the 31st Conference on Neural Information Processing Systems, Long Beach, CA, USA, 4–9 December 2017; Curran Associates Inc.: Red Hook, NY, USA, 2017; pp. 3146–3154. [Google Scholar]
  27. Koenker, R. Quantile Regression: 40 Years On. Annu. Rev. Econ. 2017, 9, 155–176. [Google Scholar] [CrossRef]
  28. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. In Advances in Neural Information Processing Systems, Proceedings of the 31st Conference on Neural Information Processing Systems, Long Beach, CA, USA, 4–9 December 2017; Curran Associates Inc.: Red Hook, NY, USA, 2017; pp. 5998–6008. [Google Scholar]
  29. Wen, Q.; Zhou, T.; Zhang, C.; Chen, F.; Ma, Z.; Yan, J.; Sun, L. Transformers in time series: A survey. In Proceedings of the International Joint Conference on Artificial Intelligence (IJCAI), Macao, China, 19–25 August 2023. [Google Scholar]
  30. Zhou, H.; Zhang, S.; Peng, J.; Zhang, S.; Li, J.; Xiong, H.; Zhang, W. Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting. Proc. AAAI Conf. Artif. Intell. 2021, 35, 11106–11115. [Google Scholar] [CrossRef]
  31. Aduama, P.; Zhang, Z.; Al-Sumaiti, A.S. Multi-feature data fusion-based load forecasting of electric vehicle charging stations using a deep learning model. Energies 2023, 16, 1309. [Google Scholar] [CrossRef]
  32. Xiang, Y.; Jiang, Z.; Gu, C.; Deng, W.; Wang, X.; Zhu, X.; Wei, S. Electric Vehicle Charging in Smart Grid: A Spatial-Temporal Simulation Method. Energy 2019, 189, 116221. [Google Scholar] [CrossRef]
  33. Zhang, Y.; Zhang, Q.; Farnoosh, A.; Chen, S.; Li, X. GIS-Based Multi-Objective Particle Swarm Optimization of Charging Stations for Electric Vehicles. Energy 2019, 169, 844–853. [Google Scholar] [CrossRef]
  34. Zhang, Y.; Xu, T.; Chen, T.; Hu, Q.; Chen, H.; Hu, X.; Jiang, Z. A high-resolution electric vehicle charging transaction dataset with multidimensional features in China. Sci. Data 2025, 12, 643. [Google Scholar] [CrossRef]
Figure 1. Transformer Baseline Model Architecture [28].
Figure 1. Transformer Baseline Model Architecture [28].
Applsci 15 12982 g001
Figure 2. Model Framework with 1D Convolution.
Figure 2. Model Framework with 1D Convolution.
Applsci 15 12982 g002
Figure 3. Encoder–Decoder Architecture with Sparse Attention Mechanism.
Figure 3. Encoder–Decoder Architecture with Sparse Attention Mechanism.
Applsci 15 12982 g003
Figure 4. Periodic Encoding Steps.
Figure 4. Periodic Encoding Steps.
Applsci 15 12982 g004
Figure 5. CSPT-Net Model Architecture.
Figure 5. CSPT-Net Model Architecture.
Applsci 15 12982 g005
Figure 6. Data Distribution (different colors indicate data clusters corresponding to different start time intervals).
Figure 6. Data Distribution (different colors indicate data clusters corresponding to different start time intervals).
Applsci 15 12982 g006
Figure 7. Comparative distribution of charging events before and after preprocessing. (a) Raw data exhibiting high-variance noise and unconstrained outliers; (b) cleaned data showing a physically constrained and logically valid distribution.
Figure 7. Comparative distribution of charging events before and after preprocessing. (a) Raw data exhibiting high-variance noise and unconstrained outliers; (b) cleaned data showing a physically constrained and logically valid distribution.
Applsci 15 12982 g007
Figure 8. Training Iteration Plot.
Figure 8. Training Iteration Plot.
Applsci 15 12982 g008
Figure 9. There is prediction results of the different models: (a) CSPT-Net; (b) Transformer; (c) HistGradientBoosting; (d) QuantileRegressor; (e) LinearRegression.
Figure 9. There is prediction results of the different models: (a) CSPT-Net; (b) Transformer; (c) HistGradientBoosting; (d) QuantileRegressor; (e) LinearRegression.
Applsci 15 12982 g009
Figure 10. Distribution of AE for All Charging Records and MAE per Vehicle.
Figure 10. Distribution of AE for All Charging Records and MAE per Vehicle.
Applsci 15 12982 g010
Figure 11. This is Comprehensive Performance Evaluation of Charging Duration. (a) Distribution of Charging Time AE and MAE per Vehicle for Different Models. (b) Distribution of Charging Time APE and MAPE per Vehicle for Different Models.
Figure 11. This is Comprehensive Performance Evaluation of Charging Duration. (a) Distribution of Charging Time AE and MAE per Vehicle for Different Models. (b) Distribution of Charging Time APE and MAPE per Vehicle for Different Models.
Applsci 15 12982 g011
Figure 12. Distribution of Mean SHAP Values for Features.
Figure 12. Distribution of Mean SHAP Values for Features.
Applsci 15 12982 g012
Table 1. Description of Feature Categories.
Table 1. Description of Feature Categories.
Feature CategoryDescription & Purpose
Temporal FeaturesReflect the regularity and periodicity of charging behavior, significantly influenced by factors like weekdays, weekends, and holidays.
Metadata FeaturesRepresent the static physical attributes and constraints of the vehicle, remaining constant across all charging sessions.
Environmental FeaturesCapture the external climatic conditions during charging, enhancing the model’s adaptability to seasonal and extreme weather behaviors.
Transactional FeaturesReflect the user’s economic expenditure and energy acquisition, used to capture behaviors of price-sensitive users and for user segmentation.
Charging State FeaturesCharacterize the termination status of a charging session, used to identify completion levels and anomalies, thereby improving model robustness.
Historical FeaturesRepresent the temporal dependencies of a user’s past behavior, enhancing the model’s short-term memory and uncovering evolving behavioral patterns.
Table 2. A Selection of Key Extracted Features for the Prediction Model.
Table 2. A Selection of Key Extracted Features for the Prediction Model.
FeatureCategoryDescription
startSinTemporalThe sine of the start time, used for cyclical encoding of the hour of the day.
weekendTemporalA boolean value indicating if the session occurred on a weekend.
carKWhMetadataThe capacity of the EV’s battery, which is constant for a given vehicle.
TemperatureEnvironmentalThe ambient temperature at the time of charging.
TransactionPowerTransactionalThe amount of energy transacted during the session.
isFullChargeCharging StateA boolean value indicating if the session was terminated abnormally.
lastDurationHistoricalThe duration of the user’s previous charging session.
Table 3. Model Parameter Settings.
Table 3. Model Parameter Settings.
ParameterSetting
Dataset Split Ratio0.8:0.2
Transformer Structure3 layers, 4 attention heads, feed-forward dimension of 128
OptimizerAdamW (lr = 0.001)
Weight Decay0.01
Learning Rate SchedulerReduceLROnPlateau
Batch Size32
Max Training Epochs100
Table 4. Performance Evaluation of Charging Duration Prediction for All Vehicles.
Table 4. Performance Evaluation of Charging Duration Prediction for All Vehicles.
TargetModelMAE (min)MdAE (min)MAPEMdAPESMAPETraining Time (s)
Charging TimeTransformer14.276.2419.8%17.62%14.6%1850
HistGradientBoosting18.2110.0850.5%19.96%15.7%85
QuantileRegressor21.2413.2061.2%20.33%16.4%15
LinearRegression23.1813.1462.7%23.54%17.4%10
CSPT-Net12.214.9218.4%14.18%14.5%763
Note: Bold values indicate the best performance in each column.
Table 5. Performance Evaluation of Mean Charging Duration Prediction per Vehicle.
Table 5. Performance Evaluation of Mean Charging Duration Prediction per Vehicle.
TargetModelMAE (min)MdAE (min)MAPEMdAPESMAPE
Charging TimeTransformer16.112.935.7%23.1%22.3%
HistGradientBoosting21.214.842.9%39.8%39.2%
QuantileRegressor23.915.159.6%40.7%45.2%
LinearRegression24.115.261.2%43.9%47.1%
CSPT-Net13.411.229.2%21.6%20.8%
Note: Bold values indicate the best performance in each column.
Table 6. Results of the Ablation Study on Model Components.
Table 6. Results of the Ablation Study on Model Components.
ModelMAE (min)MdAE (min)MAPEMdAPESMAPETraining Time (s)
CSPT-Net (w/o CNN)13.585.8120.1%15.5%15.3%745
CSPT-Net (w/o Sparse Attention)12.555.1319.2%14.8%14.5%1810
CSPT-Net (w/o Periodic Encoding)13.926.0521.5%16.2%15.9%758
CSPT-Net (Full Model)12.214.9218.4%14.18%14.5%763
Note: Bold values indicate the best performance in each column.
Table 7. Performance Comparison with Environmental Factors.
Table 7. Performance Comparison with Environmental Factors.
Model VariantMAE (min)MdAE (min)MAPE (%)MdAPE (%)SMAPE (%)
CSPT-Net (Baseline)12.214.9218.4014.1814.50
CSPT-Net + Temp12.154.8918.3214.1214.45
Note: Bold values indicate the best performance in each column.
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Shi, L.; Lei, X.; Gao, R. A Convolutional Sparse Periodic Transformer Network for Electric Vehicle Charging Demand Forecasting. Appl. Sci. 2025, 15, 12982. https://doi.org/10.3390/app152412982

AMA Style

Shi L, Lei X, Gao R. A Convolutional Sparse Periodic Transformer Network for Electric Vehicle Charging Demand Forecasting. Applied Sciences. 2025; 15(24):12982. https://doi.org/10.3390/app152412982

Chicago/Turabian Style

Shi, Lingxia, Xu Lei, and Ruinian Gao. 2025. "A Convolutional Sparse Periodic Transformer Network for Electric Vehicle Charging Demand Forecasting" Applied Sciences 15, no. 24: 12982. https://doi.org/10.3390/app152412982

APA Style

Shi, L., Lei, X., & Gao, R. (2025). A Convolutional Sparse Periodic Transformer Network for Electric Vehicle Charging Demand Forecasting. Applied Sciences, 15(24), 12982. https://doi.org/10.3390/app152412982

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop