Japneet3666/solar-openenv
โก SolarGrid AI: OpenEnv Autonomous Dispatcher
  
SolarGrid AI is a high-fidelity Multi-Agent Reinforcement Learning (MARL) environment that models an autonomous grid dispatcher. Built on top of NREL's PowerGridworld physics simulation and fully compliant with the Meta/Hugging Face OpenEnv Specification, it forces AI agents to balance cost, battery wear, and live grid voltage stability under real-world stochastic conditions.
๐ง Approach: Why AI Dispatch?
Traditional grid controllers use naive heuristic rules (e.g., "charge when solar is high"). These models fail to adapt to live dynamic pricing or prevent cascading voltage deviations across neighborhoods.
Our environment uses exactly the CTDE (Centralized Training, Decentralized Execution) approach. The environment provides realistic observations, requiring the policy to learn multi-objective temporal credit assignment โ when to eat a short-term cost to prevent a massive voltage stability failure in the future.
โ๏ธ Environment Specification (OpenEnv)
Observation Space (SolarObservation)
{
"time_of_day": 14.25, # 0.0 - 24.0 hours
"grid_voltage": 0.985, # Real physics-calculated voltage (p.u.)
"battery_soc": 0.55, # BESS state of charge
"solar_generation_kw": 4.5, # Stochastic solar profile
"household_demand_kw": 2.1, # Stochastic demand profile
"energy_price": 0.15 # Dynamic Time-of-Use pricing
}Action Space (SolarAction)
{
"charge_discharge_rate": -0.85, # Continuous control: [-1.0 to 1.0]
"shed_non_critical_load": False, # Emergency load dumping
"grid_export_limit": 1.0 # Hardware curtailment
}๐ฏ Progressive Tasks & Automated Graders
The agent is evaluated programmatically on three progressively difficult tasks:
- `maximize-self-consumption` (Easy): Maximize local solar utilization, minimizing grid export.
- `peak-shaving` (Medium): Predict demand spikes and intelligently discharge battery reserves during expensive peak pricing hours (5:00 PM - 9:00 PM).
- `emergency-load-shedding` (Hard): Maintain grid voltage stability within strict tight bounds [0.95 p.u. - 1.05 p.u.]. Requires complex continuous power absorption / injection via BESS.
๐ Baseline Performance
๐ How to Run Locally
Ensure you have your environment set up and Docker available.
1. Install Dependencies
pip install -r requirements.txt2. Test the Baseline Agent
python baseline_inference.py3. Launch the Industrial Visualization Dashboard The repository comes out-of-the-box with a high-fidelity FastAPI dashboard with real-time WebSockets to visualize the agent's performance.
python dashboard_server.py
# Go to http://localhost:8000๐ณ Running inside Docker & Deploying to Hugging Face Spaces
This project is meticulously configured to run headlessly in Hugging Face Spaces.
Build and Run Locally
docker build -t solar-grid-ai .
docker run -p 8000:8000 solar-grid-aiDeploying to HF Spaces
- Create a public Docker-based Space on Hugging Face.
- Push this exact repository structure.
- Automatically exposes the
dashboard_server.pyinference endpoints. - Scale up hardware in HF settings if running full Multi-Agent Distributed RL.
OpenEnv Hackathon 2026 โ Built for the India Mega AI Hackathon
