As electric vehicles (EVs) continue to gain market share, national strategies are evolving to meet the growing demand for public charging infrastructure. Portugal, in particular, has committed to fostering sustainable mobility by scaling its EV charging networks and encouraging EV adoption through fiscal incentives. While the infrastructure has expanded significantly, the unpredictable usage patterns of EV charging stations (EVCS) have introduced new operational and user experience challenges.
This study addresses one of the critical gaps in the current ecosystem: the absence of predictive insight into the future availability of EVCS. Current applications provide real-time status updates but fall short of forecasting upcoming availability, a feature that could help EV users better plan their journeys and reduce "charging anxiety." The work we undertake here focuses on building predictive systems that anticipate the utilization states of charging stations across the country using artificial intelligence techniques.
The ultimate goal is to enable integration of these models into web and mobile applications, improving the EV charging experience while supporting infrastructure planning and grid optimization efforts.
Forecasting the usage of EVCS presents both technical and behavioral challenges. Prior studies across Europe and Asia have approached the problem using ensemble models, logistic regression, random forests, LSTM networks, and hybrid models. These works largely confirm that temporal and spatial data patterns significantly affect the usability and accuracy of forecasting models.
Recent research highlights the importance of historical usage data, localized model training, and real-time data streaming for accurate short-horizon predictions. Some studies demonstrate how advanced ensemble and neural network models can predict availability at the station level. For instance, work conducted in Germany, France, the Netherlands, and the UK has employed models ranging from simple regression to complex architectures like LSTM and Spatial-Temporal Graph Convolutional Networks.
However, the most promising direction appears to be deep learning models incorporating attention mechanisms – particularly Transformers. These architectures have shown strong performance in long-sequence time-series forecasting, though their application to EVCS usage prediction remains largely unexplored. Our study leverages this gap by applying a Transformer-based architecture specifically adapted to the discrete state transitions that characterize EVCS usage data, marking a novel contribution in the domain.
This study uses an integrated stack of data-driven AI technologies to predict EVCS utilization:
We start by collecting and processing large volumes of real-time status updates from MOBI.E’s API, which logs state transitions for over 12,000 charging ports nationwide. Each record captures the station identifier, timestamp, and status – categorized as Available, Busy, Unavailable, or Unknown.
To handle this data, we implement two distinct preprocessing pipelines. The first computes charging event durations from status transitions. The second creates fixed-interval time series (5-minute steps) to support temporal sequence learning, with imputed state values filling non-event gaps.
For modeling, we initially experiment with machine learning approaches such as linear regression, XGBoost, and multilayer perceptrons. These are trained independently for each EVCS but are ultimately set aside due to limited forecasting accuracy.
The primary innovation lies in our deployment of a custom Transformer-based deep learning architecture, built with PyTorch. Inspired by the Informer model, we integrate ProbSparse attention to reduce computational overhead while maintaining the model's ability to capture long-range temporal dependencies. The model is structured as a sequence-to-sequence predictor, taking as input a historical sequence of EVCS states and outputting a prediction of future states.
We train individual Transformer models for EVCS groups formed via geographic clustering (using DBSCAN with a 5 km radius), allowing us to model spatial dependencies while reducing the overall number of models required. The system is engineered for scalability and real-time inference, making it suitable for web and mobile deployment.
The result is a deep learning framework capable of modeling the stochastic nature of EVCS usage across diverse locations and charging profiles, laying the groundwork for intelligent, data-driven infrastructure management.
Study Details
The goal of this study is to construct a predictive framework capable of forecasting the short-term utilization states of electric vehicle charging stations (EVCS) across Portugal. The core challenge we face is to extract usable forecasts from high-dimensional, non-linear, and often sparse time-series data, while ensuring the system can scale across a growing, heterogeneous charging network. This work is driven by the need for better load balancing in the electrical grid, improved user experience for EV drivers, and smarter infrastructure planning by public and private entities.
From the outset, we defined two primary technical-scientific objectives: to develop machine learning or deep learning models that can predict future EVCS availability, and to ensure these models exhibit scalability and operational feasibility in real-world applications. We prioritize performance metrics, particularly forecast accuracy, and complement this with constraints around training speed and inference latency.
To reach these goals, we explore two modeling strategies, each aligned with a specific data preprocessing approach. The first strategy centers on predicting charging duration per event using traditional ML techniques. However, performance issues and scaling limitations lead us to focus on the second strategy, which adopts a deep learning forecasting approach using sequence modeling.
We developed and trained 83 Transformer-based models using grouped data from 415 charging stations, representing a statistically significant sample of the national EVCS network. We apply spatial clustering based on GPS coordinates to create EVCS groups, assuming that geographic proximity captures shared behavioral and infrastructural characteristics.
The architecture is a custom encoder-decoder Transformer with ProbSparse attention mechanisms, optimized for long-range temporal dependencies. We manually tune hyperparameters to balance memory usage, training time, and forecast precision. The sequence modeling task uses discrete status labels (Available, Busy, Unavailable, Unknown), diverging from typical continuous-output forecasting and requiring architectural adaptation. We implemented teacher forcing during training and perform inference with multi-step sequence generation.
The trained Transformer models demonstrate strong performance in forecasting EVCS availability. For the “Available” state, f1-scores consistently exceed 90%, indicating high reliability in predicting when a station will be free. For the remaining states, scores range from 50% to 60%, reflecting the challenge of capturing shorter, less predictable usage intervals.
We observe that forecasting accuracy is inversely correlated with EVCS usage frequency. Stations with fewer state transitions – typically those in less trafficked areas – yield higher forecast accuracy. Conversely, busy stations, characterized by rapid and frequent state changes, are harder to predict. This points to the need for further architectural refinement or data stratification to better capture these outlier patterns.
Geographic analysis reveals no significant regional bias in model performance, suggesting that the forecasting models generalize well across diverse environments, from urban centers to rural areas. The models also appear indifferent to charger type (e.g., fast vs. slow), though a slight performance degradation is noted for fast chargers.
Importantly, inference time is measured in seconds, confirming that the Transformer models are suitable for real-time applications. This opens the door to integrating the forecasting layer into client-facing platforms, providing users with predictive availability at the point of decision-making – on a mobile app or in a navigation system.
From a technical standpoint, the study confirms the viability of Transformer-based architectures for discrete-state, time-series forecasting of EVCS usage. The incorporation of ProbSparse attention enables model efficiency without sacrificing temporal fidelity, and the use of spatial clustering introduces a scalable modeling approach without collapsing important regional distinctions.
Business-wise, the forecasting layer has significant implications for both consumers and infrastructure operators. For users, knowing whether a charger will be available in 15–30 minutes enables route optimization, reduced waiting time, and lower “charge anxiety.” For public authorities and private operators, forecast data can inform decisions on where to add capacity, adjust pricing dynamically, or even preemptively manage load on the grid.
Further work will include hyperparameter optimization using automated search techniques, and exploration of newer Transformer variants with stronger inductive biases for spatio-temporal modeling.