Next Article in Journal
Adaptive Risk-Driven Control Strategy for Enhancing Highway Renewable Energy System Resilience Against Extreme Weather
Previous Article in Journal
Bridging Borders and Brains: ESG Sustainability, Integration, Education and Energy Choices in Developed Economies
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Cost-Optimization Model for EV Charging Stations Utilizing Solar Energy and Variable Pricing

1
College of Engineering and Computer Science, VinUniversity, Hanoi 131000, Vietnam
2
Center for Environmental Intelligence (CEI), VinUniversity, Hanoi 131000, Vietnam
*
Authors to whom correspondence should be addressed.
Energies 2025, 18(20), 5416; https://doi.org/10.3390/en18205416
Submission received: 1 September 2025 / Revised: 17 September 2025 / Accepted: 22 September 2025 / Published: 14 October 2025
(This article belongs to the Section E: Electric Vehicles)

Abstract

Managing electric vehicle (EV) charging at stations with on-site solar (PV) generation is a complex task, made difficult by volatile electricity prices and the need to guarantee services for drivers. This paper proposes a robust optimization (RO) framework to schedule EV charging, minimizing electricity costs while explicitly hedging against price uncertainty. The model is formulated as a tractable linear program (LP) using the Bertsimas–Sim reformulation and is implemented in an online, adaptive manner through a model predictive control (MPC) scheme. Evaluated on extensive real-world charging data, the proposed controller demonstrates significant cost reductions, outperforming a PV-aware Greedy heuristic by 17.5% and a deep reinforcement learning (DRL) agent by 12.2%. Furthermore, the framework exhibits lower cost volatility and is proven to be computationally efficient, with solving times under five seconds even during peak loads, confirming its feasibility for real-time deployment. The results validate our framework as a practical, reliable, and economically superior solution for the operational management of modern EV charging infrastructure.

1. Introduction

Climate change remains a defining challenge of this century. Vietnam’s commitment to net-zero by 2050 [1] reflects a decisive policy stance, yet the pathway requires the major decarbonization of transport—a sector responsible for roughly 10.8% of national emissions and projected to grow 6–7% annually [2]. Accelerating the uptake of electric vehicles (EVs) is therefore pivotal [3]. Domestic momentum—illustrated by rapid EV market growth [4,5]—exposes infrastructure bottlenecks: public charging scarcity [6], stressed urban feeders, and rising operating costs. Given Vietnam’s strong solar resource, co-locating PVs at charging stations is a promising lever to reduce grid imports, hedge prices, and advance net-zero goals [7].

1.1. Positioning Within Recent Literature

PV-coupled EV charging has matured along four complementary strands. (i) Planning and siting with renewables: system-level studies co-optimize the siting/sizing of charging infrastructure and renewables within grid limits, but do not address real-time station operations [8]. (ii) Station-level operational control (MPC): large facilities with PV and hundreds of chargers deploy model predictive control using forecasts to balance building limits and service quality, typically under deterministic or point-forecasted prices [9]. (iii) Uncertainty-aware scheduling and robust optimization: newer works build stochastic or robust formulations to protect against price/load/solar errors—e.g., robust dispatch with EV aggregators and studies of uncertain charging flexibility [10,11]. These approaches improve worst-case behavior but often rely on large scenario sets or complex uncertainty sets. (iv) PV-aware smart charging at stations: surveys of integrated EVCS–PV–ESS architectures synthesize capacity allocation and control strategies aimed at improving self-consumption and reducing curtailment [12,13]. Related but orthogonal to our focus, resilience-oriented planning leverages mobile robot chargers to sustain service under extreme conditions [14].

1.2. Gap and Contributions

This paper targets the under-explored intersection of station-level scheduling with on-site PV and explicit protection against day-ahead price errors, while keeping the controller lightweight. Unlike planning papers that decide siting/sizing [8], we assume an existing site; unlike deterministic MPC [9], we do not rely on accurate prices; and unlike scenario-heavy stochastic control [10,11], we avoid large ensembles by adopting a budgeted (Bertsimas–Sim) price-uncertainty model that integrates directly into a linear program (LP). Concretely, our contributions are given as follows:
(1)
Robust PV-coupled station optimizer. We formulate a linear program that co-schedules per-EV charging and PV utilization under a budgeted electricity-price uncertainty set, yielding a single tunable parameter Γ to trade nominal cost for worst- case protection.
(2)
Scenario-free MPC integration. We embed the robust LP in a receding-horizon loop that re-solves on arrivals/departures or at fixed intervals, maintaining computational tractability for large stations without scenario generation.
(3)
Empirical evaluation on realistic data. Using real prices, irradiance, and multi-EV session traces, we quantify nominal savings, robustness benefits, and solve-time scaling versus a baseline scheduler.

1.3. Paper Organization

Section 2 and Section 3 introduce the notation and the base LP. Section 4 details the robustification and the MPC wrapper. Section 5 reports results (cost comparison, sensitivity to Γ , and computational performance). Section 7 concludes and Section 6 outlines limitations and future work.

