Python Building Energy Simulation — Core Concepts
Why building energy simulation matters
Buildings consume 40% of total energy and produce 33% of greenhouse gas emissions in the US (DOE). Building codes worldwide now require energy performance demonstrations before construction permits are issued. LEED, BREEAM, and Passive House certifications all rely on simulation to verify compliance. Python has become the automation layer that makes large-scale simulation studies practical.
What gets simulated
A building energy model captures four interacting systems:
- Envelope — Walls, roofs, floors, windows, and doors. Each has thermal properties: conductivity, thickness, solar heat gain coefficient (for glazing), and air leakage rate.
- Internal loads — People (heat and moisture), lighting (heat and electricity), and equipment (computers, appliances). Schedules define when each load is active.
- HVAC — Heating, ventilation, and air conditioning systems. From simple split systems to complex variable-air-volume (VAV) systems with heat recovery.
- Climate — Hourly weather data (temperature, humidity, solar radiation, wind) drives the simulation. TMY (Typical Meteorological Year) files provide standardized annual weather for thousands of locations.
The simulation engine solves heat balance equations at every surface and air node, typically at 15-minute or 1-hour timesteps, for an entire year (8,760 hours).
Key Python tools
| Tool | Purpose |
|---|---|
| eppy | Python interface for creating and editing EnergyPlus IDF files |
| geomeppy | Geometry operations for EnergyPlus models (adding windows, zoning) |
| archetypal | Building archetype generation from templates |
| ladybug-tools | Visual building performance analysis (grasshopper integration) |
| PyEnergyPlus | EnergyPlus Python API for runtime interaction |
| BuildingsPy | Modelica building library interface (Lawrence Berkeley Lab) |
| SALib | Sensitivity analysis for parametric studies |
EnergyPlus: The simulation engine
EnergyPlus is the US DOE’s open-source building energy simulation engine. It’s the industry standard, used in code compliance, green building certification, and research. Python doesn’t replace EnergyPlus — it drives it.
The workflow:
- Create or modify the model — Use eppy to programmatically set wall constructions, window sizes, HVAC parameters, and schedules.
- Run the simulation — Call EnergyPlus as a subprocess or use its Python API.
- Parse results — Read the output CSV/SQL files and analyze energy breakdown, comfort metrics, and peak loads.
- Iterate — Modify parameters and re-run to compare design alternatives.
Parametric studies
The real power of Python + EnergyPlus is automation. Instead of manually changing one parameter, running a simulation, recording the result, and repeating, Python can:
- Define a matrix of parameter combinations (wall insulation × window type × HVAC efficiency × orientation).
- Generate hundreds of model variants automatically.
- Run simulations in parallel across multiple CPU cores.
- Collect all results into a single dataframe for analysis.
A study might test 500 combinations and complete overnight, revealing that wall insulation and window-to-wall ratio dominate energy use while orientation has a smaller effect than expected. This kind of insight is impossible with manual one-at-a-time analysis.
HVAC sizing
A critical simulation output is design day load — the peak heating and cooling demand the building will ever face. This determines HVAC equipment size. Undersizing means the building can’t maintain comfort on extreme days. Oversizing wastes money on equipment and reduces efficiency (HVAC systems run most efficiently near full load).
EnergyPlus runs special “design day” simulations using extreme weather conditions (typically 99.6% heating and 0.4% cooling design temperatures from ASHRAE) to calculate these peak loads.
A common misconception
Many people think more insulation always saves energy. In commercial buildings with large internal heat gains (people, computers, lighting), excess insulation can actually increase cooling energy because heat can’t escape at night. Simulation reveals these counterintuitive interactions between the envelope and internal loads that simplified calculations miss entirely.
Real-world application
The New York City Housing Authority (NYCHA) used Python-driven EnergyPlus simulation to model energy retrofit options for 170,000+ public housing apartments. By simulating window replacements, insulation upgrades, and boiler replacements across representative building archetypes, they prioritized the most cost-effective measures. The analysis projected $50M+ in annual energy savings and guided a $24 billion capital improvement plan.
One thing to remember: Building energy simulation captures the complex interactions between climate, building materials, occupant behavior, and HVAC systems — interactions too complex for back-of-envelope calculations. Python makes running and analyzing hundreds of simulations practical.
See Also
- Python Carbon Footprint Tracking See how Python helps people and companies measure and reduce the pollution they create every day.
- Python Climate Model Visualization See how Python turns complex climate predictions into colorful maps and charts that help everyone understand our changing planet.
- Python Energy Consumption Modeling Understand how Python helps predict and manage energy use, explained with everyday examples anyone can follow.
- Python Smart Grid Simulation Find out how Python helps engineers test the power grid of the future without risking a single blackout.
- Python Solar Panel Optimization Discover how Python helps squeeze the most electricity out of every solar panel on your roof.