This repository focuses on predicting grid congestion events and electricity price spikes in European wholesale markets, with a specific emphasis on the Netherlands (TenneT) bidding zone. It builds upon the cross‑market correlation and negative price detection frameworks developed in the BESS_Flexibility_ML project, extending them to congestion forecasting and structural break identification.
- Cross‑Market Correlation Analysis: Quantifies price decoupling (NL‑ES r = 0.702) to identify arbitrage windows.
- Negative Price Regime Classification: Detects extreme negative price episodes (‑500 EUR/MWh).
- Structural Break Detection: Identifies regime shifts (2022 energy crisis, 2025 grid incidents).
- Feature Attribution (SHAP): Explains drivers of price spikes and congestion patterns.
| Attribute | Netherlands (NL) | Spain (ES) | Portugal (PT) |
|---|---|---|---|
| Count | 70,104 | 70,104 | 70,104 |
| Mean Price (EUR/MWh) | 91.39 | 79.32 | 79.79 |
| Std Dev | 87.33 | 60.58 | 60.42 |
| Min Price | ‑500.00 | ‑15.00 | ‑5.00 |
| Max Price | 872.96 | 700.00 | 651.00 |
| Negative Hours | 1,560 (2.23%) | — | — |
Correlation Matrix:
| Price_NL | Price_ES | Price_PT | |
|---|---|---|---|
| Price_NL | 1.000 | 0.702 | 0.701 |
| Price_ES | 0.702 | 1.000 | 0.995 |
| Price_PT | 0.701 | 0.995 | 1.000 |
Grid_Congestion_ML/
├── data/ # Sample data for congestion analysis
├── notebooks/
│ ├── 01_correlation_analysis.ipynb # Cross-market correlation
│ ├── 02_regime_detection.ipynb # Negative price detection
│ └── 03_spike_forecasting.ipynb # Price spike prediction with SHAP
├── src/
│ ├── data_loader.py # ENTSO-E data ingestion
│ └── correlation.py # Correlation & volatility metrics
└── README.md
git clone https://github.com/leo-energy/Grid_Congestion_ML.git
cd Grid_Congestion_ML
pip install -r requirements.txtjupyter notebook notebooks/01_correlation_analysis.ipynbPrice Inertia: Lag1_NL explains ~95% of variance, enabling high‑frequency forecasting.
Negative Price Triggers: Nocturnal low‑demand windows combined with high renewable output.
Congestion Signals: Decoupling between NL and ES (r=0.702) indicates opportunities for cross‑border flexibility.
Integrate with Gaussian Process Regression for uncertainty‑aware congestion alerts.
Develop real‑time dashboard for TSO/DSO congestion management.
Incorporate weather forecast data to enhance predictive power.
BESS_Flexibility_ML – price forecasting and arbitrage optimization.
Paper 3 (doctoral) – extends this to full predictive BI system.
Author: Leonardo Xi
GitHub: github.com/leo-energy
LinkedIn: linkedin.com/in/leonardo-xi