2. Symbols and Parameters

The parameters used in the optimization model are defined below:
  • T: Number of time steps in a day (e.g., T = 24 h).
  • Δ t : Length of each time step (hours).
  • N: Number of electric vehicles (EVs).
  • p t grid : Electricity price from the grid at time t (Euro/kWh).
  • R t : Solar energy output at time t (kW).
  • R ¯ t : Maximum achievable solar energy output at time t (kW).
  • s i : Maximum charging power provided by the charging station for EV i (kW).
  • A t , i : Matrix representing the charging time of vehicle i by hour.
  • C grid : Grid capacity limit (kW).
  • η : Charging efficiency of the EV (in the range ( 0 , 1 ] ).
  • L i : Minimum required energy (kWh) that the EV i needs when leaving the station.
  • T i : Set of time points when EV i is present at the station (based on A t , i ).

3. Optimization Model

Several straightforward solutions have been considered for managing EV charging, such as the “First Come, First Served” (FCFS) principle, which guarantees equity by servicing vehicles in the sequence of their arrival. However, FCFS lacks consideration of critical factors such as electricity pricing, real-time energy demand, and overall impact on the power grid. This limitation can lead to inefficient energy allocation, increased operational costs, and potential grid instability, especially during peak demand periods.
Figure 1 illustrates the power flow diagram of charging stations with solar-integration. The charging socket receives energy from both the solar panel and the grid, and then delivers it to the EVs. In this model, we employ a linear programming approach to minimize net electricity consumption costs, which only occur when the charging demand exceeds the available solar renewable energy.
Decision variables:
  • Y i , t 0 : Charging power (kW) of EV i at time t.
  • S t + 0 : Auxiliary variable representing the positive part of the net load at time t, that is
    S t + = max i = 1 N Y i , t R t , 0 .
  • R t : The amount of solar energy used at time t.
Objective Function:
min Y , S + , R t = 1 T p t grid S t + Δ t ,
where S t + is used to linearize the expression i = 1 N Y i , t R t .
The solar contribution R t is computed as follows:
R t = A pv G ( t ) 1000 η pv ,
where
  • A pv indicates the area of the PV panels in m2;
  • G ( t ) indicates the solar irradiance in W/m2;
  • η pv is the efficiency of the PV panels.
Constraints:
(1)
Each EV i must be charged with at least the minimum required energy L i throughout its available period T i . Here, η is the charging efficiency, Y i , t is the charging power at time t, and Δ t is the length of each time interval. This requirement can be expressed as
η t T i Y i , t Δ t L i , i .
(2)
The charging power of each EV at time t must not exceed the maximum power limit s i that the station provides. However, the actual available power is scaled by the fraction of the time interval during which the EV i is connected, denoted by A t , i . For example, if the EV is connected only for 10 min in an hour (i.e., A t , i = 10 60 ), then the maximum available charging power becomes s i × 10 60 . When the EV is not connected (i.e., A t , i = 0 ), no charging power is provided, ensuring that Y i , t = 0 . This is modelled by
Y i , t s i A t , i , i , t .
(3)
The total charging power from all EVs at time t must not exceed the maximum grid capacity C grid after subtracting the renewable energy R t :
i = 1 N Y i , t R t C grid , t .
(4)
The variable S t + represents the additional power to be purchased from the grid if the total charging power exceeds R t . When renewable energy sufficiently supplies the EVs, S t + may be zero. It is ensured that the power purchased from the grid cannot be negative:
S t + 0 , t .
(5)
Finally, the solar energy R t cannot exceed its maximum available limit R ¯ t at each time and it must be greater than or equal to 0:
0 R t R ¯ t , t .
Database:
We obtained detailed charging session information from 2018 to 2019 from ACN Data—a public dataset on electric vehicle (EV) charging collected through a collaboration between the PowerFlex System and the California Institute of Technology (Caltech)  [15]. This dataset comprises detailed information on EV charging sessions at two distinct locations: the Caltech campus and the Jet Propulsion Laboratory (JPL) campus. The JPL site is representative of workplace charging, whereas Caltech represents a hybrid of workplace and public charging.
We selected hourly electricity price data for Spain corresponding to the same period as the charging data, sourced from Ember—European Wholesale Electricity Price Data [16].
Hourly irradiance data were obtained from the EU Science Hub [17] for the same period. We assume that G t represents G ( i ) [W/m2]—the global in-plane irradiance with a slope of 36 and an azimuth of 0 —with Madrid, Spain, chosen as the representative location.
Lastly, Table 1 shows the values of the constant parameters used during the simulation.

4. Proposed Methodology

