Skip to content

Simulation options

Use SimulationOptions to configure numerical and analysis choices while the simulation is OPEN or ENDED. Individual assignments and options.update(**changes) use the same atomic native update. Rust checks each value locally, retains the complete requested configuration, and records what needs preparation. The effective solver fields wait until start().

This gives you room to edit related values in several calls. A schedule or step relationship can be temporarily inconsistent while you work. Reads return your requested values, including after a failed start. At start(), the solver prepares effective defaults, step coupling, flags, threads, and dependent hydraulic geometry, then installs them together if preparation succeeds.

If preparation fails, start() raises ConfigurationError with ordered diagnostics and leaves the prior effective state intact. Repair the requested values and retry. requested_threads is what you asked for; simulation.effective_threads is the prepared worker count. Assigning custom_ellipse_model while OPEN or ENDED marks configuration dirty. The next start() revalidates and atomically rebuilds affected cross sections.

Update related dates together with Simulation.update_schedule(**changes). Omitted dates keep their requested values. The setter checks that dates are finite and representable. At start(), the solver checks start/end ordering, positive duration, whether the report start falls at or after the end, and report step coupling. A report start earlier than the requested start is normalized to the effective start instead of producing a diagnostic. Direct date setters use the same operation.

from datetime import datetime, timedelta

simulation.options.update(
    routing_step=timedelta(seconds=20),
    courant_factor=1.0,
    requested_threads=2,
)
simulation.update_schedule(
    start_time=datetime(2025, 1, 1),
    report_start=datetime(2025, 1, 1, 1),
    end_time=datetime(2025, 1, 2),
)

Typed, generation-bound views over configured SWMM project objects.

All view instances retain the simulation and project generation that created them. They validate that identity before accessing native state, so retained views cannot silently address a subsequently reopened project.

CLASS DESCRIPTION
SimulationOptions

Expose typed numerical and analysis policy for one Project Generation.

SimulationOptions

Expose typed numerical and analysis policy for one Project Generation.

Notes

Duration options use datetime.timedelta. Native Rust owns extraction, local validation, declaration commits, deferred preparation, lifecycle, and atomic effective-state commit. Requested values remain readable while the owner is dirty; effective normalization occurs at Simulation.start().

METHOD DESCRIPTION
update

Atomically update mutable simulation policy fields.

ATTRIBUTE DESCRIPTION
allow_ponding

Setter lifecycle: OPEN, ENDED.

TYPE: bool

antecedent_dry_duration

Setter lifecycle: OPEN, ENDED.

TYPE: timedelta

courant_factor

Setter lifecycle: OPEN, ENDED.

TYPE: float

custom_ellipse_model

Hydraulic model for custom ellipses. Setter lifecycle: OPEN, ENDED.

TYPE: CustomEllipseModel

detailed_reporting_enabled

Setter lifecycle: OPEN, ENDED.

TYPE: bool

groundwater_enabled

Setter lifecycle: OPEN, ENDED.

TYPE: bool

head_tolerance

Return the dynamic-wave head-convergence tolerance in length units.

TYPE: float

inertia_damping

Setter lifecycle: OPEN, ENDED.

TYPE: InertiaDamping

lateral_flow_tolerance

Return the lateral-flow continuity tolerance as a percent.

TYPE: float

lengthening_step

Setter lifecycle: OPEN, ENDED.

TYPE: timedelta

maximum_routing_step

Return the effective maximum routing step as a duration.

TYPE: timedelta

maximum_trials

Setter lifecycle: OPEN, ENDED.

TYPE: int

minimum_conduit_slope

Setter lifecycle: OPEN, ENDED.

TYPE: float

minimum_routing_step

Setter lifecycle: OPEN, ENDED.

TYPE: timedelta

minimum_surface_area

Setter lifecycle: OPEN, ENDED.

TYPE: float

normal_flow_limit

Setter lifecycle: OPEN, ENDED.

TYPE: NormalFlowLimit

quality_enabled

Setter lifecycle: OPEN, ENDED.

TYPE: bool

rainfall_enabled

Setter lifecycle: OPEN, ENDED.

TYPE: bool

rdii_enabled

Setter lifecycle: OPEN, ENDED.

TYPE: bool

report_step

Setter lifecycle: OPEN, ENDED.

TYPE: timedelta

requested_threads

