Skip to content

Runner API

Core simulation execution functions.

simulate

idfkit.simulation.runner.simulate(model, weather=None, *, output_dir=None, energyplus=None, expand_objects=True, annual=False, design_day=False, output_prefix='eplus', output_suffix='C', readvars=False, timeout=3600.0, preprocessor_timeout=None, extra_args=None, cache=None, fs=None, on_progress=None, auto_migrate=False)

simulate(
    model: AnyIDFDocument,
    weather: str | Path | None,
    *,
    output_dir: str | Path | None = None,
    energyplus: EnergyPlusConfig | None = None,
    expand_objects: bool = True,
    annual: bool = False,
    design_day: bool = False,
    output_prefix: str = "eplus",
    output_suffix: Literal["C", "L", "D"] = "C",
    readvars: bool = False,
    timeout: float = 3600.0,
    preprocessor_timeout: float | None = None,
    extra_args: list[str] | None = None,
    cache: SimulationCache | None = None,
    fs: FileSystem | None = None,
    on_progress: Callable[[SimulationProgress], Any]
    | Literal["tqdm"]
    | None = None,
    auto_migrate: bool = False,
) -> SimulationResult
simulate(
    model: AnyIDFDocument,
    weather: None = None,
    *,
    output_dir: str | Path | None = None,
    energyplus: EnergyPlusConfig | None = None,
    expand_objects: bool = True,
    annual: Literal[False] = False,
    design_day: Literal[True],
    output_prefix: str = "eplus",
    output_suffix: Literal["C", "L", "D"] = "C",
    readvars: bool = False,
    timeout: float = 3600.0,
    preprocessor_timeout: float | None = None,
    extra_args: list[str] | None = None,
    cache: SimulationCache | None = None,
    fs: FileSystem | None = None,
    on_progress: Callable[[SimulationProgress], Any]
    | Literal["tqdm"]
    | None = None,
    auto_migrate: bool = False,
) -> SimulationResult

Run an EnergyPlus simulation.

Creates an isolated run directory, writes the model, and executes EnergyPlus as a subprocess. The caller's model is not mutated.

When expand_objects is True (the default) and the model contains GroundHeatTransfer:Slab:* or GroundHeatTransfer:Basement:* objects, the Slab and/or Basement ground heat-transfer preprocessors are run automatically before simulation. This is equivalent to calling run_slab_preprocessor or run_basement_preprocessor individually, but happens transparently.

Parameters:

Name Type Description Default
model AnyIDFDocument

The EnergyPlus model to simulate.

required
weather str | Path | None

Path to the weather file (.epw), or None to run without a weather file. None is accepted only for a design-day-only run (design_day=True and annual=False). A model that contains GroundHeatTransfer:Slab:* or GroundHeatTransfer:Basement:* objects requires a weather file when expand_objects is True and GroundHeatTransfer:Control sets the matching run_slab_preprocessor or run_basement_preprocessor field to Yes, because the Slab and Basement preprocessors read it. Without a weather file, a model that contains SizingPeriod:WeatherFileDays or SizingPeriod:WeatherFileConditionType fails in EnergyPlus and the result has success=False; a model whose Site:WaterMainsTemperature uses CorrelationFromWeatherFile completes with one severe error and a fixed mains temperature of 10 °C.

None
output_dir str | Path | None

Directory for output files. None (the default) runs in a new temporary directory, which stays on disk until you call cleanup or leave a with simulate(...) as result: block. A directory you pass is never deleted.

None
energyplus EnergyPlusConfig | None

Pre-configured EnergyPlus installation. If None, uses find_energyplus for auto-discovery.

None
expand_objects bool

Run ExpandObjects before simulation. When True, also runs the Slab and Basement ground heat-transfer preprocessors if the model contains the corresponding objects.

True
annual bool

Run annual simulation (-a flag). The model needs a RunPeriod; without one the run is refused (see Raises).

False
design_day bool

Run design-day-only simulation (-D flag). With neither flag, SimulationControl decides: by default, the model's sizing periods and then its RunPeriod objects, so the model needs at least one of them (see Raises).

False
output_prefix str

Prefix for output files (default "eplus").

'eplus'
output_suffix Literal['C', 'L', 'D']

EnergyPlus --output-suffix style, which names the output files: "C" (capital, default) gives eplus.err and eplusTable.htm, "L" (legacy) gives eplusout.err and eplustbl.htm, and "D" (dash) gives eplus.err and eplus-table.htm.