To account for uncertainty in the electricity price, we model the grid price at time t as
p t grid = p ^ t + Δ p t ,
where p ^ t is the nominal electricity price and Δ p t represents the deviation from this nominal value. We assume that the deviation is bounded as
| Δ p t | Δ p ¯ t , t .
To avoid an overly conservative solution—i.e., assuming that every time period experiences the maximum deviation simultaneously—we adopt a budget of uncertainty Γ . The uncertainty set for Δ p = ( Δ p 1 , , Δ p T ) is defined as
U = Δ p R T : | Δ p t | Δ p ¯ t , t = 1 T | Δ p t | Δ p ¯ t Γ .
The nominal electricity cost from the grid is given by
t = 1 T p t grid S t + Δ t = t = 1 T p ^ t S t + Δ t ,
where S t + represents the purchased electricity (in kW) from the grid at time t. Under uncertainty, the robust counterpart of the objective becomes a min–max formulation:
min Y , S + , R max Δ p U t = 1 T p ^ t + Δ p t S t + Δ t .
This expression can be decomposed into the nominal cost and the additional cost resulting from the uncertainty:
t = 1 T p ^ t S t + Δ t + max Δ p U t = 1 T Δ p t S t + Δ t .

4.1. Bertsimas–Sim Reformulation

We now reformulate the inner maximization problem:
max Δ p U t = 1 T Δ p t S t + Δ t ,
subject to
| Δ p t | Δ p ¯ t , t ,
t = 1 T | Δ p t | Δ p ¯ t Γ .
Here, the terms S t + and Δ t are treated as fixed parameters. Following the approach of Bertsimas and Sim [18], we introduce an auxiliary scalar variable λ 0 and auxiliary variables μ t 0 for all t = 1 , , T . The worst-case additional cost due to price deviation is then equivalently expressed as
Γ λ + t = 1 T μ t ,
subject to the dual feasibility constraints
μ t Δ p ¯ t S t + Δ t λ , t .

4.2. Final Robust Optimization Model

Incorporating the Bertsimas–Sim reformulation into the full model, the robust optimization problem is given by
min Y , S + , R , λ , μ t = 1 T p ^ t S t + Δ t + Γ λ + t = 1 T μ t s . t . μ t Δ p ¯ t S t + Δ t λ , t , λ 0 , μ t 0 , t , η t T i Y i , t Δ t L i , i , Y i , t s i A t , i , i , t , i = 1 N Y i , t R t C grid , t , S t + i = 1 N Y i , t R t , t , S t + 0 , t , 0 R t R ¯ t , t , Y i , t 0 , i , t .
Here, the term t = 1 T p ^ t S t + Δ t represents the nominal electricity cost from the grid, while Γ λ + t = 1 T μ t captures the worst-case additional cost under bounded price uncertainty. The budget parameter Γ offers a flexible trade-off between protection against extreme scenarios and conservatism in scheduling decisions.

4.3. Algorithm Development: An Online Implementation

The robust optimization model presented in the previous sections addresses the power allocation problem in a static (offline) setting, assuming that all information about charging sessions is known beforehand. However, in a real-world operational environment, charging stations must operate dynamically (online), handling the random and continuous arrival and departure of electric vehicles. To address this challenge, we develop an online control algorithm based on the Model Predictive Control (MPC) methodology.
The MPC approach allows our optimization model to be applied in real-time. The core idea is that, at each time step, the algorithm solves an optimization problem for a future prediction horizon but only executes the control action for the immediate next time step. This process is repeated, enabling the system to continuously update and adapt to new information. The specific algorithm is presented in Algorithm 1.
Algorithm 1 Online smart charging using MPC
1:
Input: time horizon slots k = 0 , 1 , 2 , , re-solve interval Δ , electricity price p t , station capacity C grid , efficiency η , slot length Δ t
2:
Initialize: l a s t S o l v e
3:
for k = 0 , 1 , 2 , do
4:
    for each new EV j arriving at k do
5:
         r e m D e m a n d j L j
6:
    end for
7:
     V k { i a r r i v a l i k < d e p a r t u r e i r e m D e m a n d i > 0 }
8:
    if new arrival/departure at k or k l a s t S o l v e Δ  then
9:
         T [ k , , max i V k ( d e p a r t u r e i ) 1 ]
10:
         ( Y i , t * , R t * ) OPT ( V k , T )           ▹Call the robust optimization solver
11:
         l a s t S o l v e k
12:
    end if
13:
     R k R k *                   ▹Set solar power for the current slot
14:
    for all i V k  do
15:
         Y i ( k ) Y i , k *              ▹Apply the first step of the optimal plan
16:
         r e m D e m a n d i max ( 0 , r e m D e m a n d i η · Y i ( k ) · Δ t )
17:
    end for
