Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Grid_Congestion_ML

Machine Learning for Grid Congestion & Price Spike Prediction

Python Version License: MIT Market Focus


📖 Overview

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.


🌟 Key Features

  • 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.

📊 Data Description

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

📂 Repository Structure

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

🚀 Getting Started

Installation

git clone https://github.com/leo-energy/Grid_Congestion_ML.git
cd Grid_Congestion_ML
pip install -r requirements.txt

Run Analysis

jupyter notebook notebooks/01_correlation_analysis.ipynb

🔍 Key Insights

Price 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.

📈 Future Work

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.

📚 Related Work

BESS_Flexibility_ML – price forecasting and arbitrage optimization.

Paper 3 (doctoral) – extends this to full predictive BI system.

📄 License

MIT

📧 Contact

Author: Leonardo Xi

GitHub: github.com/leo-energy

LinkedIn: linkedin.com/in/leonardo-xi

Releases

Packages

Contributors