IntelliGrid EnergyPlus MCP Server
README.md
# Autonomous Building Energy Optimization -- Physical AI PoC
A closed-loop system where an open-source LLM (Ollama, qwen2.5:7b)
controls a real DOE Commercial Reference Building (Small Office, Chicago)
simulated in EnergyPlus, via MCP tools -- proving quantifiable energy
savings while maintaining occupancy-aware thermal comfort.
Full architecture, prompt strategy, and design trade-offs (including a
real bug we found and fixed in the comfort metric):
[`docs/ARCHITECTURE.md`](https://www.google.com/search?q=docs/ARCHITECTURE.md)
## Project Layout
```
models/baseline.idf Real DOE Small Office reference building (5 conditioned zones)[cite: 4]
models/Energy+.idd IDD matching EnergyPlus 26.1.0
weather/chicago.epw Chicago O'Hare TMY3 weather
tools/idf_tools.py Core EnergyPlus bridge: run, parse metrics, edit setpoint schedules[cite: 4]
mcp_server.py MCP server exposing those functions as LLM tools[cite: 5]
agent/llm_client.py Ollama tool-calling client (+ offline mock for wiring tests)[cite: 2]
agent/agent_loop.py The closed-loop orchestrator (system prompt + iteration control)[cite: 1]
dashboard/generate_dashboard.py Baseline-vs-AI comparison chart[cite: 3]
runs/ Simulation outputs, agent transcript, dashboard (generated)[cite: 3]
docs/ARCHITECTURE.md System architecture document
```
## Setup (Windows)
You've already done steps 1-4 if you're reading this after our chat --
listed here for completeness / for judges reproducing your results.
**1. EnergyPlus 26.1.0** -- already installed at `C:\EnergyPlusV26-1-0`
**2. Python packages**
```cmd
cd C:\building-ai-poc\project
venv\Scripts\activate
pip install -r requirements.txt
```
**3. Point at your EnergyPlus install**
```cmd
set ENERGYPLUS_DIR=C:\EnergyPlusV26-1-0
```
**4. Ollama + model** -- already pulled `qwen2.5:7b`
## Running the Closed Loop for Real
```cmd
set LLM_BACKEND=ollama
set OLLAMA_MODEL=qwen2.5:7b
python agent\agent_loop.py
```
Watch it print every tool call and result live: reset -> baseline run ->
propose a schedule -> simulate -> read real EnergyPlus feedback -> refine
-> repeat, for up to 6 iterations. Full trace saved to
`runs\agent_transcript.json`.
Then build the savings dashboard:
```cmd
python dashboard\generate_dashboard.py
```
Writes `runs\dashboard.png` and `runs\savings_summary.json`.
## Key Results & Performance
- **Headline Savings:** A verified **4.45% reduction in total energy consumption** (1,107.52 kWh vs. 1,159.06 kWh baseline) achieved while maintaining **zero thermal comfort violation hours** across all conditioned building zones.
## Testing Without Ollama (wiring check only)
```cmd
set LLM_BACKEND=mock
python agent\agent_loop.py
```
Exercises the exact same MCP/EnergyPlus pipeline with a scripted
(non-LLM) policy -- useful for confirming the plumbing works, but it is
**not a real optimizer** and typically performs _worse_ than baseline
(we verified this ourselves -- see `docs/ARCHITECTURE.md` Section 4). Only
`LLM_BACKEND=ollama` produces a real result to report.
## Key Building Facts (verified against the actual IDF)
- 5 conditioned zones (Core + 4 Perimeter) + 1 unconditioned Attic, each
conditioned zone on its own PSZ-AC system.
- Natural gas heating, electric DX cooling.
- All 5 zones share two setpoint schedules (`HTGSETP_SCH`, `CLGSETP_SCH`)
-- the agent's control surface.
- Baseline schedule is the DOE reference's built-in weekday/weekend
setback (15.6C/21C heating, 26.7C/24C cooling) -- already reasonably
good, so beating it is a genuine optimization challenge, not a strawman.
- Comfort is checked **only during occupied hours** (via the building's
real `BLDG_OCC_SCH`), so the baseline correctly shows 0 violations
rather than being penalized for intentional night setback.
This server cannot be deployed
Maintenance
ActivitySlowing
ResponsivenessNo issues