'C'
readvars bool

Run ReadVarsESO after simulation (-r flag).

False
timeout float

Maximum runtime in seconds (default 3600). Applied only to the main EnergyPlus subprocess; preprocessor stages (ExpandObjects, Slab, Basement) have an independent budget — see preprocessor_timeout.

3600.0
preprocessor_timeout float | None

Per-subprocess timeout (seconds) applied individually to ExpandObjects, Slab, and Basement when they run automatically. None (the default) consults the IDFKIT_PREPROCESSOR_TIMEOUT environment variable, falling back to 120 s. Independent of timeout — there is no shared wall-clock cap across the pipeline.

None
extra_args list[str] | None

Additional command-line arguments.

None
cache SimulationCache | None

Optional simulation cache for content-hash lookups. The key covers the contents of every file the model names (a Schedule:File CSV staged into output_dir, for example). A model with a PythonPlugin:Instance or a co-simulation ExternalInterface is never cached; a warning is logged. A hit is copied into output_dir like a fresh run; without one, its run_dir is the read-only cache entry. Either way the result has cached=True.

None
fs FileSystem | None

Optional file system backend for storing results on remote storage (e.g., S3). When provided, output_dir is required and specifies the remote destination path. EnergyPlus runs locally in a temp directory; its outputs (not the copy of the weather file) are then uploaded to output_dir via fs, and the temp directory is deleted, also when the run raises. Combined with cache, a miss is cached from the local run directory and a hit uploads the cached outputs to output_dir, so the remote folder exists either way.

Note

The fs parameter handles output storage only. The weather file must be a local path — remote weather files are not automatically downloaded. For cloud workflows, download weather files first using WeatherDownloader or pre-stage them locally before calling simulate().

None
on_progress Callable[[SimulationProgress], Any] | Literal['tqdm'] | None

Optional callback invoked with a SimulationProgress event each time EnergyPlus emits a progress line (warmup iterations, simulation day changes, post-processing steps, etc.). Pass "tqdm" to use a built-in tqdm progress bar (requires pip install idfkit[progress]).

None
auto_migrate bool

When True and model.version differs from the installed EnergyPlus version, forward-migrate the model before running the simulation. The resulting MigrationReport is attached to the returned SimulationResult.migration_report. Backward migration (installed EP older than the model) is never attempted and always raises VersionMismatchError.

False

Returns:

Type Description
SimulationResult

SimulationResult with paths to output files. Its files are read lazily

SimulationResult

from run_dir, so read them before cleaning it up.

Raises:

Type Description
SimulationError

On timeout or OS error, or when the weather argument is refused before EnergyPlus starts: weather is an empty string; weather names a file that does not exist; weather is None and the run is not design-day-only; weather is None, expand_objects is True and the model contains Slab or Basement ground heat-transfer objects whose preprocessor GroundHeatTransfer:Control enables; or weather is None and the run directory already contains in.epw. Also raised before EnergyPlus starts when annual is True and the model has no RunPeriod, when design_day is True and the model has no SizingPeriod:DesignDay, or when neither is set and SimulationControl leaves EnergyPlus nothing to run: no RunPeriod and no SizingPeriod:* (as a fresh new_document() has), or both turned off.

TypeError

If model is not a document (None, or a path).

ExpandObjectsError

If a preprocessing step (ExpandObjects, Slab, or Basement) fails during automatic preprocessing.

EnergyPlusNotFoundError

If EnergyPlus cannot be found.

VersionMismatchError

If model.version names another release line than the installed EnergyPlus (a 9.0 model on 9.0.1 matches) and auto_migrate is False — or if the model is newer than the installed EnergyPlus (backward migration is not supported).

