Skip to content
Preview.inp@modelscript/swmm 13 diagnostic rules
Parser WASM GLR
Diagnostics 13 rules
DAE Arena Lowering
Simulation Native Solvers
Projections Modelica
Live ExampleUrbanWatershedDetention.inp

EPA SWMM Urban Stormwater Watershed & Detention Basin

Hydrologic-hydraulic urban drainage deck with impervious subcatchments, manholes, gravity storm conduits, detention storage unit, and outfall.

Playground
Source (23 lines)
1[TITLE]
2Urban Stormwater Detention & Gravity Outfall Network
3 
4[SUBCATCHMENTS]
5;;Name    RainGage  Outlet   Area   %Imperv  Width   Slope
6S_North   RG1       J1       14.5   68.0     220.0   1.8
7S_South   RG1       J2       19.2   54.0     260.0   1.4
8 
9[JUNCTIONS]
10;;Name    Elevation  MaxDepth  InitDepth
11J1        108.5      3.2       0.0
12J2        104.2      3.5       0.0
13J3        100.8      3.5       0.0
14 
15[OUTFALLS]
16;;Name    Elevation  Type
17OUT_River 96.5       FREE
18 
19[CONDUITS]
20;;Name    FromNode   ToNode     Length   Roughness
21C_Upper   J1         J2         210.0    0.013
22C_Mid     J2         J3         185.0    0.013
23C_Out     J3         OUT_River  160.0    0.013
EPA SWMM Stormwater Network Schematic
Urban Stormwater Detention & Gravity Outfall Network ModelScript 2D Conveyance Network Conduit: C_UPPER 210m C_UPPER Conduit: C_MID 185m C_MID Conduit: C_OUT 160m C_OUT J1 Junction: J1 (Elev: 108.5m) J2 Junction: J2 (Elev: 104.2m) J3 Junction: J3 (Elev: 100.8m) OUT_RIVER Outfall: OUT_RIVER (FREE) Capacity (Q/Q_full): < 80% 80-100% > 100% (Surcharge)
Drag to pan · Click % to reset

EPA SWMM Stormwater & Urban Hydrology (.inp) ​

@modelscript/swmm (languages/swmm) provides zero-regex parsing, 1D Saint-Venant dynamic wave hydraulic routing, DAE lowering, and Modelica 3.x projection for US EPA Stormwater Management Model (SWMM 5.x) urban drainage, sewer collection, and flood mitigation networks.


Supported Extensions & Standards ​

ExtensionFormatDescription
.inpEPA SWMM Input FileIndustry-standard stormwater network deck (junctions, conduits, outfalls, subcatchments, pumps, weirs, orifices)

Key Capabilities ​

1. 1D Saint-Venant Dynamic Wave Routing ​

  • Models open-channel and pressurized sewer hydraulics via the one-dimensional Saint-Venant equations of unsteady flow:
    • Conservation of Mass (Continuity):∂A∂t+∂Q∂x=qlateral
    • Conservation of Momentum:∂Q∂t+∂∂x(Q2A)+gA∂H∂x+gASf=0where H=z+d is hydraulic head, Sf is friction slope, and S0 is conduit bed slope.
  • Uses Manning's open-channel equation for friction slope:Q=kmnARh2/3Sf1/2⟹Sf=n2Q|Q|km2A2Rh4/3where n is Manning roughness, A is flow cross-sectional area, and Rh=A/Pwetted is hydraulic radius.
  • Junctions & Storage Units: Continuous water stage mass conservation:AnodedHidt=∑Qin−∑Qout+Qinflow−Qflood
  • Conduits: Circular, rectangular, trapezoidal, and irregular natural river cross-sections with entrance/exit minor head loss coefficients.
  • Outfalls: Free, normal, tidal, and fixed water elevation boundary conditions.
  • Regulators: Orifices, transverse/side-flow weirs, and variable-speed lift pumps.

3. Direct DAE Lowering ​

  • Compiles the entire stormwater collection network into @modelscript/runtime's DAEBuilder struct-of-arrays linear memory arena.
  • Enables co-simulation of municipal drinking water networks (@modelscript/epanet) and drainage networks within the same computational arena.

4. Bidirectional Modelica 3.x Projection ​

  • Projects SWMM nodes and channels into Modelica.Fluid open-channel tanks, flow conduits, and boundary reservoirs.

Pre-Flight Diagnostics ​

The SWMM linter verifies network graph integrity and hydraulic feasibility before simulation:

13 rules10 error3 warning Run with msx swmm lint

CodeRuleSeverityMessage
M8201dangling-node-referenceerrorLink '<linkId>' references undefined <role> node '<nodeId>'.
M8202adverse-conduit-slopewarningConduit '<conduitId>' has adverse slope: inlet elevation (<value>) is lower than outlet elevation (<value>).
M8203missing-cross-sectionerrorConduit '<conduitId>' has no hydraulic cross-section definition in '[XSECTIONS]'.
M8204unsupported-outfall-typeerrorOutfall '<outfallId>' specifies unsupported boundary condition type '<type>'.
M8205surcharge-overflow-riskwarningJunction '<junctionId>' rim elevation (<value>) is lower than connected conduit crown (<value>), creating surcharge overflow risk.
M8206duplicate-node-iderrorDuplicate node identifier '<nodeId>' declared in network.
M8207duplicate-link-iderrorDuplicate link identifier '<linkId>' declared in network.
M8208negative-roughnesserrorConduit '<conduitId>' specifies non-positive Manning's roughness coefficient (n = <n>).
M8209zero-length-conduiterrorConduit '<conduitId>' specifies non-positive length (<len>).
M8210isolated-network-nodewarningJunction '<nodeId>' has no connected conduits or hydraulic links (isolated node).
M8211subcatchment-outlet-not-founderrorSubcatchment '<subId>' references non-existent discharge outlet '<outletId>'.
M8212weir-offset-negativeerrorWeir '<weirId>' specifies negative crest height offset (<offset>).
M8213invalid-discharge-coefficienterrorLink '<linkId>' specifies non-positive discharge coefficient (Cd = <cd>).

Generated from languages/swmm/src/errors.ts. All languages →


CLI Usage ​

bash
# Inspect junctions, conduits, outfalls, and subcatchments
msx swmm inspect UrbanDrainage.inp

# Run pre-flight semantic diagnostics
msx swmm lint UrbanDrainage.inp

# Route steady-state hydraulic flow using Manning formulation
msx swmm route-flow UrbanDrainage.inp

# Lower network topology into ModelScript linear DAE arena
msx swmm to-dae UrbanDrainage.inp

# Project into Modelica 3.x fluid network components
msx swmm to-modelica UrbanDrainage.inp -o StormwaterNetwork.mo

Open-Core under the GNU AGPL v3 License; Enterprise Edition (ee/) under the ModelScript Enterprise License. • Trademark Policy