# Hybrid Renewable Dispatch Simulator

**AIMPACT V17 — Renewable Energy AI/ML Lab**

## Learning objective
Solar, wind, load, battery and energy balance. Train an introductory Random Forest regression model and inspect error metrics, feature importance and predictions.

## Run
1. Install Python 3.10+ and create a virtual environment (`python -m venv .venv`).
2. Activate it (`.venv\Scripts\activate` on Windows, `source .venv/bin/activate` on macOS/Linux).
3. Run `pip install -r requirements.txt`.
4. Run `streamlit run app.py`.
5. Review the sample CSV, train the baseline, change input variables and inspect plots.

## Dataset and method
- `sample_data.csv` has 360 **synthetic** rows generated for teaching; it is not a real plant dataset.
- Inputs: hour, solar_kw, wind_kw, demand_kw.
- Target: `net_surplus_kw`.
- Model: RandomForestRegressor; fixed-seed random train/test split (80/20).
- Metrics: MAE, RMSE and R². No field performance is claimed.
- For time-series real-world data, use a **chronological** holdout and inspect data leakage and seasonal drift.

## Exercise
- Replace synthetic records with a properly licensed, validated dataset using the same columns and units.
- Compare Random Forest against a naive or physics-based baseline.
- Report errors on a held-out period and document data limitations.

## Limitations
These synthetic records simplify real physics, weather, control logic and equipment degradation. Model outputs are not suitable for operational decisions.

## Dispatch demo
The dashboard includes a simple one-hour-step battery energy balance, limited power and 90% charging/discharging efficiencies. This is **not** a mathematical optimum or a grid dispatch recommendation.