Source code in idfkit/simulation/runner.py
def simulate(
    model: AnyIDFDocument,
    weather: str | Path | None = None,
    *,
    output_dir: str | Path | None = None,
    energyplus: EnergyPlusConfig | None = None,
    expand_objects: bool = True,
    annual: bool = False,
    design_day: bool = False,
    output_prefix: str = "eplus",
    output_suffix: Literal["C", "L", "D"] = "C",
    readvars: bool = False,
    timeout: float = 3600.0,
    preprocessor_timeout: float | None = None,
    extra_args: list[str] | None = None,
    cache: SimulationCache | None = None,
    fs: FileSystem | None = None,
    on_progress: Callable[[SimulationProgress], Any] | Literal["tqdm"] | None = None,
    auto_migrate: bool = False,
) -> SimulationResult:
    """Run an EnergyPlus simulation.

    Creates an isolated run directory, writes the model, and executes
    EnergyPlus as a subprocess. The caller's model is not mutated.

    When *expand_objects* is ``True`` (the default) and the model contains
    ``GroundHeatTransfer:Slab:*`` or ``GroundHeatTransfer:Basement:*``
    objects, the Slab and/or Basement ground heat-transfer preprocessors
    are run automatically before simulation.  This is equivalent to
    calling [run_slab_preprocessor][idfkit.simulation.expand.run_slab_preprocessor] or
    [run_basement_preprocessor][idfkit.simulation.expand.run_basement_preprocessor]
    individually, but happens transparently.

    Args:
        model: The EnergyPlus model to simulate.
        weather: Path to the weather file (.epw), or ``None`` to run without
            a weather file. ``None`` is accepted only for a design-day-only
            run (``design_day=True`` and ``annual=False``). A model that
            contains ``GroundHeatTransfer:Slab:*`` or
            ``GroundHeatTransfer:Basement:*`` objects requires a weather
            file when *expand_objects* is ``True`` and
            ``GroundHeatTransfer:Control`` sets the matching
            ``run_slab_preprocessor`` or ``run_basement_preprocessor`` field
            to ``Yes``, because the Slab and Basement preprocessors read it. Without a weather file,
            a model that contains ``SizingPeriod:WeatherFileDays`` or
            ``SizingPeriod:WeatherFileConditionType`` fails in EnergyPlus and
            the result has ``success=False``; a model whose
            ``Site:WaterMainsTemperature`` uses ``CorrelationFromWeatherFile``
            completes with one severe error and a fixed mains temperature of
            10 °C.
        output_dir: Directory for output files. ``None`` (the default) runs
            in a new temporary directory, which stays on disk until you call
            [cleanup][idfkit.simulation.result.SimulationResult.cleanup] or leave a
            ``with simulate(...) as result:`` block. A directory you
            pass is never deleted.
        energyplus: Pre-configured EnergyPlus installation. If None,
            uses [find_energyplus][idfkit.simulation.config.find_energyplus] for auto-discovery.
        expand_objects: Run ExpandObjects before simulation.  When
            ``True``, also runs the Slab and Basement ground heat-transfer
            preprocessors if the model contains the corresponding objects.
        annual: Run annual simulation (``-a`` flag). The model needs a
            ``RunPeriod``; without one the run is refused (see Raises).
        design_day: Run design-day-only simulation (``-D`` flag). With
            neither flag, ``SimulationControl`` decides: by default, the
            model's sizing periods and then its ``RunPeriod`` objects, so the
            model needs at least one of them (see Raises).
        output_prefix: Prefix for output files (default "eplus").
        output_suffix: EnergyPlus ``--output-suffix`` style, which names the
            output files: ``"C"`` (capital, default) gives ``eplus.err`` and
            ``eplusTable.htm``, ``"L"`` (legacy) gives ``eplusout.err`` and
            ``eplustbl.htm``, and ``"D"`` (dash) gives ``eplus.err`` and
            ``eplus-table.htm``.
        readvars: Run ReadVarsESO after simulation (``-r`` flag).
        timeout: Maximum runtime in seconds (default 3600).  Applied only
            to the main EnergyPlus subprocess; preprocessor stages
            (ExpandObjects, Slab, Basement) have an independent budget — see
            *preprocessor_timeout*.
        preprocessor_timeout: Per-subprocess timeout (seconds) applied
            individually to ExpandObjects, Slab, and Basement when they
            run automatically.  ``None`` (the default) consults the
            ``IDFKIT_PREPROCESSOR_TIMEOUT`` environment variable, falling
            back to 120 s.  Independent of *timeout* — there is no shared
            wall-clock cap across the pipeline.
        extra_args: Additional command-line arguments.
        cache: Optional simulation cache for content-hash lookups.  The key
            covers the contents of every file the model names (a
            ``Schedule:File`` CSV staged into *output_dir*, for example).  A
            model with a ``PythonPlugin:Instance`` or a co-simulation
            ``ExternalInterface`` is never cached; a warning is logged.
            A hit is copied into *output_dir* like a fresh run; without one,
            its ``run_dir`` is the read-only cache entry. Either way the
            result has ``cached=True``.
        fs: Optional file system backend for storing results on remote
            storage (e.g., S3). When provided, ``output_dir`` is required
            and specifies the remote destination path. EnergyPlus runs
            locally in a temp directory; its outputs (not the copy of the
            weather file) are then uploaded to ``output_dir`` via *fs*, and
            the temp directory is deleted, also when the run raises.  Combined
            with *cache*, a miss is cached from the local run directory and a
            hit uploads the cached outputs to ``output_dir``, so the remote
            folder exists either way.

            !!! note
                The ``fs`` parameter handles **output storage only**.
                The ``weather`` file must be a local path — remote weather
                files are not automatically downloaded. For cloud workflows,
                download weather files first using [WeatherDownloader][idfkit.weather.WeatherDownloader]
                or pre-stage them locally before calling ``simulate()``.
        on_progress: Optional callback invoked with a
            [SimulationProgress][idfkit.simulation.progress.SimulationProgress] event
            each time EnergyPlus emits a progress line (warmup iterations,
            simulation day changes, post-processing steps, etc.).  Pass
            ``"tqdm"`` to use a built-in tqdm progress bar (requires
            ``pip install idfkit[progress]``).
        auto_migrate: When ``True`` and ``model.version`` differs from the
            installed EnergyPlus version, forward-migrate the model before
            running the simulation. The resulting [MigrationReport][idfkit.migration.report.MigrationReport]
            is attached to the returned [SimulationResult.migration_report][idfkit.simulation.result.SimulationResult.migration_report].
            Backward migration (installed EP older than the model) is never
            attempted and always raises [VersionMismatchError][idfkit.exceptions.VersionMismatchError].

    Returns:
        SimulationResult with paths to output files. Its files are read lazily
        from ``run_dir``, so read them before cleaning it up.

    Raises:
        SimulationError: On timeout or OS error, or when the weather argument
            is refused before EnergyPlus starts: *weather* is an empty
            string; *weather* names a file that does not exist; *weather* is
            ``None`` and the run is not design-day-only; *weather* is
            ``None``, *expand_objects* is ``True`` and the model contains
            Slab or Basement ground heat-transfer objects whose preprocessor
            ``GroundHeatTransfer:Control`` enables; or *weather* is
            ``None`` and the run directory already contains ``in.epw``. Also
            raised before EnergyPlus starts when *annual* is ``True`` and the
            model has no ``RunPeriod``, when *design_day* is ``True`` and
            the model has no ``SizingPeriod:DesignDay``, or when neither is
            set and ``SimulationControl`` leaves EnergyPlus nothing to run:
            no ``RunPeriod`` and no ``SizingPeriod:*`` (as a fresh
            ``new_document()`` has), or both turned off.
        TypeError: If *model* is not a document (``None``, or a path).
        ExpandObjectsError: If a preprocessing step (ExpandObjects, Slab,
            or Basement) fails during automatic preprocessing.
        EnergyPlusNotFoundError: If EnergyPlus cannot be found.
        VersionMismatchError: If ``model.version`` names another release line
            than the installed EnergyPlus (a ``9.0`` model on 9.0.1 matches) and
            *auto_migrate* is ``False`` — or if the
            model is newer than the installed EnergyPlus (backward migration
            is not supported).
    """
    options: dict[str, Any] = {
        "energyplus": energyplus,
        "expand_objects": expand_objects,
        "annual": annual,
        "design_day": design_day,
        "output_prefix": output_prefix,
        "output_suffix": output_suffix,
        "readvars": readvars,
        "timeout": timeout,
        "preprocessor_timeout": preprocessor_timeout,
        "extra_args": extra_args,
        "cache": cache,
        "on_progress": on_progress,
        "auto_migrate": auto_migrate,
    }
    if fs is None:
        return _simulate_local(model, weather, output_dir=output_dir, **options)
    if output_dir is None:
        msg = "output_dir is required when using a file system backend"
        raise ValueError(msg)
    # EnergyPlus runs in a local scratch directory, which is uploaded to output_dir and then deleted.
    remote_dir = Path(str(output_dir))
    with tempfile.TemporaryDirectory(prefix="idfkit_sim_", ignore_cleanup_errors=True) as scratch:
        return _simulate_local(
            model,
            weather,
            output_dir=scratch,
            publish=lambda local, weather_path: _publish(local, remote_dir, fs, weather_path),
            **options,
        )

