SolarCast is a solar generation forecasting application for estimating photovoltaic output from a selected location and system configuration. It combines a production physics model with experimental ML and hybrid residual-correction engines so users can compare forecasting approaches from one interface.
- 24-hour and 72-hour solar generation forecasts at 15-minute resolution.
- Physics-based forecast using Open-Meteo irradiance/weather data and
pvlib. - Experimental ML-only cold-start forecast using exported model artifacts.
- Hybrid physics + ML residual correction forecast for patent-track experimentation.
- Compare mode for Physics vs Hybrid vs ML-only output.
- Confidence scoring, cloud-loss diagnostics, daily summaries, smart usage window, and CSV export.
- React dashboard with map/location search, system controls, charts, summary cards, and state ranking.
SolarCast/
backend/ FastAPI service, forecast engines, API schemas, tests
frontend/ React + Vite dashboard
ml/ Training, benchmarking, model artifacts, and ML documentation
- Framework: FastAPI
- Core libraries:
pvlib,pandas,numpy,requests,timezonefinder - Data source: Open-Meteo forecast APIs
- Main API routes:
GET /healthPOST /forecastPOST /forecast/mlPOST /forecast/hybridPOST /forecast/compare
- Framework: React + Vite
- UI: Tailwind CSS, custom CSS variables, Lucide icons
- Visualization: Recharts
- Maps/geocoding: Leaflet, React-Leaflet, OpenStreetMap/Nominatim
The production baseline fetches forecast irradiance and weather, computes solar geometry with pvlib, transposes irradiance to plane-of-array, applies system losses, and returns expected AC generation.
The ML-only engine is an experimental cold-start model. It uses weather and time features to generate a data-driven forecast without relying on live inverter history. Treat this mode as a comparison and research tool, not the production baseline.
The hybrid engine starts with the physics forecast, then applies a bounded ML residual correction trained on Indian solar plant data. This keeps the forecast physically guarded while allowing learned corrections where the data supports them.
cd backend
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
python -m uvicorn main:app --reload --port 8000The API runs at http://localhost:8000, with interactive docs at http://localhost:8000/docs.
cd frontend
npm install
npm run devThe Vite app normally runs at http://localhost:5173. API calls are proxied to the backend by frontend/vite.config.js.
Run these checks before committing:
python -m py_compile backend\main.py backend\solar_engine.py backend\hybrid_engine.py backend\ml_engine.py ml\hybrid_residual_model.py ml\train_hybrid_residual_model.py
cd backend
python -m pytest tests -q
cd ..\frontend
npm run lint
npm run buildThe ml/ directory contains scripts for downloading data, training baseline and ML-only models, training the hybrid residual model, and benchmarking against the physics engine. See ml/README.md and ML_FORECAST_PROJECT_DOCUMENTATION.md for experiment details, dataset notes, and artifact descriptions.
Key artifact paths:
ml/artifacts/ml_only_model.pklml/artifacts/ml_only_model_metadata.jsonml/artifacts/hybrid_residual_model.pklml/artifacts/hybrid_residual_model_metadata.json
- Backend deployment configuration is in
backend/render.yaml. - Frontend builds with
npm run buildintofrontend/dist. - Runtime configuration for the frontend API base can be supplied with
VITE_API_BASE_URL. - Local raw datasets, processed data, cache directories, and development-only inspection folders are ignored by
.gitignore.
The current product path is:
- Keep the physics engine as the stable production baseline.
- Use ML-only mode for experimentation and benchmarking.
- Develop the hybrid residual engine as the main patent-track forecasting direction.
- Compare all engines transparently in the UI before promoting any model behavior.