18:
end for
The algorithm operates in a continuous loop over time slots k. At each slot, it performs the following steps:
(1)
Handling new arrivals (Lines 4–6): When a new electric vehicle j connects to the station at time k, the system initializes and records its remaining energy demand, r e m D e m a n d j , to be its total required energy L j .
(2)
Re-optimization trigger (Line 8): Instead of re-solving the optimization problem at every time slot (which is computationally expensive), we use a dual-trigger mechanism. The optimization process is invoked only when one of the following two conditions is met:
  • Event-driven trigger: A new vehicle arrives or an existing one departs. This ensures that the system reacts immediately to changes in charging demand.
  • Time-driven trigger: A predefined time interval Δ has passed since the last optimization ( k l a s t S o l v e Δ ). This ensures that the charging schedule is periodically updated to reflect the changes in external factors, such as the electricity price p t or the expected solar energy generation.
(3)
Solving the optimization problem (Lines 9–11): When triggered, the algorithm will
  • Determine the set of vehicles currently at the station that still require charging ( V k ).
  • Establish a prediction horizon T, starting from the current time k, and extending to the latest departure time among all vehicles in V k .
  • Call the function OPT( V k , T ), which is the robust optimization model, to find the optimal charging schedule Y * and solar energy usage plan R * for the entire horizon T.
(4)
Execution and state update (Lines 13–17): This step embodies the MPC principle. Instead of applying the entire calculated schedule Y * , the algorithm only executes the first step of the plan:
  • It assigns the charging power Y i ( k ) for each vehicle i and the solar energy usage R k only for the current time slot k.
  • It then updates the system’s state by reducing the remaining energy demand r e m D e m a n d i of each vehicle based on the actual energy delivered in that time slot ( η · Y i ( k ) · Δ t ).
By repeating this cycle, the algorithm enables the charging station to continuously optimize its operations dynamically, ensuring cost-effectiveness while adapting to the unpredictable nature of real-world EV charging sessions.

5. Results and Discussion

5.1. Experimental Setup and Baselines

We evaluate the proposed robust LP controller in a receding-horizon loop against three baselines that reflect common practice and stronger algorithmic alternatives:
  • FCFS (first come, first served). Power is allocated according to arrival order without considering real-time prices. At time t, the power to EV i is X t i = min s i , L i res , C t res , where s i is the connector limit, L i res is the remaining energy of EV i, and C t res is the station’s remaining capacity. If C t res = 0 , subsequent arrivals must wait.
  • Greedy price-first (PV-aware). A myopic heuristic that uses all available PV first, then fills the residual demand with grid energy starting from the lowest-price slots subject to per-connector and station limits. Implementation details are provided in as shown in Algorithm A1 in Appendix A.
  • DRL (DQN) Baseline. A Deep Q-Network policy that, at each slot, chooses binary per-EV grid on/off decisions while PV is allocated greedily. The state aggregates price, PV, grid capacity, and session features; the reward is the negative electricity cost with penalties for unmet energy at departure. Training and update rules appear in as shown in Appendix B.
All methods are evaluated on the same arrivals/departures, PV profiles, price signals, and physical limits. Unless otherwise specified, the robustness budget Γ in our controller is fixed across months.

5.2. Monthly Cost Comparison

Figure 2 reports monthly electricity costs from 25 April 2018 to 31 December 2019 for the three methods. The proposed LP attains the lowest cost in every month, outperforming both Greedy price-first and DRL (DQN). Over the entire horizon, the LP reduces total cost by 17.5% relative to Greedy and by 12.2% relative to DQN, with typical monthly savings of EUR 233 and EUR 153, respectively. Improvements are pronounced in shoulder/winter periods when PV is scarce, indicating more effective price-aware scheduling. Late-summer 2018 shows the highest absolute costs across all methods, but the LP still maintains a consistent advantage.

5.3. Weekly Cost Distribution

To examine distributional properties, Figure 3 shows weekly cost box plots for the same period. The LP exhibits the lowest median and a visibly narrower interquartile range (IQR) than both baselines, demonstrating lower volatility week-to-week. The upper whisker is also shorter for the LP, indicating fewer extreme high-cost weeks. These distributional results complement the monthly aggregates by showing that the LP improves both the central tendency and the tail behavior of operating costs.

5.4. Comparing Total Power Allocation Based on Price Fluctuation

The temporal allocation patterns explain the observed savings. The panels in Figure 4 compare total charging power across a representative day under varying prices. The LP concentrates charging in low-price valleys and throttles during peaks, while non-price-aware allocation (e.g., FCFS) often consumes grid energy during expensive hours, driving up costs. For example, at Caltech, around 02:00 on 7 September 2018 (price 55  EUR/MWh), the LP schedules substantially more energy than FCFS; the latter compensates later at higher prices, resulting in unnecessary expenditure. Similar dynamics appear at JPL around 00:00 on 2 May 2019. Overnight charging windows are particularly advantageous for the LP due to sustained low prices.

5.5. Additional Observations

The analysis is consistent with site-specific comparisons against FCFS using the ACN data: at Caltech (25,981 sessions), cost reductions ranged from ∼10 to 14% in early months to larger gains in periods with pronounced price spikes; at JPL (22,185 sessions), savings ranged from ∼6.2% to ∼19.2%. A marked decline in charging activity after 1 November 2018 at Caltech corresponds to a tariff change (introduction of a 0.12 USD/kWh fee), which reduces demand and lowers absolute costs for all methods while preserving the LP’s relative advantage.

