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 |
|---|---|
|
Maximum depth per node. |
|
Maximum overflow rate per node. |
|
Cumulative flooded volume per node. |
|
Cumulative flooded duration (seconds) per node. |
Link stats#
Property |
Meaning |
|---|---|
|
Maximum flow rate per link. |
|
Maximum velocity per link. |
|
Maximum filling ratio per link. |
|
Cumulative flow volume per link. |
|
Cumulative surcharge duration (seconds) per link. |
Subcatchment stats#
Property |
Meaning |
|---|---|
|
Cumulative runoff volume per subcatchment. |
|
Peak runoff rate per subcatchment. |
|
Cumulative precipitation 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.
Report summary tables#
The summary tables of the .rpt file (Node Depth, Node Inflow, Node
Surcharge, Node Flooding, Storage Volume, Outfall Loading, Link Flow, Flow
Classification, Conduit Surcharge, Pumping and LID Performance) can be read
after Solver.end() and until the solver closes. The engine computes
them with the code that writes the report, so the values are the report’s,
unrounded.
from openswmm.engine import Solver, SummaryObject, SummaryTable
with Solver("model.inp") as s:
for _ in s.steps():
pass
s.end()
table = s.statistics.summary_table(SummaryTable.OUTFALL_LOADING)
print(table.title, [f"{c.name} ({c.units})" for c in table.columns])
for row, values in zip(table.rows, table.values):
name = ("System" if row.object_type == SummaryObject.SYSTEM
else s.nodes.get_id(row.object_index))
print(name, values)
Method |
Returns |
|---|---|
|
A |
|
Every table, in report order, including tables without rows. |
|
One |
|
One value. Each call rebuilds the table, so read whole tables with
|
Rows are in report order. A SYSTEM row (the last row of Outfall Loading)
has object_index -1, and LID Performance rows point at the subcatchment
that holds the unit. Times of maxima are in days from the report start.
Reading a table before the run ends raises LifecycleError.
See also#
Nodes —
Node.statsfor one node at a time.Links —
Link.stats.Subcatchments —
Subcatchment.stats.Mass balance — continuity errors and flux totals.