Setter lifecycle: OPEN, ENDED.

TYPE: int

routing_enabled

Setter lifecycle: OPEN, ENDED.

TYPE: bool

routing_step

Setter lifecycle: OPEN, ENDED.

TYPE: timedelta

rule_step

Setter lifecycle: OPEN, ENDED.

TYPE: timedelta

skip_steady_state

Setter lifecycle: OPEN, ENDED.

TYPE: bool

snowmelt_enabled

Setter lifecycle: OPEN, ENDED.

TYPE: bool

surcharge_method

Setter lifecycle: OPEN, ENDED.

TYPE: SurchargeMethod

sweep_end

Setter lifecycle: OPEN, ENDED.

TYPE: tuple[int, int]

sweep_start

Setter lifecycle: OPEN, ENDED.

TYPE: tuple[int, int]

system_flow_tolerance

Return the system-flow continuity tolerance as a percent.

TYPE: float

allow_ponding property writable

allow_ponding: bool

Setter lifecycle: OPEN, ENDED.

antecedent_dry_duration property writable

antecedent_dry_duration: timedelta

Setter lifecycle: OPEN, ENDED.

courant_factor property writable

courant_factor: float

Setter lifecycle: OPEN, ENDED.

custom_ellipse_model property writable

custom_ellipse_model: CustomEllipseModel

Hydraulic model for custom ellipses. Setter lifecycle: OPEN, ENDED.

detailed_reporting_enabled property writable

detailed_reporting_enabled: bool

Setter lifecycle: OPEN, ENDED.

groundwater_enabled property writable

groundwater_enabled: bool

Setter lifecycle: OPEN, ENDED.

head_tolerance property

head_tolerance: float

Return the dynamic-wave head-convergence tolerance in length units.

inertia_damping property writable

inertia_damping: InertiaDamping

Setter lifecycle: OPEN, ENDED.

lateral_flow_tolerance property

lateral_flow_tolerance: float

Return the lateral-flow continuity tolerance as a percent.

lengthening_step property writable

lengthening_step: timedelta

Setter lifecycle: OPEN, ENDED.

maximum_routing_step property

maximum_routing_step: timedelta

Return the effective maximum routing step as a duration.

maximum_trials property writable

maximum_trials: int

Setter lifecycle: OPEN, ENDED.

minimum_conduit_slope property writable

minimum_conduit_slope: float

Setter lifecycle: OPEN, ENDED.

minimum_routing_step property writable

minimum_routing_step: timedelta

Setter lifecycle: OPEN, ENDED.

minimum_surface_area property writable

minimum_surface_area: float

Setter lifecycle: OPEN, ENDED.

normal_flow_limit property writable

normal_flow_limit: NormalFlowLimit

Setter lifecycle: OPEN, ENDED.

quality_enabled property writable

quality_enabled: bool

Setter lifecycle: OPEN, ENDED.

rainfall_enabled property writable

rainfall_enabled: bool

Setter lifecycle: OPEN, ENDED.

rdii_enabled property writable

rdii_enabled: bool

Setter lifecycle: OPEN, ENDED.

report_step property writable

report_step: timedelta

Setter lifecycle: OPEN, ENDED.

requested_threads property writable

requested_threads: int

Setter lifecycle: OPEN, ENDED.

routing_enabled property writable

routing_enabled: bool

Setter lifecycle: OPEN, ENDED.

routing_step property writable

routing_step: timedelta

Setter lifecycle: OPEN, ENDED.

rule_step property writable

rule_step: timedelta

Setter lifecycle: OPEN, ENDED.

skip_steady_state property writable

skip_steady_state: bool

Setter lifecycle: OPEN, ENDED.

snowmelt_enabled property writable

snowmelt_enabled: bool

Setter lifecycle: OPEN, ENDED.

surcharge_method property writable

surcharge_method: SurchargeMethod

Setter lifecycle: OPEN, ENDED.

sweep_end property writable

sweep_end: tuple[int, int]

Setter lifecycle: OPEN, ENDED.

sweep_start property writable

sweep_start: tuple[int, int]

Setter lifecycle: OPEN, ENDED.

system_flow_tolerance property

system_flow_tolerance: float

Return the system-flow continuity tolerance as a percent.

update

update(**changes: object) -> None

Atomically update mutable simulation policy fields.