5.6. Sensitivity Analysis on the Robustness Parameter Γ

The budget of uncertainty, Γ , is a critical parameter that allows the decision maker to control the trade-off between the nominal cost and the level of protection against price volatility. A value of Γ = 0 corresponds to the nominal, non-robust optimization, where price uncertainty is ignored. As Γ increases, the solution becomes more conservative, protecting against worst-case price deviations across a larger number of time periods.
To analyze this trade-off, we performed a lightweight sensitivity analysis on a representative one-week period from the Caltech dataset, which includes 215 charging sessions. We ran our optimization model with three distinct values for Γ : 0 (nominal), 15 (moderate), and 30 (conservative). The results, summarized in Table 2, illustrate the “price of robustness.”
As shown in Table 2, increasing Γ from 0 to 30 leads to a modest 4.64% increase in the planned nominal cost. This increase represents the premium paid to safeguard against uncertainty. In return, the worst-case cost—the maximum potential cost under the most adverse price fluctuations allowed by the uncertainty set—is significantly reduced by approximately 14%. This demonstrates the effectiveness of the robust optimization framework: for a small, predictable increase in the base operational cost, the model provides substantial protection against unforeseen price spikes, thereby reducing financial risk for the charging station operator.

5.7. Computational Performance

For the proposed online scheduling framework to be practical, the optimization problem must be solvable within a reasonable timeframe. We evaluated the computational performance of our MPC algorithm (Algorithm 1) on a standard laptop (Intel Core i7, 16 GB RAM) using Python 3.12.2 with the Gurobi solver. The primary factor influencing the solving time is the number of active EVs ( | V k | ) at the station. Table 3 reports the average time required to solve the optimization problem for varying the numbers of concurrent EVs.
The results indicate that the model is computationally efficient. Even under peak load conditions with 50 concurrent EVs, the optimization problem is solved in under 5 s. This runtime is well within the practical limits for an online system where re-optimization may be triggered every 5–15 min or upon a new event. The performance demonstrates that the proposed framework is not only theoretically sound but also computationally feasible for real-world deployment.

6. Limitations and Future Work

While the proposed robust optimization framework demonstrates significant cost savings and computational efficiency, several limitations present opportunities for future research:
(1)
Modeling of uncertainty: The current model robustly handles uncertainty in electricity prices but treats other key variables as deterministic. A primary area for extension is to incorporate uncertainty in solar (PV) generation forecasts and EV behavior, such as unexpected early departures or changes in energy demand. Methodologies like stochastic programming or more advanced distributionally robust optimization (DRO) could be employed to create a more comprehensive model that accounts for these multiple sources of uncertainty.
(2)
Scope of objectives: The optimization objective is focused solely on minimizing the direct operational electricity cost. Future work could explore a multi-objective framework that balances cost with other important goals. These could include minimizing battery degradation for EVs, maximizing user satisfaction, or providing ancillary services to the grid.
(3)
System boundaries: The model optimizes the operation of a single charging station. An important research direction is to extend this framework to a network of charging stations, considering grid-level constraints and coordinated charging strategies.
(4)
Comparison with advanced learning methods: While the LP model outperformed the DQN baseline, future research could involve benchmarking against more sophisticated deep reinforcement learning (DRL) agents using continuous action spaces (e.g., soft actor–critic, SAC).

7. Conclusions

This paper presents a robust optimization framework for scheduling EV charging at stations with on-site solar generation, specifically designed to mitigate financial risks from electricity price volatility. By leveraging the Bertsimas–Sim reformulation, we developed a tractable linear programming model solved within a model predictive control loop, enabling practical, online implementation.
Our simulation results, based on real-world data, confirm the effectiveness of our approach. The proposed controller consistently outperforms common industry practices and learning-based alternatives, achieving average total cost reductions of 17.5% compared to a PV-aware Greedy heuristic and 12.2% compared to a DRL agent. Our method also demonstrates superior performance in reducing cost volatility.
Furthermore, the framework’s practicality is validated through sensitivity and computational analyses. The model offers a flexible trade-off between cost and risk protection and is computationally efficient enough for real-time deployment, solving complex problems in under five seconds. In summary, this work delivers a tractable, economically advantageous, and risk-aware solution for managing modern EV charging infrastructure.

Author Contributions

Conceptualization, A.N. and C.D.; methodology, A.N.; software, H.P.; validation, A.N., H.P. and C.D.; formal analysis, A.N.; investigation, H.P.; resources, C.D.; data curation, H.P.; writing—original draft preparation, A.N. and H.P.; writing—review and editing, C.D.; visualization, A.N.; supervision, C.D.; project administration, C.D. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The data used in this study are publicly available. ACN-Data can be found at https://ev.caltech.edu/dataset (accessed on 18 March 2025), European electricity price data at https://ember-energy.org/data/european-wholesale-electricity-price-data/ (accessed on 18 March 2025), and solar irradiance data at https://joint-research-centre.ec.europa.eu/photovoltaic-geographical-information-system-pvgis/pvgis-tools/hourly-radiation_en (accessed on 18 March 2025).

