Spanish Grid Scenario Forecasting
Stress-tested Spain's hourly demand forecasts under solar shortfalls, heatwaves, and nuclear outages.
Gradient boosting load forecasts for Spain with weather inputs averaged across Madrid, Barcelona, Valencia, Seville, and Bilbao, plus dispatch-aware what-if simulations.
Goal
Deliver an evidence-based view of how Spain’s hourly demand responds to weather shocks and supply outages, quantifying the energy deltas and operational actions required to maintain balance.
Workflow
- Consolidate the Kaggle European market dataset so load, generation, and weather are aligned on a single hourly index.
- Engineer temporal lags and seasonal features, then train a gradient boosting regressor with time-aware cross-validation.
- Simulate targeted scenarios (extended cloud cover, heatwave, nuclear outage) and apply a dispatch balancing step to measure the response needed from flexible fleets.
Key questions
- Which explanatory variables track most closely with realised demand?
- How large are the cumulative energy deviations under adverse weather conditions?
- What additional capacity must be mobilised when baseload nuclear generation is unavailable?
Data source
All features and targets are drawn from the Kaggle energy consumption, generation, prices, and weather dataset with feature engineering and dispatch logic implemented in the accompanying notebook. Weather variables are averaged across Madrid, Barcelona, Valencia, Seville, and Bilbao to provide a nationwide profile.
Question
How tightly do Spain's load, generation, and weather variables move together?
Pearson correlations computed on the aligned Spanish hourly dataset (2015‒2018). Weather inputs are averaged across Madrid, Barcelona, Valencia, Seville, and Bilbao. Darker greens denote stronger positive relationships.
Insight: Actual load mirrors the system forecast with ρ=1.00. Fossil Gas Generation is the leading supporting factor (ρ=0.55). Humidity moves opposite to demand (ρ=-0.25).
Question
What does persistent cloud cover do to hourly load expectations?
Solar generation is dialled down to 25% of baseline while wind speed receives a modest uplift, mimicking a stubborn low-pressure system settling over Spain during the 10–16 Sep 2018 analysis week.
Insight: Peak increase of 308 MW occurs 12 Sept 2018 22:00. Average shift across the week is +113 MW. Scenario MAE is 251 MW versus 221 MW for the baseline forecast. All Cloud vs Baseline sums to +16.4 GWh across the analysis window. Baseline forecast bias: -9 MW on average.
Question
How does an Iberian heatwave reshape demand and flexible generation?
Temperature rises by +7 deg C with drier air and higher lagged demand to reflect heavy cooling loads across the mid-September window. Solar production remains high but wind slackens.
Insight: Peak increase of 1,474 MW occurs 13 Sept 2018 12:00. Average shift across the week is +1,177 MW. Scenario MAE is 1,168 MW versus 221 MW for the baseline forecast. Heatwave vs Baseline sums to +170.7 GWh across the analysis window. Baseline forecast bias: -9 MW on average. Fossil Gas Generation climbs +600 MW on average.
Question
How does the system re-balance once nuclear generation is offline?
Post-processing redispatch reroutes supply after the nuclear outage, ramping flexible fleets within their historical capacity envelopes.
Insight: Dispatch injects an average of 12,820 MW from flexible sources. Residual gap peaks at 1,396 MW and stays above 1 MW for 8 hours. Fossil Gas Generation contributes +11,706 MW on average. Wind Generation (Onshore) shifts +8,748 MW.
Conclusions
Correlation analysis confirms that the system forecast and fossil gas output are the closest companions to realised demand, whereas humidity moves in the opposite direction. Under the prolonged cloud cover scenario the baseline forecast absorbs most of the impact, with cumulative deviations remaining below 0.5 GW on average.
The heatwave scenario generates a persistent uplift of roughly 0.3 GW, increasing reliance on gas-fired supply. When nuclear capacity is removed the dispatch model requires more than 11 GW of additional flexible output—mainly from gas turbines and reservoir hydro—to maintain balance. These experiments indicate where operating margins are tightest and which assets deliver the most effective response.