Static utility class for explicit timestep computation.
More...
#include <TimestepController.hpp>
|
| static constexpr double | SEC_PER_DAY = 86400.0 |
| | Seconds per day (exact).
|
| |
Static utility class for explicit timestep computation.
All methods are pure static functions that operate on a SimulationContext reference. This class has no state.
◆ TimestepController()
| openswmm::hydraulics::TimestepController::TimestepController |
( |
| ) |
|
|
delete |
◆ advance()
| void openswmm::hydraulics::TimestepController::advance |
( |
SimulationContext & | ctx, |
|
|
double | dt_taken ) |
|
staticnoexcept |
Advance internal timers by dt_taken seconds.
Updates:
ctx.current_time += dt_taken (seconds)
ctx.current_date (decompose-recompose from current_time)
ctx.old_elapsed_ms = ctx.elapsed_ms; ctx.elapsed_ms += 1000.0 * dt_taken (legacy ms clock)
ctx.dt_controls_remaining -= dt_taken
- Parameters
-
| ctx | Simulation context (mutated). |
| dt_taken | Timestep just completed, in seconds. |
◆ compute_next()
| double openswmm::hydraulics::TimestepController::compute_next |
( |
const SimulationContext & | ctx, |
|
|
double | dt_cfl ) |
|
staticnoexcept |
Compute the next simulation timestep.
Result is the minimum of:
- time to the next report instant (from ctx.next_report_ms; clamp scheduled for removal by the A2 reporting-parity work)
dt_cfl (CFL-limited hydraulic step from DynamicWave)
ctx.dt_controls_remaining (next control rule event)
ctx.options.routing_step (user-configured max step)
- NOT less than
ctx.options.min_routing_step (minimum floor)
- Parameters
-
| ctx | Simulation context (reads elapsed_ms/next_report_ms, options). |
| dt_cfl | CFL-limited timestep from the DynamicWave solver (seconds). Pass ctx.options.routing_step if not using dynamic wave. |
- Returns
- dt_next in seconds, guaranteed > 0.
- Postcondition
- Return value <= dt_cfl.
-
Return value >= ctx.options.min_routing_step.
◆ output_due()
| bool openswmm::hydraulics::TimestepController::output_due |
( |
const SimulationContext & | ctx | ) |
|
|
staticnoexcept |
Returns true when the clock has reached the next report instant.
Legacy swmm5.c:1019 — NewRoutingTime >= ReportTime, on the ms-accumulated clock (no epsilon; both sides are exact sums of the same ms quantities, as in legacy).
- Parameters
-
- Returns
- true if elapsed_ms >= next_report_ms.
◆ reset_output_timer()
| void openswmm::hydraulics::TimestepController::reset_output_timer |
( |
SimulationContext & | ctx | ) |
|
|
staticnoexcept |
Advance the report grid to the next period.
Legacy swmm5.c:1044 — ReportTime += 1000 * ReportStep. Call after handling a due report period (written or skipped by the REPORT_START gate).
- Parameters
-
| ctx | Simulation context (next_report_ms advanced one period). |
◆ simulation_complete()
| bool openswmm::hydraulics::TimestepController::simulation_complete |
( |
const SimulationContext & | ctx | ) |
|
|
staticnoexcept |
Returns true when the simulation has reached or passed end_time.
- Parameters
-
◆ SEC_PER_DAY
| double openswmm::hydraulics::TimestepController::SEC_PER_DAY = 86400.0 |
|
staticconstexpr |
The documentation for this class was generated from the following files: