Skip to main content

Logo

OpenSimula

PyPI version Python versions License: MIT

OpenSimula is a component-based time simulation environment in Python, focused on the thermal and energy simulation of buildings and their HVAC installations — though it can be used to simulate any system whose state evolves over time. It implements the ASHRAE 140 standard test suite to validate its building load and HVAC calculations.

Documentation · Getting started · User guide · Component list

What it does

A project is built from components — spaces, walls, windows, constructions, schedules, HVAC equipment, weather files — wired together and simulated hour by hour (or at any other time step). OpenSimula takes care of:

  • Building thermal simulation: multi-space heat balance, constructions with thermal mass, windows and solar gains, ground-coupled surfaces, internal gains and schedules.
  • HVAC systems: from an ideal loads system (HVAC_perfect_system) to direct-expansion and water-based single- and multi-zone systems, coils, fans, pumps, chillers and heat pumps.
  • Solar geometry and shadows: direct and diffuse shadow calculations between the surfaces of a project, with an interactive 3D Plotly view — including an animated view of shadows changing throughout the day.
  • Everything else a simulation needs: psychrometrics (via PsychroLib), day/week/year schedules, arbitrary math expressions as inputs, and reading weather data (TMY3, MET) or generic data files (CSV, Excel).
  • Validation against ASHRAE 140: the ASHRAE_140/ folder in this repository reproduces the standard's load, heating, cooling, air-side HVAC and weather test cases as runnable notebooks, comparing OpenSimula's results against the reference values.

Projects can be defined as plain Python dictionaries, JSON or Excel files, and results come back as component Variable time series or pandas DataFrames, ready to plot or export.

Installation

pip install opensimula

Requires Python 3.12 or later.

Quick example

import opensimula as osm

project_dict = {
    "name": "First example",
    "time_step": 3600,
    "n_time_steps": 24 * 7,
    "initial_time": "01/01/2001 00:00:00",
    "components": [
        {
            "type": "Day_schedule",
            "name": "working_day",
            "time_steps": [8 * 3600, 5 * 3600, 2 * 3600, 4 * 3600],
            "values": [0, 100, 0, 80, 0],
            "interpolation": "STEP",
        },
        {
            "type": "Day_schedule",
            "name": "holiday_day",
            "time_steps": [],
            "values": [0],
            "interpolation": "STEP",
        },
        {
            "type": "Week_schedule",
            "name": "office_week",
            "days_schedules": ["working_day"] * 5 + ["holiday_day"] * 2,
        },
    ],
}

sim = osm.Simulation()
pro = sim.new_project("First example")
pro.read_dict(project_dict)
pro.simulate()

sim.plot(pro.dates(), [pro.component("office_week").variable("values")])

This is deliberately minimal — the Getting started guide walks through a full building, and the jupyter_test/ and ASHRAE_140/ folders in this repository contain complete, runnable building and HVAC examples.

Working in Jupyter

OpenSimula ships an interactive project editor as a Jupyter widget (pro.editor()), built on anywidget so it works the same in Jupyter, JupyterLab, VS Code notebooks and Marimo. It shows every component's parameters as a form generated from each component's own schema, together with an interactive 3D view of the building.

Project editor example

Component types

Components are grouped by what they define:

  • Building: Building, Space_type, Space, Building_surface, Opening, Solar_surface.
  • Constructions: Material, Construction, Glazing, Frame, Opening_type.
  • HVAC (air side): HVAC_perfect_system, DX_unit, HVAC_DX_system, Water_coil, Fan, HVAC_SZW_system, HVAC_MZW_system.
  • HVAC (water side): Pump, Chiller_heat_pump, HVAC_water_system.
  • Schedules: Day_schedule, Week_schedule, Year_schedule.
  • Files: File_met, File_data.
  • Utilities: Calculator.

See the Component list for every parameter and variable of each one.

Package dependencies

  • numpy
  • pandas
  • scipy
  • shapely
  • psychrolib
  • plotly
  • matplotlib
  • anywidget
  • jsonschema
  • nbformat
  • openpyxl
  • tqdm

These are installed automatically with pip install opensimula.

Documentation and support

Full documentation, including the getting started guide, user guide and component reference, is at jfcoronel.github.io/OpenSimula. Bugs and feature requests are tracked on GitHub Issues.

Main Developers

License

OpenSimula is released under the MIT License.

Release files for opensimula 0.8.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opensimula 0.8.7
File Size Uploaded
opensimula-0.8.7.tar.gz 174.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for opensimula 0.8.7
File Interpreter ABI Platform
opensimula-0.8.7-py3-none-any.whl Python 3 none any Details

Total release size: 351.8 kB

Release files / opensimula-0.8.7.tar.gz

Download URL opensimula-0.8.7.tar.gz
Size 174.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9fc544e0a5f852f313964ebca213395276271b0d747c712d45a52504f2ff10c7
BLAKE2b-256 checksum
How to use checksums
c38961f3186454a5faae77573b9539ce550e1f70616bf0aafdaf2fcb1ddaefc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / opensimula-0.8.7-py3-none-any.whl

Download URL opensimula-0.8.7-py3-none-any.whl
Size 177.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57821d93cefd88783877c2ac96eb1c88ea0dd2285cb9767ca6f8d822906f38b4
BLAKE2b-256 checksum
How to use checksums
840a7e00e06af64326fd3e5c77f322041a6d930d088c7a4cda56779d494c18a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.8.7 This release

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page