In our previous article, we introduced V2X and explained how vehicle-to-building (V2B) operation lets batteries supply a building while meeting transport needs. Here, we turn to the decisions behind that coordination: when to charge, when to discharge, and how to respond when conditions change.
Earlier E3 research by Chien and Hsieh examined V2G scheduling at electric-scooter battery-swapping stations, assessing effects on grid peak demand, operating costs and emissions [1].
For V2B operation, a related challenge is coordinating batteries with building demand while making fast decisions under uncertainty. Yeoh and colleagues explore how imitation learning can support these decisions [2].
Why Is Real-time V2B Scheduling Difficult?
A swapping station’s charging decisions affect both its battery inventory and the building’s electricity supply. Charging early can prepare batteries for riders, but may involve buying electricity during expensive hours. Waiting could allow cheaper charging or greater use of solar power. Supplying the building now uses energy that may need replenishing before later swaps.
A common approach forecasts building demand, solar generation and transport needs, then uses optimization to calculate a schedule within equipment and battery limits. As new information arrives, the schedule can be recalculated.
Forecast errors can change which actions are useful. Recalculating also takes time, with its practical significance depending on the model, hardware, and control interval. The challenge is to make economically useful decisions with incomplete information and produce them within the time available.
How Does AI Learn to Make These Decisions?
AI can learn to make these decisions from worked examples. The study uses an approach called imitation learning: an optimization model provides examples of charging and discharging decisions, and a learning model is trained to reproduce them.
The teacher is a mixed-integer linear programming (MILP) model. During preparation, it uses historical trajectories with perfect knowledge of future conditions to generate charging and discharging examples. Its schedules incorporate electricity prices, battery limits and swap requirements.
The learner is Static–Temporal Attention Fusion (STAF). It uses the past 24 hours of observations, together with time and current fleet-charge information, to learn a mapping from available information to a dispatch request. Inputs include building load, weather, tariffs, estimated swap demand, and past actions.
During operation, STAF outputs the battery fleet’s charging or discharging power request. A separate allocation step distributes that request among batteries and enforces power and charge limits. The detailed optimization work has already been used to prepare the training examples. The figure below brings together how the controller learns and how it operates.

What Does “Forecast-Free” Mean in Operation?
Forecasting still plays a role inside STAF. Before learning the dispatch task, the network is pretrained to predict the next 12 hours of its input time series. This helps it learn patterns in how the system changes over time.
The forecasting component is retained inside the network, and its output helps inform the final dispatch decision. Here, “forecast-free” means that operation requires no separate external forecasting module and no online optimization solve. Internally generated forecast features remain part of the learned controller.
Training data also matter. The station inventory series had approximately 84% missing records, which the team reconstructed statistically. Its comparison found that lower reconstruction errors did not necessarily lead to lower operating costs. This supports assessing data preparation through the decisions it enables, alongside the accuracy of the reconstructed records.
What Did the Simulation Show?
The team tested hourly energy decisions in a 72-hour closed-loop simulation linking two Gogoro stations with an academic building at NTU [2]. The study compared electricity cost and decision time under different forecasting conditions.
Across 20 training runs, STAF’s median electricity cost was 7.7% above a perfect-foresight MILP benchmark, which used known future conditions to optimize its decisions. Forecast-MILP achieved a lower median cost than STAF at the nominal 10% forecast-error level. At 20% and 30%, STAF had lower median costs, showing how the comparison changed as forecast errors increased. However, the distributions overlapped, and forecast-MILP had the lower mean at 20%, so the ranking depended on the statistic used. STAF also required less computation: its median decision time was 0.79 milliseconds, compared with 926 milliseconds—about one second—for the perfect-foresight benchmark on the test workstation. Both measurements excluded battery allocation and safeguards. MILP still completed within the hourly control interval, meaning both approaches were fast enough for the simulated hourly decisions. These findings show how STAF can provide rapid decisions while remaining competitive on modeled electricity cost under the tested conditions.

What Does This Mean for V2B Operation?
The findings support comparing control strategies against a site’s information, computing resources, and service needs. Reliable forecasts and sufficient computation time can favor optimization; learned control offers another option when reducing external forecasting dependencies and per-decision computation is useful.
Applying it elsewhere would require representative training data and appropriate equipment and service rules. Longer tests across seasons and sites would help assess transferability. Investment decisions also need costs beyond the study’s time-of-use electricity purchases, including equipment, demand charges where applicable, and battery wear.
At E3 Center, we study how data, optimization and learning can support energy decisions across buildings, transport and the electricity system. We will continue sharing research and perspectives on the practical choices behind energy management.
References
[1] Chien, Y.-H., & Hsieh, I.-Y. L. (2025). Enhancing urban energy resilience: Vehicle-to-grid (V2G) strategies within electric scooter battery swapping ecosystems. Sustainable Cities and Society, 118, 106004. https://doi.org/10.1016/j.scs.2024.106004
[2] Yeoh, J. H., Ding, J.-W., Ou, S., & Hsieh, I.-Y. L. (2027). Forecast-free real-time V2B control of battery swapping stations as distributed battery assets via imitation learning. Applied Energy, 427, 129239. Published online 10 November 2026. https://doi.org/10.1016/j.apenergy.2026.129239








