Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,93 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- stable-baselines3
|
| 4 |
+
- power-grid
|
| 5 |
+
- ppo
|
| 6 |
+
- lstm
|
| 7 |
+
- electricity
|
| 8 |
+
- reinforcement-learning
|
| 9 |
+
- forecasting
|
| 10 |
+
- tensorflow
|
| 11 |
+
- gym
|
| 12 |
+
license: mit
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# ⚡ Power Grid Optimization with LSTM + PPO
|
| 16 |
+
|
| 17 |
+
This repository showcases a hybrid deep learning + reinforcement learning system for power grid optimization in Lauderdale County, AL. The system forecasts demand using a weather-informed LSTM model and trains a PPO-based agent to maintain stability and minimize blackout risk under stress.
|
| 18 |
+
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
## 📈 Models
|
| 22 |
+
|
| 23 |
+
- **LSTM Demand Predictor**
|
| 24 |
+
A deep bidirectional LSTM with attention, trained on 4 years of TVA and weather data.
|
| 25 |
+
|
| 26 |
+
- **PPO Grid Policy**
|
| 27 |
+
Trained in a custom `PowerGridEnv` with generator output, transformer tap, and load shedding control.
|
| 28 |
+
|
| 29 |
+
---
|
| 30 |
+
|
| 31 |
+
## 🧠 Dataset Overview
|
| 32 |
+
|
| 33 |
+
- **Demand Data:**
|
| 34 |
+
Sourced from the U.S. EIA (TVA region, 2021–2024)
|
| 35 |
+
- Demand, Net Generation, Day-Ahead Forecasts, Interchange
|
| 36 |
+
|
| 37 |
+
- **Weather Data:**
|
| 38 |
+
Daily min/max temperatures + precipitation
|
| 39 |
+
- From 5 major TVA-region airports via NOAA
|
| 40 |
+
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
## 🧮 LSTM Model
|
| 44 |
+
|
| 45 |
+
- **Architecture:**
|
| 46 |
+
2-layer bidirectional LSTM + attention, followed by global pooling and dense layers.
|
| 47 |
+
|
| 48 |
+
- **Key Features:**
|
| 49 |
+
- Rolling temperature windows, demand lags
|
| 50 |
+
- Weekly mean demand, change rate
|
| 51 |
+
- Temp volatility, extreme flags
|
| 52 |
+
|
| 53 |
+
- **Metrics:**
|
| 54 |
+
| Metric | Value |
|
| 55 |
+
|---------------|--------------------|
|
| 56 |
+
| R² | 0.911 |
|
| 57 |
+
| RMSE | 19,565 MWh |
|
| 58 |
+
| Mean Error | 713 MWh (overbias) |
|
| 59 |
+
| Beats TVA Forecast | 70.08% of days |
|
| 60 |
+
|
| 61 |
+
---
|
| 62 |
+
|
| 63 |
+
## 🤖 PPO DRL Agent
|
| 64 |
+
|
| 65 |
+
- **Environment:**
|
| 66 |
+
PyPSA-based Lauderdale County grid
|
| 67 |
+
- 6 generators (Nuclear, Hydro, CCGT)
|
| 68 |
+
- Load centers with realistic demand shares
|
| 69 |
+
- Thermal constraints, ramp limits, marginal costs
|
| 70 |
+
|
| 71 |
+
- **Action Space:**
|
| 72 |
+
- Generator control
|
| 73 |
+
- Transformer tap shift
|
| 74 |
+
- Load shedding (up to 20%)
|
| 75 |
+
|
| 76 |
+
- **Reward Design:**
|
| 77 |
+
✅ Balance demand/supply, low thermal overload
|
| 78 |
+
❌ Penalize instability, overloads, excessive cost
|
| 79 |
+
|
| 80 |
+
- **Training:**
|
| 81 |
+
- Algorithm: PPO (SB3)
|
| 82 |
+
- Timesteps: 400,000
|
| 83 |
+
- VecNormalize, 5 eval episodes per 2048 steps
|
| 84 |
+
|
| 85 |
+
- **Metrics:**
|
| 86 |
+
| Metric | Value |
|
| 87 |
+
|--------------------|-----------|
|
| 88 |
+
| Mean Reward | ~1480 |
|
| 89 |
+
| Explained Variance | Up to 0.85 |
|
| 90 |
+
| Blackout Risk | < 5% |
|
| 91 |
+
| Load Shedding | < 3% avg |
|
| 92 |
+
|
| 93 |
+
---
|