find_energyplus

idfkit.simulation.config.find_energyplus(*, version=None, path=None)

Find an EnergyPlus installation.

Discovery order
  1. Explicit path argument.
  2. ENERGYPLUS_DIR environment variable.
  3. energyplus on PATH (via shutil.which).
  4. Platform-specific default directories (newest version first).

Parameters:

Name Type Description Default
version tuple[int, int, int] | str | None

Optional version filter. Accepts (major, minor, patch) tuple or a string like "24.1.0" or "24.1".

None
path str | Path | None

Explicit path to EnergyPlus install directory or executable.

None

Returns:

Type Description
EnergyPlusConfig

Validated EnergyPlusConfig.

Raises:

Type Description
EnergyPlusNotFoundError

If no matching installation is found.

Source code in idfkit/simulation/config.py
def find_energyplus(
    *,
    version: tuple[int, int, int] | str | None = None,
    path: str | Path | None = None,
) -> EnergyPlusConfig:
    """Find an EnergyPlus installation.

    Discovery order:
        1. Explicit *path* argument.
        2. ``ENERGYPLUS_DIR`` environment variable.
        3. ``energyplus`` on ``PATH`` (via [shutil.which][]).
        4. Platform-specific default directories (newest version first).

    Args:
        version: Optional version filter. Accepts ``(major, minor, patch)``
            tuple or a string like ``"24.1.0"`` or ``"24.1"``.
        path: Explicit path to EnergyPlus install directory or executable.

    Returns:
        Validated EnergyPlusConfig.

    Raises:
        EnergyPlusNotFoundError: If no matching installation is found.
    """
    target_version = normalize_version(version) if version is not None else None

    # 1. Explicit path
    if path is not None:
        p = Path(path).resolve()
        config = EnergyPlusConfig.from_path(p)
        if target_version is not None and config.version != target_version:
            raise EnergyPlusNotFoundError(
                [str(p)], requested_version=target_version, found=[(config.version, str(config.install_dir))]
            )
        return config

    # 2-4. Try candidates from env var, PATH, and platform dirs
    searched: list[str] = []
    found: dict[Path, EnergyPlusConfig] = {}
    for candidate in _discovery_candidates():
        if str(candidate) in searched:
            continue
        searched.append(str(candidate))
        logger.debug("Trying candidate %s", candidate)
        config = _load_candidate(candidate)
        if config is None:
            continue
        if target_version is None or config.version == target_version:
            logger.info("Found EnergyPlus %d.%d.%d at %s", *config.version, config.install_dir)
            return config
        logger.debug(
            "Skipping EnergyPlus %d.%d.%d at %s: not the version asked for", *config.version, config.install_dir
        )
        found.setdefault(config.install_dir, config)

    raise EnergyPlusNotFoundError(
        searched,
        requested_version=target_version,
        found=[(c.version, str(c.install_dir)) for c in found.values()],
    )

