Skip to content

irmatgit/pwrdemand_ai1

Repository files navigation

⚡ Germany Power Demand Analysis & Forecasting

A comprehensive web application for analyzing historical power demand in Germany and generating short-term forecasts using data from the ENTSOE Transparency Platform.

Features

📊 Historical Analysis

  • Time Series Visualization: Interactive plot of power demand over time
  • Daily Patterns: Average hourly load patterns with standard deviation bands
  • Weekly Patterns: Average load by day of week
  • Monthly Patterns: Seasonal variations throughout the year
  • Load Duration Curve: Statistical representation of load distribution
  • Heatmap: Hourly load patterns across days of the week
  • Yearly Comparison: Multi-year trend comparison

🔮 Forecasting

  • 7-Day Forecast: Short-term power demand prediction using Facebook Prophet
  • Confidence Intervals: Upper and lower bounds for forecast uncertainty
  • Model Evaluation: Performance metrics (MAE, RMSE, MAPE)
  • Component Analysis: Breakdown of trend, weekly, and daily seasonality
  • Interactive Visualization: Zoom, pan, and hover for detailed insights

📈 Statistics

  • Comprehensive statistical summary (mean, median, max, min, std dev)
  • Dataset information and metadata
  • Raw data viewer with download capability

Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Setup

  1. Install dependencies:
pip install -r requirements.txt
  1. Configure API Key (if different): The API key is already configured in config.py, but you can modify it if needed.

Running the Application

Start the Streamlit web application:

streamlit run app.py

The application will open in your default web browser (usually at http://localhost:8501).

Usage

  1. Select Data Period: Use the sidebar to choose the historical data period (30 days to 2 years)
  2. Set Forecast Horizon: Adjust the forecast horizon from 1 to 14 days
  3. Explore Tabs:
    • Historical Analysis: View various analytical plots and patterns
    • Forecast: Generate and view power demand predictions
    • Statistics: Review statistical summaries and download data
  4. Refresh Data: Click the refresh button to fetch the latest data

Project Structure

n3/
├── app.py                      # Main Streamlit application
├── config.py                   # Configuration and API key
├── data_fetcher.py            # ENTSOE API data retrieval module
├── analyzer.py                # Data analysis and visualization module
├── forecaster.py              # Forecasting module using Prophet
├── requirements.txt           # Python dependencies
├── power_demand_cache.pkl     # Data cache (created automatically)
└── README.md                  # This file

Technical Details

Data Source

  • ENTSOE Transparency Platform: European electricity transmission data
  • Resolution: Hourly data
  • Country: Germany (DE)
  • Data Type: Actual total load (power demand)

Forecasting Method

The application uses Facebook Prophet, a robust time series forecasting tool that handles:

  • Multiple seasonality (hourly, daily, weekly, yearly)
  • Trend changes
  • Holiday effects
  • Missing data

Prophet was chosen for its:

  • Strong performance with hourly data
  • Automatic handling of seasonality
  • Interpretable components
  • Robustness to missing data and outliers

Visualization

  • Plotly: Interactive JavaScript-based charts
  • Streamlit: Modern Python web framework for data applications

API Information

The application uses the ENTSOE Transparency Platform API to fetch power demand data. The API key is provided in config.py.

API Key: 4b504673-4206-4838-a82b-f423f011f3e0

For more information about ENTSOE: https://transparency.entsoe.eu/

Troubleshooting

Common Issues

  1. API Connection Error:

    • Check your internet connection
    • Verify the API key is valid
    • Ensure the ENTSOE service is available
  2. Import Errors:

    • Ensure all dependencies are installed: pip install -r requirements.txt
    • Check Python version (3.8+)
  3. Prophet Installation Issues (on macOS):

    # If Prophet fails to install, try:
    pip install pystan==2.19.1.1
    pip install prophet==1.1.5
  4. Data Cache Issues:

    • Delete power_demand_cache.pkl to clear the cache
    • The file will be recreated on next data fetch

Performance Notes

  • First Load: Initial data fetch may take 30-60 seconds
  • Caching: Data is cached locally to improve subsequent loads
  • Model Training: Forecast model training takes 10-20 seconds
  • Memory: Forecast model is cached in session for better performance

Future Enhancements

Potential improvements for future versions:

  • Multiple country support
  • Weather data integration
  • Advanced ML models (LSTM, XGBoost)
  • Real-time streaming data
  • Alert system for anomalies
  • Comparison with renewable generation
  • Export reports in PDF format

License

This project uses publicly available data from ENTSOE and open-source libraries.

Author

Created for power system analysis and forecasting demonstrations.


Enjoy analyzing Germany's power demand! ⚡📊

About

testing Claude to deploy app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors