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:

  1. Envelope — Walls, roofs, floors, windows, and doors. Each has thermal properties: conductivity, thickness, solar heat gain coefficient (for glazing), and air leakage rate.
  2. Internal loads — People (heat and moisture), lighting (heat and electricity), and equipment (computers, appliances). Schedules define when each load is active.
  3. HVAC — Heating, ventilation, and air conditioning systems. From simple split systems to complex variable-air-volume (VAV) systems with heat recovery.
  4. 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

ToolPurpose
eppyPython interface for creating and editing EnergyPlus IDF files
geomeppyGeometry operations for EnergyPlus models (adding windows, zoning)
archetypalBuilding archetype generation from templates
ladybug-toolsVisual building performance analysis (grasshopper integration)
PyEnergyPlusEnergyPlus Python API for runtime interaction
BuildingsPyModelica building library interface (Lawrence Berkeley Lab)
SALibSensitivity 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:

  1. Create or modify the model — Use eppy to programmatically set wall constructions, window sizes, HVAC parameters, and schedules.
  2. Run the simulation — Call EnergyPlus as a subprocess or use its Python API.
  3. Parse results — Read the output CSV/SQL files and analyze energy breakdown, comfort metrics, and peak loads.
  4. 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.

pythonbuilding-energysimulationsustainability

See Also