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, extra_args=None, cache=None, fs=None, on_progress=None)
¶
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). |
3600.0
|
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
|
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. |
Source code in src/idfkit/simulation/runner.py
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 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 | |
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 src/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 src/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 | |