Analyzes peak demand hours and peak pricing hours across all PJM zones, identifies overlap patterns, and provides a 7-day forecast.
- Historical Analysis: Identifies top 5 peak load hours and top 5 peak price hours per month for each PJM zone
- Overlap Analysis: Quantifies how often peak load and peak price hours coincide
- 7-Day Forecast: Predicts likely peak hours based on historical patterns and PJM load forecasts
- Reporting: Generates daily markdown reports
- Dashboard: Interactive visualization with Dash/Plotly
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt# Copy example env file
cp .env.example .env
# Edit .env and add your PJM subscription key
# Get your key from: https://dataminer2.pjm.com/# Full daily pipeline
python main.py
# Options:
python main.py --fetch-only # Only fetch new data
python main.py --report-only # Generate report from cached data
python main.py --zone PECO # Run for specific zone only
python main.py --mock # Use mock data (no API key required)# Streamlit (recommended)
streamlit run dashboard/streamlit_app.py
# Open http://localhost:8501 in your browser
# Or Dash
python dashboard/app.py
# Open http://localhost:8050 in your browserpjm-peak-analysis/
├── config/
│ └── settings.py # Configuration and zone mappings
├── data/
│ ├── api_client.py # PJM Data Miner API wrapper
│ └── mock_data.py # Mock data generator for testing
├── analysis/
│ └── peaks.py # Peak identification and overlap analysis
├── forecast/
│ └── price_predictor.py # Historical pattern-based price forecasting
├── dashboard/
│ ├── streamlit_app.py # Streamlit interactive dashboard
│ └── app.py # Dash interactive dashboard
├── outputs/
│ ├── reports/ # Generated markdown reports
│ ├── charts/ # Generated visualizations
│ └── data/ # CSV/Parquet data exports
├── main.py # Main execution script
├── requirements.txt
└── PROJECT_SPEC.md # Detailed specification document
| Feed | Purpose |
|---|---|
hrl_load_metered |
Hourly metered load by zone |
rt_hrl_lmps |
Real-time hourly LMPs |
da_hrl_lmps |
Day-ahead hourly LMPs |
load_frcstd_7_day |
7-day load forecast |
- Ranks all hours in each month by load (MW) and price ($/MWh)
- Selects top 5 hours for each metric per zone
- Exact overlap: Hours appearing in both top-5 lists
- Near overlap: Peak hours within ±1 hour of each other
- Hourly correlation: Pearson correlation between load and price
- Matches current conditions to similar historical hours
- Weights by recency and load similarity
- Provides confidence intervals based on historical variance
All 19 PJM transmission zones plus RTO aggregate:
| Zone | Utility |
|---|---|
| AEP | American Electric Power |
| APS | Allegheny Power |
| ATSI | FirstEnergy Ohio |
| BGE | Baltimore Gas & Electric |
| COMED | Commonwealth Edison |
| DAY | Dayton Power & Light |
| DEOK | Duke Energy Ohio/Kentucky |
| DOM | Dominion Virginia |
| DPL | Delmarva Power |
| DUQ | Duquesne Light |
| EKPC | East Kentucky Power Coop |
| JCPL | Jersey Central P&L |
| METED | Met-Ed |
| PECO | PECO Energy |
| PENELEC | Penelec |
| PEPCO | Potomac Electric Power |
| PPL | PPL Electric |
| PSEG | Public Service E&G |
| RECO | Rockland Electric |
- PJM Members: 600 requests/minute
- Non-members: 6 requests/minute
The API client includes automatic rate limiting.
Internal use only. Data usage subject to PJM Data Miner terms of service.