Skip to main content

energy+ wrapper

This little library has been written in order to run energy+ simulation in linux and windows in a thread-safe way.

The main goal is to ensure a stable behavior across platform and version, and to make the link between the e+ building model tools written in python and the different analysis and optimization tools.

Install

For now, the package is available on PyPI, and via the github repo.

pip install git+https://github.com/locie/energy_plus_wrapper

for the requirements.

Usage

There is two main classes in the library: the EPlusRunner and the Simulation.

The first one is linked with the EnergyPlus local installation and allow to run one or many simulation. It also ensure the compatibility between the executable and the IDF file.

The later is generated with the runner.run_one and runner.run_many. It contains the EnergyPlus simulation reports and results.

A small utility routine ensure_eplus_root allow to automatically download, extract and install EnergyPlus (but only for linux for now).

from energyplus_wrapper import EPlusRunner, ensure_eplus_root

eplus_root = ensure_eplus_root("http://url/to/eplus/install.sh")
# or
eplus_root = "path/to/energyplus/install/dir"

runner = EPlusRunner(eplus_root)
simulation = runner.run("my/idf/file.idf", "my/weather/file.epw")
print(simulation.reports) # be aware that the result is a complex nested dict
print(simulation.time_series)

The runner.run is multi-process safe, allowing to run multiple EnergyPlus simulation at the same time.

The method runner.run_many allow to run multiple simulation at the same time. It uses joblib.parallel under the hood : how the simulation are ran and how many CPU are used can be controlled by joblib.parallel_backend

from energyplus_wrapper import EPlusRunner, ensure_eplus_root

eplus_root = ensure_eplus_root("http://url/to/eplus/install.sh")
# or
eplus_root = "path/to/energyplus/install/dir"

runner = EPlusRunner(eplus_root)

samples = {"sim01": ("idf01.idf", "weather01.epw"),
           "sim02": ("idf02.idf", "weather01.epw"),
           "sim03": ("idf03.idf", "weather02.epw"),
           "sim04": ("idf04.idf", "weather02.epw")}

# run on 4 CPU
with joblib.parallel_backend("loky", n_jobs=4):
    sims = runner.run_many(samples)

print(sims.keys())

run_one, run_many common mecanism

eppy compatibility

Every time you need to provide an idf file, you can use a eppy.modeleditor.IDF object instead (as obtained using eppy.openidf). This allow dynamic change of the model without the need to rewrite one file per simulation.

backup

According to the backup_strategy, the runner can save the files generated by EnergyPlus in the backup folder. It can save the files 'always', 'on_error', or never (with None).

version check

According to version_mismatch_action, a mismatch between the e+ executable and the idf file version will raise an error, warn the user or be ignored.

custom post-process

You can provide a custom simulation post process. By default, the file eplus-table.htm is parsed and put in the simulation.reports attribute, and all the csv files generated by the run are parsed and put in simulation.time_series.

For example, you could save all the files generated by the simulation with

from path import Path
import zipfile

archive_folder = Path("./archive/").abspath()

def save_and_compress(simulation):
    with zipfile.ZipFile(archive_folder / f"{simulation.name}.gz", "w", zipfile.ZIP_DEFLATED) as zip_handler:
        for file in simulation.working_dir.files("*"):
            zip_handler.write(file)

runner.run_one(idf, wf, custom_process=save_and_compress)

Metadata

Release files for energyplus-wrapper 2.0.0

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

Source distribution (sdist)

Source distribution for energyplus-wrapper 2.0.0
File Size Uploaded Provenance Actions
energyplus_wrapper-2.0.0.tar.gz 836.7 kB Without provenance Details for energyplus_wrapper-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for energyplus-wrapper 2.0.0
File Interpreter ABI Platform Actions
energyplus_wrapper-2.0.0-py3-none-any.whl Python 3 none any Details for energyplus_wrapper-2.0.0-py3-none-any.whl

Total release size: 848.8 kB

Release files / energyplus_wrapper-2.0.0.tar.gz

Download URL energyplus_wrapper-2.0.0.tar.gz
Size 836.7 kB
Tags Source
SHA-256 checksum
How to use checksums
202c0b2a2f54a464ca378816a7c98fadca92284eaac52deb9f3ccb450ba0fce0
BLAKE2b-256 checksum
How to use checksums
f3fbbcbb97188599579a2ede91e41060057f976e21d7ba48ef2045912f296df6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.6

Release files / energyplus_wrapper-2.0.0-py3-none-any.whl

Download URL energyplus_wrapper-2.0.0-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
943c792b937429b597dda78aac2f4acbfa3d26a5018709f3eeaae43943fb8af8
BLAKE2b-256 checksum
How to use checksums
a03302511682e6f0379b757a6295ddc2ba50533adbcf603837545fe035b54dd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.6

Security for energyplus-wrapper 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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