Acknowledgments

The authors would like to acknowledge the providers of the open source datasets used in this research.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A. Greedy PV-First Heuristic

Appendix A.1. Description

The Greedy PV-first algorithm serves as a simple, non-price-aware baseline. Its policy is to maximize the use of available solar (PV) energy at every time step. Specifically, it allocates available PV power as evenly as possible among all connected EVs. If the PV supply is insufficient to meet their charging needs, it then draws power from the grid to fill the remaining demand, up to the station’s grid capacity limit ( C grid ). This allocation strategy is myopic and completely ignores electricity price signals.

Appendix A.2. Rationale

This heuristic is included because it represents a common “renewables-first” policy that is intuitive and easy to implement in practice. It provides a useful lower bound for evaluating the economic benefits of more sophisticated, price-aware optimization strategies.

Appendix A.3. Key Characteristics

  • Advantages: Fully utilizes on-site renewable generation and is computationally trivial, requiring no optimization solver.
  • Limitations: Its obliviousness to electricity prices can lead to high operational costs, especially if grid power is consumed during peak price periods. It also does not account for fairness or differing urgency among EVs (e.g., imminent departure times).
Algorithm A1 Greedy PV-first heuristic
1:
Input: Time slots k = 0 , 1 , 2 , , station capacity C grid , charging efficiency η , slot duration Δ t
2:
for k = 0 , 1 , 2 , do
3:
    Update set of active EVs V k = { i EV i is present and requires charging }
4:
    Initialize available power: P P V R ¯ k , P g r i d C grid
4:
                    ▹Phase 1: Allocate available PV power
5:
    for each EV i V k  do
6:
        Calculate power needed: P n e e d , i min ( s i max , remDemand i / ( η Δ t ) )
7:
        Allocate shared PV: Y i , P V min ( P n e e d , i , P P V / | V k | )
8:
         Y i ( k ) Y i , P V
9:
    end for
10:
    Update remaining PV: P P V P P V i V k Y i ( k )
10:
               ▹Phase 2: Fill remaining demand with grid power
11:
    for each EV i V k  do
12:
        Calculate remaining need: P r e m _ n e e d , i P n e e d , i Y i ( k )
13:
        if  P r e m _ n e e d , i > 0 and P g r i d > 0  then
14:
           Allocate grid power: Y i , g r i d min ( P r e m _ n e e d , i , P g r i d )
15:
            Y i ( k ) Y i ( k ) + Y i , g r i d
16:
           Update remaining grid capacity: P g r i d P g r i d Y i , g r i d
17:
        end if
18:
    end for
18:
                       ▹Phase 3: Update system state
19:
    for each EV i V k  do
20:
         remDemand i max ( 0 , remDemand i η · Y i ( k ) · Δ t )
21:
    end for
22:
     R k i V k Y i ( k ) max ( 0 , i V k Y i ( k ) C grid )        ▹ Total PV used
23:
     S k + max ( 0 , i V k Y i ( k ) R k )           ▹ Total grid power drawn
24:
end for

Appendix B. Deep Reinforcement Learning (DQN) Baseline

Appendix B.1. Description

This baseline uses a deep Q-network (DQN) agent to learn a charging policy. At each time step, the agent makes a binary (on/off) decision for each EV regarding whether it should receive power from the grid. Similarly to the Greedy heuristic, available PV energy is always prioritized and allocated first. The DQN’s goal is to learn a sequence of actions that minimizes total electricity costs while ensuring that all EVs are fully charged by their departure times.

Appendix B.2. Markov Decision Process (MDP) Formulation

  • State ( s k ): A vector representing the system at time k, including the current electricity price ( p k ), available PV generation ( R ¯ k ), total grid capacity ( C grid ), and features for each active EV (e.g., remaining energy demand, connector power limit, time until departure).
  • Action ( a k ): A vector of binary decisions z i { 0 , 1 } for each EV i, where 1 indicates enabling grid charging and 0 indicates disabling it.
  • Reward ( r k ): The reward is the negative electricity cost incurred in a time step: r k = p k S k + Δ t . A large negative penalty is applied if an EV departs with unmet energy demand, encouraging the agent to prioritize service completion.

Appendix B.3. Training and Deployment

The DQN agent is trained offline using historical data (Algorithm A2). During deployment (Algorithm A3), the trained network selects the optimal action at each step based on the current state.
Algorithm A2 DQN training for EV charging
1:
Initialize replay memory D , Q-network Q θ , and target network Q θ ¯ with θ ¯ θ
2:
for each episode do
3:
    Reset the environment (load new arrivals, prices, PV profiles)
