Low-impact development
Use unit.update(**changes) to edit a subcatchment's configured LidUnit
properties together. Every optional LID-control layer also has
update(**changes), and individual property assignments use the same atomic
native operation. Invalid scalar values fail immediately. The next start()
checks process, group, and subcatchment relationships together.
from swmmrs import Simulation
with Simulation("model.inp", "model.rpt") as simulation:
unit = simulation.subcatchments["S-1"].lid_units[0]
unit.update(
area=500.0,
full_width=25.0,
initial_saturation=0.20,
routes_to_pervious=True,
drain_destination=simulation.nodes["J-1"],
)
control = unit.control
surface = control.surface
if surface is not None:
surface.update(thickness=0.25, roughness=0.15, slope=0.01)
surface.roughness = 0.20 # Scalar assignment uses the same update approach.
The solver handles reads, value conversion, relationship identity, allowed
lifecycle states, and atomic updates. Derived layer values and runtime
snapshots are read-only. Keeping a view of an optional layer does not keep the
layer in existence: access raises StaleViewError while that layer is absent.
from swmmrs import Simulation, StaleViewError
with Simulation("model.inp", "model.rpt") as simulation:
control = simulation.lid_controls["BIORETENTION"]
soil = control.soil
if soil is not None: # Layers depend on the configured LID process.
soil.update(porosity=0.45, field_capacity=0.20, wilting_point=0.10)
try:
if soil is not None:
print(soil.thickness)
except StaleViewError:
# Reacquire the optional slot after configuration changes.
soil = control.soil
Stable LID declarations are writable only while the simulation is Open or
Ended; every LID write is rejected while Running. Requested
routes_to_pervious and implicit drain intent remain visible while dirty, while
prepared alpha, overflow, bottom width, and runtime snapshots continue to
represent the last successful preparation or run.
from swmmrs import Simulation
with Simulation("model.inp", "model.rpt") as simulation:
unit = simulation.subcatchments["S-1"].lid_units[0]
unit.update(routes_to_pervious=True, drain_destination=None)
assert unit.routes_to_pervious is True # Requested intent is visible while dirty.
simulation.start()
surface = unit.control.surface
if surface is not None:
print(surface.alpha, surface.immediate_overflow) # Prepared, read-only values.
print(unit.bottom_width) # Prepared unit geometry is also read-only.
while simulation.step() is not None:
runtime = unit.snapshot() # Owned point-in-time runtime values.
print(runtime)
simulation.end()
unit.area = 450.0 # Stable declarations are writable again in Ended.
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 |
|---|---|
LidControl |
Expose the configured layers of one generation-bound LID control. |
LidSurfaceLayer |
Expose one configured LID surface layer. |
LidSoilLayer |
Expose one configured LID soil layer. |
LidStorageLayer |
Expose one configured LID storage layer. |
LidPavementLayer |
Expose one configured LID pavement layer. |
LidDrainLayer |
Expose one configured LID drain layer. |
LidDrainageMatLayer |
Expose one configured LID drainage-mat layer. |
LidUnitCollection |
Provide indexed access to a subcatchment's LID units. |
LidUnit |
Expose one LID unit owned by a subcatchment. |
LidControl
flowchart TD
swmmrs.objects.LidControl[LidControl]
swmmrs.objects._base._LiveView[_LiveView]
swmmrs.objects._base._LiveView --> swmmrs.objects.LidControl
click swmmrs.objects.LidControl href "" "swmmrs.objects.LidControl"
click swmmrs.objects._base._LiveView href "" "swmmrs.objects._base._LiveView"
Expose the configured layers of one generation-bound LID control.
A layer property returns None when that layer is not part of the
control's configured LID process.
| ATTRIBUTE | DESCRIPTION |
|---|---|
drain |
Return the configured underdrain layer, if present.
TYPE:
|
drainage_mat |
Return the configured drainage-mat layer, if present.
TYPE:
|
pavement |
Return the configured pavement layer, if present.
TYPE:
|
soil |
Return the configured soil layer, if present.
TYPE:
|
storage |
Return the configured storage layer, if present.
TYPE:
|
surface |
Return the configured surface layer, if present.
TYPE:
|
drainage_mat
property
drainage_mat: LidDrainageMatLayer | None
Return the configured drainage-mat layer, if present.
pavement
property
pavement: LidPavementLayer | None
Return the configured pavement layer, if present.
LidSurfaceLayer
flowchart TD
swmmrs.objects.LidSurfaceLayer[LidSurfaceLayer]
swmmrs.objects._lids._LidLayer[_LidLayer]
swmmrs.objects._lids._LidLayer --> swmmrs.objects.LidSurfaceLayer
click swmmrs.objects.LidSurfaceLayer href "" "swmmrs.objects.LidSurfaceLayer"
click swmmrs.objects._lids._LidLayer href "" "swmmrs.objects._lids._LidLayer"
Expose one configured LID surface layer.
| METHOD | DESCRIPTION |
|---|---|
update |
Commit requested layer values atomically in |
| ATTRIBUTE | DESCRIPTION |
|---|---|
alpha |
Return the derived surface runoff coefficient in project units.
TYPE:
|
immediate_overflow |
Return whether ponded surface water overflows without delay.
TYPE:
|
roughness |
Setter lifecycle:
TYPE:
|
side_slope |
Setter lifecycle:
TYPE:
|
slope |
Setter lifecycle:
TYPE:
|
thickness |
Setter lifecycle:
TYPE:
|
vegetation_volume_fraction |
Setter lifecycle:
TYPE:
|
immediate_overflow
property
immediate_overflow: bool
Return whether ponded surface water overflows without delay.
vegetation_volume_fraction
property
writable
vegetation_volume_fraction: float
Setter lifecycle: OPEN, ENDED.
update
update(**changes: object) -> None
Commit requested layer values atomically in OPEN or ENDED.
Intrinsic scalar errors fail immediately. Coupled layer, process, and
LID-group relationships are validated during the next start().
LidSoilLayer
flowchart TD
swmmrs.objects.LidSoilLayer[LidSoilLayer]
swmmrs.objects._lids._LidLayer[_LidLayer]
swmmrs.objects._lids._LidLayer --> swmmrs.objects.LidSoilLayer
click swmmrs.objects.LidSoilLayer href "" "swmmrs.objects.LidSoilLayer"
click swmmrs.objects._lids._LidLayer href "" "swmmrs.objects._lids._LidLayer"
Expose one configured LID soil layer.
| METHOD | DESCRIPTION |
|---|---|
update |
Commit requested layer values atomically in |
| ATTRIBUTE | DESCRIPTION |
|---|---|
conductivity_slope |
Setter lifecycle:
TYPE:
|
field_capacity |
Setter lifecycle:
TYPE:
|
porosity |
Setter lifecycle:
TYPE:
|
saturated_conductivity |
Setter lifecycle:
TYPE:
|
suction_head |
Setter lifecycle:
TYPE:
|
thickness |
Setter lifecycle:
TYPE:
|
wilting_point |
Setter lifecycle:
TYPE:
|
saturated_conductivity
property
writable
saturated_conductivity: float
Setter lifecycle: OPEN, ENDED.
update
update(**changes: object) -> None
Commit requested layer values atomically in OPEN or ENDED.
Intrinsic scalar errors fail immediately. Coupled layer, process, and
LID-group relationships are validated during the next start().
LidStorageLayer
flowchart TD
swmmrs.objects.LidStorageLayer[LidStorageLayer]
swmmrs.objects._lids._LidLayer[_LidLayer]
swmmrs.objects._lids._LidLayer --> swmmrs.objects.LidStorageLayer
click swmmrs.objects.LidStorageLayer href "" "swmmrs.objects.LidStorageLayer"
click swmmrs.objects._lids._LidLayer href "" "swmmrs.objects._lids._LidLayer"
Expose one configured LID storage layer.
| METHOD | DESCRIPTION |
|---|---|
update |
Commit requested layer values atomically in |
| ATTRIBUTE | DESCRIPTION |
|---|---|
clogging_factor |
Setter lifecycle:
TYPE:
|
saturated_conductivity |
Setter lifecycle:
TYPE:
|
thickness |
Setter lifecycle:
TYPE:
|
void_ratio |
Setter lifecycle:
TYPE:
|
saturated_conductivity
property
writable
saturated_conductivity: float
Setter lifecycle: OPEN, ENDED.
update
update(**changes: object) -> None
Commit requested layer values atomically in OPEN or ENDED.
Intrinsic scalar errors fail immediately. Coupled layer, process, and
LID-group relationships are validated during the next start().
LidPavementLayer
flowchart TD
swmmrs.objects.LidPavementLayer[LidPavementLayer]
swmmrs.objects._lids._LidLayer[_LidLayer]
swmmrs.objects._lids._LidLayer --> swmmrs.objects.LidPavementLayer
click swmmrs.objects.LidPavementLayer href "" "swmmrs.objects.LidPavementLayer"
click swmmrs.objects._lids._LidLayer href "" "swmmrs.objects._lids._LidLayer"
Expose one configured LID pavement layer.
| METHOD | DESCRIPTION |
|---|---|
update |
Commit requested layer values atomically in |
| ATTRIBUTE | DESCRIPTION |
|---|---|
clogging_factor |
Setter lifecycle:
TYPE:
|
impervious_fraction |
Setter lifecycle:
TYPE:
|
regeneration_fraction |
Setter lifecycle:
TYPE:
|
regeneration_interval |
Setter lifecycle:
TYPE:
|
saturated_conductivity |
Setter lifecycle:
TYPE:
|
thickness |
Setter lifecycle:
TYPE:
|
void_ratio |
Setter lifecycle:
TYPE:
|
regeneration_interval
property
writable
regeneration_interval: timedelta
Setter lifecycle: OPEN, ENDED.
saturated_conductivity
property
writable
saturated_conductivity: float
Setter lifecycle: OPEN, ENDED.
update
update(**changes: object) -> None
Commit requested layer values atomically in OPEN or ENDED.
Intrinsic scalar errors fail immediately. Coupled layer, process, and
LID-group relationships are validated during the next start().
LidDrainLayer
flowchart TD
swmmrs.objects.LidDrainLayer[LidDrainLayer]
swmmrs.objects._lids._LidLayer[_LidLayer]
swmmrs.objects._lids._LidLayer --> swmmrs.objects.LidDrainLayer
click swmmrs.objects.LidDrainLayer href "" "swmmrs.objects.LidDrainLayer"
click swmmrs.objects._lids._LidLayer href "" "swmmrs.objects._lids._LidLayer"
Expose one configured LID drain layer.
| METHOD | DESCRIPTION |
|---|---|
update |
Commit requested layer values atomically in |
| ATTRIBUTE | DESCRIPTION |
|---|---|
close_head |
Setter lifecycle:
TYPE:
|
coefficient |
Setter lifecycle:
TYPE:
|
control_curve |
Return the configured underdrain control curve, if one is assigned.
TYPE:
|
delay |
Setter lifecycle:
TYPE:
|
exponent |
Setter lifecycle:
TYPE:
|
offset |
Setter lifecycle:
TYPE:
|
open_head |
Setter lifecycle:
TYPE:
|
control_curve
property
control_curve: Curve | None
Return the configured underdrain control curve, if one is assigned.
update
update(**changes: object) -> None
Commit requested layer values atomically in OPEN or ENDED.
Intrinsic scalar errors fail immediately. Coupled layer, process, and
LID-group relationships are validated during the next start().
LidDrainageMatLayer
flowchart TD
swmmrs.objects.LidDrainageMatLayer[LidDrainageMatLayer]
swmmrs.objects._lids._LidLayer[_LidLayer]
swmmrs.objects._lids._LidLayer --> swmmrs.objects.LidDrainageMatLayer
click swmmrs.objects.LidDrainageMatLayer href "" "swmmrs.objects.LidDrainageMatLayer"
click swmmrs.objects._lids._LidLayer href "" "swmmrs.objects._lids._LidLayer"
Expose one configured LID drainage-mat layer.
| METHOD | DESCRIPTION |
|---|---|
update |
Commit requested layer values atomically in |
| ATTRIBUTE | DESCRIPTION |
|---|---|
alpha |
Return the derived drainage-mat runoff coefficient in project units.
TYPE:
|
roughness |
Setter lifecycle:
TYPE:
|
thickness |
Setter lifecycle:
TYPE:
|
void_fraction |
Setter lifecycle:
TYPE:
|
update
update(**changes: object) -> None
Commit requested layer values atomically in OPEN or ENDED.
Intrinsic scalar errors fail immediately. Coupled layer, process, and
LID-group relationships are validated during the next start().
LidUnitCollection
flowchart TD
swmmrs.objects.LidUnitCollection[LidUnitCollection]
click swmmrs.objects.LidUnitCollection href "" "swmmrs.objects.LidUnitCollection"
Provide indexed access to a subcatchment's LID units.
LidUnit
Expose one LID unit owned by a subcatchment.
| METHOD | DESCRIPTION |
|---|---|
snapshot |
Copy current LID Unit runtime values in configured project units. |
update |
Commit requested LID-unit values atomically in |
| ATTRIBUTE | DESCRIPTION |
|---|---|
area |
Setter lifecycle:
TYPE:
|
bottom_width |
Return the LID unit's bottom width in project length units.
TYPE:
|
control |
Setter lifecycle:
TYPE:
|
count |
Setter lifecycle:
TYPE:
|
drain_destination |
Return explicit drain intent; setter lifecycle:
TYPE:
|
full_width |
Setter lifecycle:
TYPE:
|
impervious_runoff_treated |
Setter lifecycle:
TYPE:
|
index |
Return the generation-bound position within the owning subcatchment.
TYPE:
|
initial_saturation |
Setter lifecycle:
TYPE:
|
pervious_runoff_treated |
Setter lifecycle:
TYPE:
|
routes_to_pervious |
Return requested routing intent; setter lifecycle:
TYPE:
|
bottom_width
property
bottom_width: float
Return the LID unit's bottom width in project length units.
drain_destination
property
writable
drain_destination: Node | Subcatchment | None
Return explicit drain intent; setter lifecycle: OPEN, ENDED.
None requests an implicit drain that follows the prospective
subcatchment outlet during Configuration Preparation.
impervious_runoff_treated
property
writable
impervious_runoff_treated: float
Setter lifecycle: OPEN, ENDED.
pervious_runoff_treated
property
writable
pervious_runoff_treated: float
Setter lifecycle: OPEN, ENDED.
routes_to_pervious
property
writable
routes_to_pervious: bool
Return requested routing intent; setter lifecycle: OPEN, ENDED.
Preparation can force the native effective value off while a subcatchment has no pervious area without overwriting this request.
snapshot
Copy current LID Unit runtime values in configured project units.
update
update(**changes: object) -> None
Commit requested LID-unit values atomically in OPEN or ENDED.
Intrinsic errors fail immediately. Group area, capture, routing, drain,
infiltration, and subcatchment relationships are prepared at start().