Power Planner
Overview
The Power Planner forecasts a Lagos facility’s hourly electricity demand for the next seven days and builds a supply plan across grid, solar, battery and diesel generation. I built it for the Nigerian Society of Engineers Glasgow branch conference in August 2026, where the core of it was written on stage from a plain-English brief in about twenty minutes.
The context: Nigeria’s grid collapsed to 0 MW twice in five days in January 2026, and delivers roughly 4–5 GW against about 30 GW of need.
What it does
- Ingests an hourly meter record (timestamp, demand, optional temperature), validating and gap-filling in the browser.
- Forecasts seven days of hourly demand with a ridge-regression model trained on the loaded record, evaluated on a time-ordered seven-day holdout against a seasonal-naive baseline.
- Plans supply across grid, solar, battery and diesel with a deterministic rule engine producing auditable hourly energy flows.
- Runs current, diesel-price-shock and grid-availability scenarios against the same forecast, so supply assumptions cannot rewrite demand.
- Optionally uses Claude to interpret a facility description into bounded assumptions and to explain an already-computed result.
How it is built
- The planner is a rule engine, presented as one rather than as a mathematical optimiser.
- Claude never receives the uploaded meter data and does not compute the forecast or the plan. The API key is read only by server-side route handlers.
- Parsing, validation, modelling and planning all run locally in the browser, so the tool works with no API key and no internet — which is what made it safe to build live on stage.
- The demonstration data is synthetic; every tariff, price, capacity and availability value is an editable illustrative assumption.
- A read-only
/diagnosticsroute exposes an engine audit, so the numbers on screen can be traced.
Technologies Used:
- Next.js
- TypeScript
- Ridge Regression
- Claude API
- Vitest