4:
    for each time step k do
5:
        Observe state s k
6:
        Select action a k using an ϵ -Greedy policy based on Q θ ( s k , a )
7:
        Execute action a k : allocate PV first, then allocate grid power based on binary decisions
8:
        Observe reward r k and next state s k + 1
9:
        Store transition ( s k , a k , r k , s k + 1 ) in D
10:
        Sample a random minibatch of transitions from D
11:
        Perform a gradient descent step on ( y j Q θ ( s j , a j ) ) 2 to update θ
12:
        Periodically update the target network: θ ¯ θ
13:
    end for
14:
end for
Algorithm A3 DQN deployment (inference)
1:
Load trained Q-network parameters θ
2:
for each time step k do
3:
    Observe current state s k
4:
    Choose action a k = arg max a Q θ ( s k , a )
5:
    Apply charging rates based on a k and update system state
6:
end for

Appendix B.4. Hyperparameters and Training Setup

The hyperparameters used for training the DQN agent are listed below.
Training Episodes: 5
Discount Factor (gamma): 0.98
Learning Rate:  1e-3
Batch Size: 128
Replay Buffer Size: 50,000
Epsilon Start: 0.2
Epsilon End: 0.05
Epsilon Decay Steps: 2000
NN Hidden Dimensions: 64
Unmet Demand Penalty: 1e6

Appendix B.5. Ablation Study: Training Budget vs. Performance

We analyzed the impact of the training budget (number of episodes) on the DQN agent’s performance. The results are summarized in Table A1.
Table A1. Effect of the training budget on DQN performance. “Savings” are calculated relative to the Greedy PV-first baseline cost. “Deficit” refers to the total unmet energy demand at departure across all sessions.
Table A1. Effect of the training budget on DQN performance. “Savings” are calculated relative to the Greedy PV-first baseline cost. “Deficit” refers to the total unmet energy demand at departure across all sessions.
EpisodesRuntimeDRL Cost (EUR)Savings (%)Deficit (kWh)
200:00:22327613.23%2866.06
500:00:3735964.75%894.81
1000:01:0036423.54%686.62
1500:01:5037530.59%97.87
2000:02:3037670.22%2.09

Interpretation

The results show a clear trade-off between cost optimization and service quality (i.e., minimizing the energy deficit). With very few training episodes, the agent learns a cost-saving policy but fails to reliably charge all vehicles. As the number of episodes increases, the large penalty for unmet demand forces the agent to prioritize service completion, significantly reducing the energy deficit to near zero. However, this comes at the cost of less aggressive price-aware scheduling, causing its economic performance to converge towards that of the simpler Greedy PV-first baseline. This suggests that achieving a better balance may require tuning the penalty term or adopting a constrained reinforcement learning formulation.

