Quantexera Hackathon 2026 · Real-time grid monitoring + ML prediction + optimization dashboard + AI Agent
- Prashant Goundadkar
- Hussain Shaikh
- Abhishek A Pillai
- Jagadeesh Kadlimatti
- Yashsai Dessai
┌─────────────────────┐ MQTT (broker.hivemq.com) ┌─────────────────────┐
│ IoT Simulator │ ──────────────────────────────► │ FastAPI Backend │
│ simulator.py │ topic: iegms/syntaxed/grid/data │ main.py │
│ (publishes every │ │ mqtt_client.py │
│ 2 seconds) │ ◄─────────────────────────────── │ ml_model.py │
│ │ topic: .../time_sync │ optimizer.py │
└─────────────────────┘ │ agent_orchestrator│
└──────────┬──────────┘
│ REST API
│ (HTTP polling)
┌──────────▼──────────┐
│ Frontend (3D) │
│ index.html │
│ app.js / style.css│
│ Three.js │
└─────────────────────┘
project-root/
├── backend/
│ ├── main.py ← FastAPI server (with AI agent endpoints)
│ ├── agent_orchestrator.py ← AI Grid Agent (Ollama/LangChain, optional)
│ ├── mqtt_client.py ← MQTT subscriber + in-memory store
│ ├── ml_model.py ← Linear interpolation load predictor
│ ├── optimizer.py ← Priority load shedding + battery logic
│ ├── test_agent.py ← AI agent test suite
│ ├── example_client.py ← Example API client
│ ├── requirements.txt ← Dependencies
│ └── .env.example ← Configuration template
├── simulator/
│ └── simulator.py ← IoT load data publisher (MQTT)
├── frontend/
│ ├── index.html ← 3D Simulation UI
│ ├── app.js ← Three.js scene + API polling
│ └── style.css ← Dark-mode glassmorphism design
└── README.md
cd backend
pip install -r requirements.txtcd backend
python -m uvicorn main:app --host 0.0.0.0 --port 8000 --reloadThe API will be available at http://localhost:8000
Interactive docs: http://localhost:8000/docs
cd simulator
python simulator.pyThe simulator publishes a new grid reading every 2 seconds via MQTT.
cd frontend
python -m http.server 3000
# Visit http://localhost:3000The dashboard auto-refreshes every 2 seconds.
##AI Agent (Optional)
An Ollama + LangChain-powered AI agent is included for intelligent grid management decisions.
- Install optional dependencies:
pip install langchain langchain-community ollama- Run Ollama on a machine (locally or remote):
ollama serve
ollama pull gemma3:1b- Configure the endpoint:
# backend/.env
OLLAMA_ENDPOINT=http://localhost:11434
OLLAMA_MODEL=mistral| Method | Endpoint | Description |
|---|---|---|
| POST | /agent/configure |
Configure Ollama endpoint/model |
| GET | /agent/config |
Get agent configuration |
| POST | /agent/decide |
Request AI grid decision |
| GET | /agent/status |
Get agent status & analysis |
| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
Health check |
| GET | /data |
Last 20 MQTT grid readings |
| GET | /optimize |
Optimization decision + battery/shed status |
| POST | /set_time |
Jump simulation to a specific hour |
| GET | /docs |
Interactive Swagger UI |
| Condition | Status | Action |
|---|---|---|
| Load ≤ 900 MW | ✅ Normal | Charge battery with excess |
| Load > 900 MW (battery helps) | Discharge battery, alert | |
| Load > 900 MW (still deficit) | 🚨 Critical | Shed by priority (Residential → School) |
Priority: Hospital > School > Industry > Residential
- Open the 3D dashboard — live voxel city with real-time telemetry
- Drag the Time Slider — watch buildings light up/dim as day turns to night
- Power Plants — two plants feed the grid battery via blue supply lines
- Orchestrator Log — AI takes live shedding decisions every 2 seconds
- Battery Meter — charges when excess grid power, discharges on peak demand
- Status badge — NORMAL → WARNING → CRITICAL as load increases
| Layer | Technology |
|---|---|
| Backend | Python 3.11+, FastAPI, Uvicorn |
| ML | Custom time-interpolation model |
| AI Agent | LangChain + Ollama (optional) |
| IoT Transport | MQTT via paho-mqtt |
| MQTT Broker | broker.hivemq.com (public) |
| Frontend 3D | HTML5, Three.js r128 |
| Styling | Vanilla CSS (dark glassmorphism) |
| Storage | In-memory deque (no DB required) |