Inspiration

As technology evolves, it changes how we both use and generate electricity. Inspired by a recent Tom Scott video, we explored how forecasting and optimisation could reduce the manual workload involved in managing the grid alongside controlling legacy IT systems, and help operators respond when supply and demand stop lining up.

Something that stood out to us was that having enough electricity does not always mean we can get it to the right place. Wind farms in Scotland can generate power needed further south, but the connections carrying it there have limits. This led us to the B6 transmission boundary between Scotland and England, and a scenario we wanted to explore: what happens if that connection is lost on a windy winter evening?

For us, the “New Worlds” theme meant exploring scenarios that did not happen in the recorded data. We could take a real day, introduce a failure, and investigate how different decisions would change the outcome. That became JMap: a way to forecast demand, stress-test a model of Britain’s grid, and compare its responses to situations we hope never happen.

Britain's grid is entering a new world. Coal is gone: the last coal plant, Ratcliffe-on-Soar, closed in 2024. Wind and solar now do the heavy lifting, but they're driven solely by weather and often far from where people live, with much of the wind in Scotland and most of the demand in the south. Demand is rising again as heat pumps, electric vehicles and data centres come onto the grid. And since the 2022 gas crisis, energy security has become a geopolitical question, not just an engineering one.

What it does

JMap forecasts electricity demand across ten regions of Great Britain for the next 24 hours, in half-hour intervals. Each forecast includes a central estimate and an uncertainty range, helping us identify where the network may come under strain.

We can then introduce incidents into the simulation, including transmission failures, power station outages and regions becoming disconnected from the rest of the network. The optimisation engine responds by adjusting generation, using battery storage and reducing demand through demand response. It plans these actions around the capacity available and the limits of the surviving connections. The dashboard runs the same incident side by side with two approaches: a baseline that dispatches power without accounting for transmission limits, and our optimiser.

Users can compare unmet demand, line overloads and simulated costs as the incident unfolds. The map also brings together generating sites from official DESNZ registers, live interconnector flows from Elexon, and local-authority energy statistics, giving the simulations a connection to real places and infrastructure.

How we built it

There were four of us and 24 hours, so we started by agreeing on the data format each component would use. We fixed the regions, connections, units and input shapes, then shared example responses. This allowed us to work on the forecasting, simulator, optimiser and dashboard in parallel.

Building the real dataset took most of the night, so we wrote a synthetic data generator using the same schema. It gave us a shared dataset to build and test against while the real inputs were being collected and checked. Once the real table passed validation, we reran every component and evaluation using it. All performance results reported here come from those real-data runs, with the outages and grid responses simulated.

The real dataset combines demand and generation data from NESO, the National Energy System Operator, and Elexon with archived day-ahead weather forecasts from the Open-Meteo Previous Runs API. It covers 7 March 2024 to 31 December 2025, with 319,200 half-hourly records across the ten zones. Regional demand is estimated by splitting the national total across those zones.

Our forecaster combines persistence for the first hour with LightGBM models for later horizons. It uses recent demand, daily and weekly patterns, calendar information and weather forecasts to predict demand and its uncertainty. The simulator uses DC power flow across ten zones and 14 transmission corridors, with eight generation types and battery storage.

Our optimiser solves a linear programme using SciPy and HiGHS, planning over the next four hours. It executes the first step, then replans as conditions change. Each decision takes around 13 milliseconds. We built the backend in Python and connected it to the JavaScript dashboard through FastAPI.

Challenges we ran into

One of the main challenges was preventing data leakage. Our first weather source stitched together the first few hours of forecast runs, making it too close to the actual conditions for a day-ahead forecasting task. We replaced it with archived day-ahead forecasts from the Previous Runs API. We also caught a 30-minute shift in the demand timestamps that could have made the model appear more accurate than it was.

The physics became harder once we started disconnecting the network. Our first solver produced unrealistic flows when the grid split into separate islands. We changed it so each island had to balance its own supply and demand, ensuring the simulation could not rely on power arriving through a connection that no longer existed.

We originally planned to use reinforcement learning agents to respond to incidents. We trained PPO agents, then tried having them make adjustments on top of the optimiser. In 20 paired tests, that approach failed to beat the optimiser and increased unmet demand. We removed the RL controller from the final system and kept the optimisation engine. The forecasts still use machine learning, but the response is chosen through constrained optimisation.

The synthetic data helped us get started, but it also hid problems. Our first generator produced demand without realistic persistence between successive readings. This made our check of how forecast accuracy changed at longer horizons uninformative until we fixed the generator. It also showed us why passing tests on synthetic data was only the first stage.

When we moved to real data, we found another issue: the optimiser treated demand response and curtailment as free, while the simulator charged for them. In one scenario, this made its decisions more expensive than the baseline. We aligned the costs in both components, which brought costs down while preserving the improvements in unmet demand and line overloads.

What we're proud of

Our main demonstration uses real demand and weather inputs from 14 December 2025, with a simulated full outage across B6 at 17:00. Compared with our baseline, the optimiser reduced unserved demand from 63,917 MWh to zero, with no line overloads. Simulated operating cost fell from £388.5 million to £17.4 million, a reduction of around 96%. Seeing the same incident play out differently on the dashboard brought together the work each of us had been doing.

The forecasting results also held up on real data. On the held-out test set from July to December 2025, national demand error was 4.15%, compared with 7.37% for persistence. We checked performance across three walk-forward retrains, and our calibrated uncertainty bands covered 78.7% of outcomes against an 80% target.

We also tested situations where there was no perfect response. On a cold-day scenario with an additional 18% demand spike, the available capacity could not meet all demand. The optimiser reduced unserved demand by 71%, but it could not eliminate the shortage.

Showing those limits mattered to us: we wanted to understand when the system helped and where the problem remained. We're proud of getting the full pipeline working within the time available, including the move from synthetic to real data. We also changed direction when the results called for it. Removing the RL controller was a difficult decision after spending time on it, but it left us with a system whose behaviour we could explain and measure.

What's next

We want to connect the forecasting pipeline to a live NESO feed and support incident replay as new data becomes available. This would allow us to test the system across more conditions and see how its decisions hold up over time.

We also want the optimiser to account for the full range of forecast outcomes. It currently plans around the central estimate, so the next step is to test responses that remain useful when demand is higher or lower than expected.

Finally, we want to expand beyond ten zones and introduce AC power flow to capture effects our current model leaves out. JMap currently uses estimated regional demand and a simplified, lossless grid model, so its results support exploration within that model.

Our aim is to develop it into a more detailed tool for investigating possible failures and testing decisions before they are needed on a real network.

Built With

  • vscode
Share this project:

Updates

Submission history