Statistics#

Note

Engine: OpenSWMM 6 — refactored.

Bulk views of the per-object cumulative simulation statistics — flooding, max flows, surcharge time, etc. Reach via Solver.statistics.

Single-object access lives on the wrapper sub-views (Node.stats, Link.stats, Subcatchment.stats). This page covers the bulk numpy accessors — the right tool when you want every node’s flooded volume in one C call.

Reference: openswmm_statistics.h.


Bulk numpy properties#

Every property returns a fresh float64 numpy array, shape matching the domain count.

Node stats#

Property

Meaning

node_max_depth

Maximum depth per node.

node_max_overflow

Maximum overflow rate per node.

node_vol_flooded

Cumulative flooded volume per node.

node_time_flooded

Cumulative flooded duration (seconds) per node.

Subcatchment stats#

Property

Meaning

subcatchment_runoff_vol

Cumulative runoff volume per subcatchment.

subcatchment_max_runoff

Peak runoff rate per subcatchment.


Example#

from openswmm.engine import Solver

with Solver("model.inp") as s:
    for _ in s.steps():
        pass
    stats = s.statistics
    worst_flooded = stats.node_vol_flooded.argmax()
    print(f"node {s.nodes.get_id(worst_flooded)} flooded {stats.node_vol_flooded[worst_flooded]:.1f} ft³")

When the values are meaningful#

All of these values are cumulative aggregates finalised at Solver.end(). Reading mid-run yields partial values.


See also#