Runner API¶
Core simulation execution functions.
simulate¶
idfkit.simulation.runner.simulate(model, weather, *, 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)
¶
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
|
IDFDocument
|
The EnergyPlus model to simulate. |
required |
weather
|
str | Path
|
Path to the weather file (.epw). |
required |
output_dir
|
str | Path | None
|
Directory for output files (default: auto temp dir). |
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
|
annual
|
bool
|
Run annual simulation ( |
False
|
design_day
|
bool
|
Run design-day-only simulation ( |
False
|
output_prefix
|
str
|
Prefix for output files (default "eplus"). |
'eplus'
|
output_suffix
|
Literal['C', 'L', 'D']
|
Output file naming suffix: |
'C'
|
readvars
|
bool
|
Run ReadVarsESO after simulation ( |
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
|
extra_args
|
list[str] | None
|
Additional command-line arguments. |
None
|
cache
|
SimulationCache | None
|
Optional simulation cache for content-hash lookups. |
None
|
fs
|
FileSystem | None
|
Optional file system backend for storing results on remote
storage (e.g., S3). When provided, Note The |
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
|
None
|
auto_migrate
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
SimulationResult
|
SimulationResult with paths to output files. |
Raises:
| Type | Description |
|---|---|
SimulationError
|
On timeout, OS error, or missing weather file. |
ExpandObjectsError
|
If a preprocessing step (ExpandObjects, Slab, or Basement) fails during automatic preprocessing. |
EnergyPlusNotFoundError
|
If EnergyPlus cannot be found. |
VersionMismatchError
|
If |
Source code in idfkit/simulation/runner.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
find_energyplus¶
idfkit.simulation.config.find_energyplus(*, version=None, path=None)
¶
Find an EnergyPlus installation.
Discovery order
- Explicit path argument.
ENERGYPLUS_DIRenvironment variable.energyplusonPATH(via shutil.which).- Platform-specific default directories (newest version first).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
tuple[int, int, int] | str | None
|
Optional version filter. Accepts |
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
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
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
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
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 |
Path | None
|
directory is missing or no matching binary exists. |
Source code in idfkit/simulation/config.py
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.