Progress¶
Event-based progress tracking for simulations: the SimulationProgress event
passed to on_progress callbacks, and the ProgressParser that turns raw
EnergyPlus stdout into those events.
Simulation progress tracking.
Provides a dataclass for progress events and a parser that extracts structured progress information from EnergyPlus stdout output.
ProgressParser
¶
Parse EnergyPlus stdout lines into SimulationProgress events.
Maintains internal state to track the current environment, warmup iteration count, and simulation day for percentage estimation.
A new instance should be created for each simulation run. The parser
is designed to be defensive — unrecognised lines return None and
never raise.
Examples:
parser = ProgressParser()
for line in energyplus_stdout_lines:
event = parser.parse_line(line)
if event is not None:
print(event.phase, event.percent)
Source code in idfkit/simulation/progress.py
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 | |
parse_line(line)
¶
Parse a single stdout line into a progress event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line
|
str
|
A single line from EnergyPlus stdout. |
required |
Returns:
| Type | Description |
|---|---|
SimulationProgress | None
|
A SimulationProgress event, or |
SimulationProgress | None
|
does not contain progress information. |
Source code in idfkit/simulation/progress.py
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 | |
SimulationProgress
dataclass
¶
Progress event emitted during a single EnergyPlus simulation.
This dataclass represents a progress update parsed from EnergyPlus
stdout output. It is passed to user-supplied on_progress callbacks
on simulate and
async_simulate.
Attributes:
| Name | Type | Description |
|---|---|---|
phase |
Literal['preprocessing', 'initializing', 'warmup', 'simulating', 'postprocessing', 'complete']
|
Current simulation phase. |
message |
str
|
Raw EnergyPlus stdout line (stripped). |
percent |
float | None
|
Estimated completion percentage (0.0-100.0), or |
environment |
str | None
|
Name of the current simulation environment, if known. |
warmup_day |
int | None
|
Current warmup iteration (1-based), only set during
the |
sim_day |
int | None
|
Current simulation day-of-year (1-based), only set during
the |
sim_total_days |
int | None
|
Total number of simulation days, only set when the simulation period is known. |
job_index |
int | None
|
Index of this job in a batch, or |
job_label |
str | None
|
Label of this job in a batch, or |