EnergyPlusConfig

idfkit.simulation.config.EnergyPlusConfig dataclass

Validated EnergyPlus installation configuration.

Attributes:

Name Type Description
executable Path

Path to the energyplus executable.

version tuple[int, int, int]

Parsed version as (major, minor, patch).

install_dir Path

Root installation directory.

idd_path Path

Path to the Energy+.idd file.

Source code in idfkit/simulation/config.py
@dataclass(frozen=True, slots=True)
class EnergyPlusConfig:
    """Validated EnergyPlus installation configuration.

    Attributes:
        executable: Path to the energyplus executable.
        version: Parsed version as (major, minor, patch).
        install_dir: Root installation directory.
        idd_path: Path to the Energy+.idd file.
    """

    executable: Path
    version: tuple[int, int, int]
    install_dir: Path
    idd_path: Path

    @property
    def weather_dir(self) -> Path | None:
        """Path to the bundled WeatherData directory, if present."""
        d = self.install_dir / "WeatherData"
        return d if d.is_dir() else None

    @property
    def schema_path(self) -> Path | None:
        """Path to Energy+.schema.epJSON, if present."""
        p = self.install_dir / "Energy+.schema.epJSON"
        return p if p.is_file() else None

    @property
    def expand_objects_exe(self) -> Path | None:
        """Path to ExpandObjects executable, if present."""
        name = "ExpandObjects.exe" if platform.system() == "Windows" else "ExpandObjects"
        p = self.install_dir / name
        return p if p.is_file() else None

    @property
    def _preprocess_dir(self) -> Path:
        """Path to the PreProcess/GrndTempCalc directory."""
        return self.install_dir / "PreProcess" / "GrndTempCalc"

    @property
    def slab_exe(self) -> Path | None:
        """Path to the Slab ground heat-transfer preprocessor, if present."""
        name = "Slab.exe" if platform.system() == "Windows" else "Slab"
        p = self._preprocess_dir / name
        return p if p.is_file() else None

    @property
    def slab_idd(self) -> Path | None:
        """Path to SlabGHT.idd, if present."""
        p = self._preprocess_dir / "SlabGHT.idd"
        return p if p.is_file() else None

    @property
    def basement_exe(self) -> Path | None:
        """Path to the Basement ground heat-transfer preprocessor, if present."""
        name = "Basement.exe" if platform.system() == "Windows" else "Basement"
        p = self._preprocess_dir / name
        return p if p.is_file() else None

    @property
    def basement_idd(self) -> Path | None:
        """Path to BasementGHT.idd, if present."""
        p = self._preprocess_dir / "BasementGHT.idd"
        return p if p.is_file() else None

    @property
    def version_updater_dir(self) -> Path | None:
        """Path to the ``PreProcess/IDFVersionUpdater`` directory, if present.

        This directory houses the per-step ``Transition-VX-to-VY`` binaries
        and the ``VX-Y-Z-Energy+.idd`` files used to migrate IDF models
        between EnergyPlus versions.
        """
        d = self.install_dir / "PreProcess" / "IDFVersionUpdater"
        return d if d.is_dir() else None

    def transition_exe(
        self,
        from_version: tuple[int, int, int],
        to_version: tuple[int, int, int],
    ) -> Path | None:
        """Return the transition binary for a single version step, if present.

        Probes the registry-exact name first, then ``patch=0`` fallbacks so
        callers using version tuples such as ``(9, 0, 1)`` still resolve the
        ``Transition-V8-9-0-to-V9-0-0`` binary that EnergyPlus actually ships.

        Returns:
            Path to the transition binary, or ``None`` if the IDFVersionUpdater
            directory is missing or no matching binary exists.
        """
        from ..migration.subprocess_backend import binary_candidates

        updater_dir = self.version_updater_dir
        if updater_dir is None:
            return None
        for name in binary_candidates(from_version, to_version):
            p = updater_dir / name
            if p.is_file():
                return p
        return None

    def transition_idd(self, version: tuple[int, int, int]) -> Path | None:
        """Return the bundled IDD for *version* inside IDFVersionUpdater, if present.

        The transition binaries load ``V{maj}-{min}-{patch}-Energy+.idd`` from
        the IDFVersionUpdater directory at runtime.
        """
        updater_dir = self.version_updater_dir
        if updater_dir is None:
            return None
        name = f"V{version[0]}-{version[1]}-{version[2]}-Energy+.idd"
        p = updater_dir / name
        return p if p.is_file() else None

    @classmethod
    def from_path(cls, path: str | Path) -> EnergyPlusConfig:
        """Create config from an explicit installation path.

        The path can point to either the installation directory or the
        energyplus executable directly.

        Args:
            path: Path to EnergyPlus install directory or executable.

        Returns:
            Validated EnergyPlusConfig.

        Raises:
            EnergyPlusNotFoundError: If the path is not a valid installation.
        """
        path = Path(path).resolve()

        # If path is an executable, derive install dir
        if path.is_file():
            install_dir = path.parent
            exe = path
        else:
            install_dir = path
            exe_name = "energyplus.exe" if platform.system() == "Windows" else "energyplus"
            exe = install_dir / exe_name

        if not exe.is_file():
            raise EnergyPlusNotFoundError([str(install_dir)])

        idd = install_dir / "Energy+.idd"
        if not idd.is_file():
            raise EnergyPlusNotFoundError([str(install_dir)])

        version = _extract_version(install_dir)
        if version is None:
            version = _extract_version_from_idd(idd)
        if version is None:
            raise EnergyPlusNotFoundError([str(install_dir)])

        return cls(
            executable=exe,
            version=version,
            install_dir=install_dir,
            idd_path=idd,
        )

basement_exe property

Path to the Basement ground heat-transfer preprocessor, if present.

basement_idd property

Path to BasementGHT.idd, if present.

executable instance-attribute

expand_objects_exe property

Path to ExpandObjects executable, if present.

idd_path instance-attribute

install_dir instance-attribute

schema_path property

Path to Energy+.schema.epJSON, if present.

slab_exe property

Path to the Slab ground heat-transfer preprocessor, if present.

slab_idd property

Path to SlabGHT.idd, if present.

version instance-attribute

version_updater_dir property

Path to the PreProcess/IDFVersionUpdater directory, if present.

This directory houses the per-step Transition-VX-to-VY binaries and the VX-Y-Z-Energy+.idd files used to migrate IDF models between EnergyPlus versions.

weather_dir property

Path to the bundled WeatherData directory, if present.

from_path(path) classmethod

Create config from an explicit installation path.

The path can point to either the installation directory or the energyplus executable directly.

Parameters:

Name Type Description Default
path str | Path

Path to EnergyPlus install directory or executable.

required

Returns:

Type Description
EnergyPlusConfig

Validated EnergyPlusConfig.

Raises:

Type Description
EnergyPlusNotFoundError

If the path is not a valid installation.

Source code in idfkit/simulation/config.py
@classmethod
def from_path(cls, path: str | Path) -> EnergyPlusConfig:
    """Create config from an explicit installation path.

    The path can point to either the installation directory or the
    energyplus executable directly.

    Args:
        path: Path to EnergyPlus install directory or executable.

    Returns:
        Validated EnergyPlusConfig.

    Raises:
        EnergyPlusNotFoundError: If the path is not a valid installation.
    """
    path = Path(path).resolve()

    # If path is an executable, derive install dir
    if path.is_file():
        install_dir = path.parent
        exe = path
    else:
        install_dir = path
        exe_name = "energyplus.exe" if platform.system() == "Windows" else "energyplus"
        exe = install_dir / exe_name

    if not exe.is_file():
        raise EnergyPlusNotFoundError([str(install_dir)])

    idd = install_dir / "Energy+.idd"
    if not idd.is_file():
        raise EnergyPlusNotFoundError([str(install_dir)])

    version = _extract_version(install_dir)
    if version is None:
        version = _extract_version_from_idd(idd)
    if version is None:
        raise EnergyPlusNotFoundError([str(install_dir)])

    return cls(
        executable=exe,
        version=version,
        install_dir=install_dir,
        idd_path=idd,
    )

