Skip to main content

Direct port of pyenergyplus that comes with EnergyPlus into a standalone Python package

Project description

pyenergyplus (LBNL)

pyenergyplus is a pip-installable wheel that packages the EnergyPlus simulation engine and its Python API. It also ships pyenergyplus.model, a Pydantic v2 sub-package providing data models for the EnergyPlus epJSON format. Both components are versioned together and always track the same EnergyPlus release.

Installation

pip install pyenergyplus-lbnl

Usage

Simulation API

from pyenergyplus.api import EnergyPlusAPI

api = EnergyPlusAPI()
state = api.state_manager.new_state()
api.runtime.run_energyplus(state, ["-w", "weather.epw", "-r", "model.idf"])

epJSON data models (pyenergyplus.model)

Load an epJSON file into a typed EnergyPlusModel:

import json
from pyenergyplus.model import EnergyPlusModel

with open("model.epJSON") as f:
    model = EnergyPlusModel.model_validate(json.load(f))

print(model.version)

Modify fields through the Pydantic model, then serialize back to a dict and write to a file for simulation. Use by_alias=True so object-type keys match the EnergyPlus epJSON format (e.g. "Building" not "building"), and exclude_none=True to omit optional fields that were not set:

import json, tempfile, os
from pyenergyplus.api import EnergyPlusAPI
from pyenergyplus.model import EnergyPlusModel

with open("model.epJSON") as f:
    model = EnergyPlusModel.model_validate(json.load(f))

# --- make changes to the model here ---

epjson_dict = model.model_dump(by_alias=True, exclude_none=True)

with tempfile.NamedTemporaryFile(
    mode="w", suffix=".epJSON", delete=False
) as tmp:
    json.dump(epjson_dict, tmp)
    tmp_path = tmp.name

api = EnergyPlusAPI()
state = api.state_manager.new_state()
api.runtime.run_energyplus(state, ["-w", "weather.epw", "-r", tmp_path])
os.unlink(tmp_path)

Individual model classes are importable from pyenergyplus.model.model:

from pyenergyplus.model.model import WindowMaterialGas, GasType

gas = WindowMaterialGas(gas_type=GasType.air, thickness=0.012)

Builder helpers

from pyenergyplus.model.builder import (
    ConstructionComplexFenestrationStateBuilder,
    ConstructionComplexFenestrationStateInput,
)

Bundled reference models and weather files

from pyenergyplus.dataset import ref_models, ashrae_models, weather_files

idf_path = ref_models["large_office"]
epw_path = weather_files["chicago"]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyenergyplus_lbnl-26.1.0-py3-none-win_amd64.whl (21.9 MB view details)

Uploaded Python 3Windows x86-64

pyenergyplus_lbnl-26.1.0-py3-none-macosx_11_0_arm64.whl (37.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file pyenergyplus_lbnl-26.1.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for pyenergyplus_lbnl-26.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 5669748080888d33424a6c2bae665fedc5b14fa7d43dc897cf20d46ee2ee3426
MD5 f40c2311849d9d223af87eaddfe971fb
BLAKE2b-256 399a2ef6f39fa7865bb5da4cd84702cb169a2974bb3045e2575d0613b66890ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyenergyplus_lbnl-26.1.0-py3-none-win_amd64.whl:

Publisher: publish.yml on taoning/pyenergyplus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyenergyplus_lbnl-26.1.0-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyenergyplus_lbnl-26.1.0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 16bda1d451a72d8ec27697d8c52f804a7ce1c51b0ccb567b80033652e356720b
MD5 96989e25a78a00bba3db2602d55c88f9
BLAKE2b-256 1bfa03767459c9f4281ed2a0778eea1d5f033f27669de43a6c22ccb9326198e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyenergyplus_lbnl-26.1.0-py3-none-manylinux1_x86_64.whl:

Publisher: publish.yml on taoning/pyenergyplus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyenergyplus_lbnl-26.1.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyenergyplus_lbnl-26.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 629fb061b78f529b682477fb0396cf4f3e3c67e31fbff4e20d574b8352afc2a9
MD5 3c5a054ebaadb6a2d45e4eaac1552025
BLAKE2b-256 20b45227a206df7d7fb4bd94934aeb7ed8a27b618489cda00fc74305bdf7e7b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyenergyplus_lbnl-26.1.0-py3-none-macosx_11_0_arm64.whl:

Publisher: publish.yml on taoning/pyenergyplus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page