Linear Programming Scheduler
liveMost EVs charge the instant you plug in — straight into the evening carbon peak. This widget pulls the live GB grid carbon-intensity forecast and runs a small linear program to shift your charge into the cleanest half-hours, so you wake up full on the greenest electrons of the night.
The optimisation problem
The scheduler is a small LP: given a carbon intensity forecast and a required energy delivery, find the power drawn in each half-hour period that minimises total carbon. No integer variables — the solver picks fractional kW freely, and the greedy structure of the problem means the optimal always concentrates charge in the lowest-carbon windows first.
Formulation
Parameters
| ct | Carbon intensity forecast for period t (gCO₂/kWh) — live from the GB grid API |
| xt | Decision variable: power drawn in period t (kW) |
| Δt | Period length — 0.5 h (30-minute settlement periods) |
| Ereq | Energy required by departure (kWh) |
| Pmax | Charger power limit (kW) — 7 kW home / 11 kW fast / 22 kW three-phase |
Why a faster charger isn't penalised
You might expect a 22 kW charger to throttle itself and spread the load. For a deterministic carbon objective it shouldn't. The optimum is always to fill the cleanest half-hours at full power, so a faster charger can pack the whole session into the few lowest-carbon slots. In a clean window a 22 kW charge can average a lower gCO₂/kWh than a 7 kW one, because the slower charger is forced to use more slots and picks up dirtier ones. The solver isn't charging early out of greed. It has already ranked every slot up to your departure and confirmed nothing cleaner exists.
The honest caveat is that this version optimises against the P50 median forecast only. Committing all the energy to a single half-hour is a bet on that one estimate. The P10/P90 bands drawn above are not yet used by the solver. Making the schedule uncertainty-aware, so it hedges across slots when the forecast is wide, is the next iteration I want to build.