transition_exe(from_version, to_version)

Return the transition binary for a single version step, if present.

Probes the registry-exact name first, then patch=0 fallbacks so callers using version tuples such as (9, 0, 1) still resolve the Transition-V8-9-0-to-V9-0-0 binary that EnergyPlus actually ships.

Returns:

Type Description
Path | None

Path to the transition binary, or None if the IDFVersionUpdater

Path | None

directory is missing or no matching binary exists.

Source code in idfkit/simulation/config.py
def transition_exe(
    self,
    from_version: tuple[int, int, int],
    to_version: tuple[int, int, int],
) -> Path | None:
    """Return the transition binary for a single version step, if present.

    Probes the registry-exact name first, then ``patch=0`` fallbacks so
    callers using version tuples such as ``(9, 0, 1)`` still resolve the
    ``Transition-V8-9-0-to-V9-0-0`` binary that EnergyPlus actually ships.

    Returns:
        Path to the transition binary, or ``None`` if the IDFVersionUpdater
        directory is missing or no matching binary exists.
    """
    from ..migration.subprocess_backend import binary_candidates

    updater_dir = self.version_updater_dir
    if updater_dir is None:
        return None
    for name in binary_candidates(from_version, to_version):
        p = updater_dir / name
        if p.is_file():
            return p
    return None

transition_idd(version)

Return the bundled IDD for version inside IDFVersionUpdater, if present.

The transition binaries load V{maj}-{min}-{patch}-Energy+.idd from the IDFVersionUpdater directory at runtime.

Source code in idfkit/simulation/config.py
def transition_idd(self, version: tuple[int, int, int]) -> Path | None:
    """Return the bundled IDD for *version* inside IDFVersionUpdater, if present.

    The transition binaries load ``V{maj}-{min}-{patch}-Energy+.idd`` from
    the IDFVersionUpdater directory at runtime.
    """
    updater_dir = self.version_updater_dir
    if updater_dir is None:
        return None
    name = f"V{version[0]}-{version[1]}-{version[2]}-Energy+.idd"
    p = updater_dir / name
    return p if p.is_file() else None