References

  1. Vietnam Government. Vietnam’s Commitment to Achieve Net-Zero by 2050. 2021. Available online: https://en.baochinhphu.vn/vietnam-commits-to-achieve-net-zero-emissions-by-2050-111211101190824684.htm (accessed on 17 September 2025).
  2. Ministry of Transport. Transport Sector Emissions and Projections. 2022. Available online: https://www.mt.gov.vn/ (accessed on 17 September 2025).
  3. International Energy Agency. Global EV Outlook 2023. 2023. Available online: https://www.iea.org/reports/global-ev-outlook-2023 (accessed on 17 September 2025).
  4. VinFast. VinFast Launches First EV Models. 2021. Available online: https://vinfastauto.com/vn_en/newsroom/press-release (accessed on 17 September 2025).
  5. VNExpress. VinFast Sells 51,000 EVs by 2024. 2024. Available online: https://e.vnexpress.net/news/business/vinfast-sells-51000-evs-by-2024-4728339.html (accessed on 17 September 2025).
  6. Vietnam Investment Review. Vietnam Faces Shortage of EV Charging Stations. 2024. Available online: https://vir.com.vn/vietnam-faces-shortage-of-ev-charging-stations-110097.html (accessed on 17 September 2025).
  7. RMIT. The Future Is Bright for Electric Vehicles Despite Challenges. 2024. Available online: https://www.rmit.edu.vn/news/all-news/2024/nov/the-future-is-bright-for-electric-vehicles-despite-challenges (accessed on 17 September 2025).
  8. Wang, B.; Dehghanian, P.; Zhao, D. Coordinated Planning of Electric Vehicle Charging Infrastructure and Renewables in Power Grids. IEEE Open Access J. Power Energy 2023, 10, 233–244. [Google Scholar] [CrossRef]
  9. Hermans, B.A.L.M.; Walker, S.; Ludlage, J.H.A.; Özkan, L. Model predictive control of vehicle charging stations in grid-connected microgrids: An implementation study. Appl. Energy 2024, 368, 123210. [Google Scholar] [CrossRef]
  10. Liu, X.; Li, Z.; Yang, X.; Li, Z.; Wei, Z.; Wang, P. Two-stage robust economic dispatch of distribution systems with electric vehicle aggregators. Electr. Power Syst. Res. 2025, 248, 111850. [Google Scholar] [CrossRef]
  11. Chemudupaty, R.; Bahmani, R.; Fridgen, G.; Marxen, H.; Pavić, I. Uncertain electric vehicle charging flexibility, its value on spot markets, and the impact of user behaviour. Appl. Energy 2025, 394, 126063. [Google Scholar] [CrossRef]
  12. Yao, M.; Li, C.; Li, C.; Li, H. A Review of Capacity Allocation and Control Strategies for Electric Vehicle Charging Stations with Integrated Photovoltaic and Energy Storage Systems. World Electr. Veh. J. 2024, 15, 101. [Google Scholar] [CrossRef]
  13. Qian, K.; Fachrizal, R.; Munkhammar, J.; Ebel, S.; Adam, A. Large-scale EV charging scheduling considering on-site PV generation by combining an aggregated model and sorting-based methods. Sustain. Cities Soc. 2024, 107, 105453. [Google Scholar] [CrossRef]
  14. An, S.; Qiu, J.; Lin, J.; Yao, Z.; Liang, Q.; Lu, X. Planning of a multi-agent mobile robot-based adaptive charging network for enhancing power system resilience under extreme conditions. Appl. Energy 2025, 395, 126252. [Google Scholar] [CrossRef]
  15. Caltech. ACN-Data—A Public EV Charging Dataset. 2019. Available online: https://ev.caltech.edu/dataset (accessed on 17 September 2025).
  16. Ember. European Wholesale Electricity Price Data. 2024. Available online: https://ember-energy.org/data/european-wholesale-electricity-price-data/ (accessed on 17 September 2025).
  17. EU Science Hub. Hourly Radiation. 2016. Available online: https://joint-research-centre.ec.europa.eu/photovoltaic-geographical-information-system-pvgis/pvgis-tools/hourly-radiation_en (accessed on 17 September 2025).
  18. Bertsimas, D.; Sim, M. The Price of Robustness. Oper. Res. 2004, 52, 35–53. [Google Scholar] [CrossRef]
Figure 1. On-site solar-integrated charging station model.
Figure 1. On-site solar-integrated charging station model.
Energies 18 05416 g001
Figure 2. Monthly electricity costs for LP (ours), Greedy price-first, and DRL (DQN) from 2018 to 04 to 2019-12.
Figure 2. Monthly electricity costs for LP (ours), Greedy price-first, and DRL (DQN) from 2018 to 04 to 2019-12.
Energies 18 05416 g002
Figure 3. Weekly cost distribution for LP (ours), Greedy price-first, and DRL (DQN) from 2018-04 to 2019-12.
Figure 3. Weekly cost distribution for LP (ours), Greedy price-first, and DRL (DQN) from 2018-04 to 2019-12.
Energies 18 05416 g003
Figure 4. Comparing total power allocation based on price fluctuation.
Figure 4. Comparing total power allocation based on price fluctuation.
Energies 18 05416 g004
Table 1. Constant values used in the simulation.
Table 1. Constant values used in the simulation.
ParameterValue
C grid 300 kW
η 0.9
η pv 0.2
A pv 80 m2
s i (Caltech)86 kW
s i (JPL)37.5 kW
Table 2. Sensitivity analysis of total cost for a representative week with varying Γ .
Table 2. Sensitivity analysis of total cost for a representative week with varying Γ .
Γ Robustness LevelNominal Cost (EUR)Worst-Case Cost (EUR)Cost Increase (%)
0None (Nominal)550.25685.500%
15Moderate561.50610.752.04%
30Conservative575.80589.104.64%
Table 3. Average solve time per optimization instance.
Table 3. Average solve time per optimization instance.
Number of EVsAverage Solve Time (Seconds)
100.52
251.85
50 (peak load)4.73
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

Nguyen, A.; Pham, H.; Do, C. A Cost-Optimization Model for EV Charging Stations Utilizing Solar Energy and Variable Pricing. Energies 2025, 18, 5416. https://doi.org/10.3390/en18205416

AMA Style

Nguyen A, Pham H, Do C. A Cost-Optimization Model for EV Charging Stations Utilizing Solar Energy and Variable Pricing. Energies. 2025; 18(20):5416. https://doi.org/10.3390/en18205416

Chicago/Turabian Style

Nguyen, An, Hung Pham, and Cuong Do. 2025. "A Cost-Optimization Model for EV Charging Stations Utilizing Solar Energy and Variable Pricing" Energies 18, no. 20: 5416. https://doi.org/10.3390/en18205416

APA Style

Nguyen, A., Pham, H., & Do, C. (2025). A Cost-Optimization Model for EV Charging Stations Utilizing Solar Energy and Variable Pricing. Energies, 18(20), 5416. https://doi.org/10.3390/en18205416

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