EV Charging Optimizer
TheEVChargingScheduler determines the optimal charging power for each vehicle at each time slot, minimizing total energy cost while respecting site capacity, charger limits, vehicle availability, and priority ordering.
How It Works
The optimizer uses a greedy LP-relaxation approach:- Availability matrix — For each session × time slot, determine if the vehicle is present
- Effective cost — Combine energy price and carbon intensity with configurable weights
- Priority ordering — Process urgent vehicles first, then by earliest departure
- Slot filling — For each vehicle, fill cheapest available slots until energy need is met
- Capacity tracking — Deduct allocated power from remaining site headroom
Configuration
Charging Sessions
Each EV is described by aChargingSession:
Priority Levels
| Priority | Description | Scheduling Behavior |
|---|---|---|
| 1 | Normal | Scheduled after higher priorities, cost-optimized |
| 2 | High | Preferred slot allocation over normal priority |
| 3 | Urgent | First access to cheapest available slots |
Tariff Integration
The scheduler natively consumes Qubit tariff schemas:- Time-of-use windows —
start_time/end_timein HH:MM format - Weekday filtering —
weekdaysarray (e.g.,["monday", "tuesday"]) - Monthly filtering —
monthsarray (e.g.,[6, 7, 8]for summer) - Carbon intensity —
carbon_intensity_gco2_kwhper rate period
Running an Optimization
Result Structure
TheOptimizationResult contains:
Schedule Columns
| Column | Description |
|---|---|
ev_{vehicle_id}_kw | Charging power allocated to each vehicle per slot |
total_ev_kw | Sum of all EV charging power per slot |
background_load_kw | Site background load (from forecast) |
solar_generation_kw | Solar generation (from forecast) |
net_load_kw | Total net load: background + EV - solar |
price_per_kwh | Energy price at each slot |
slot_cost | Cost for each time slot |
Constraint Enforcement
The scheduler enforces several hard constraints:Site Capacity
Site Capacity
Total EV charging power plus background load minus solar never exceeds the site transformer rating. The optimizer tracks remaining headroom at each slot and caps allocation accordingly.
Charger Capacity
Charger Capacity
Each vehicle’s charge rate is capped at the minimum of its onboard charger limit and the EVSE port capacity (
charger_capacity_kw).Vehicle Availability
Vehicle Availability
Charging only occurs during the arrival-to-departure window. No power is allocated outside these bounds.
Energy Delivery
Energy Delivery
The optimizer attempts to deliver the full
energy_needed_kwh for each session. If constraints prevent this (e.g., too many vehicles competing for limited capacity), the result status changes from “optimal” to “feasible”.Carbon-Aware Scheduling
Enable carbon-conscious scheduling by adjusting objective weights:0.5 * price + 0.5 * carbon_intensity, shifting charging toward lower-carbon periods.