Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PJM Peak Analysis Tool

Analyzes peak demand hours and peak pricing hours across all PJM zones, identifies overlap patterns, and provides a 7-day forecast.

Features

  • 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

Quick Start

1. Setup Environment

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

2. Configure API Credentials

# Copy example env file
cp .env.example .env

# Edit .env and add your PJM subscription key
# Get your key from: https://dataminer2.pjm.com/

3. Run the Analysis

# 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)

4. Launch Dashboard

# 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 browser

Project Structure

pjm-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

Data Feeds Used

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

Analysis Methodology

Peak Identification

  • Ranks all hours in each month by load (MW) and price ($/MWh)
  • Selects top 5 hours for each metric per zone

Overlap Metrics

  • 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

Forecast Model

  • Matches current conditions to similar historical hours
  • Weights by recency and load similarity
  • Provides confidence intervals based on historical variance

Zones Covered

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

API Rate Limits

  • PJM Members: 600 requests/minute
  • Non-members: 6 requests/minute

The API client includes automatic rate limiting.

License

Internal use only. Data usage subject to PJM Data Miner terms of service.

Streamlit Cloud Deployment

About

PJM Peak Analysis Tool - Analyzes peak demand and pricing hours across PJM zones with forecasting and interactive dashboards

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages