SWMM3 Weir Extran4 Test File for AI, GitHub, SWMM5, ICM

The SWMM3 Weir Test File: A Historical Reference for Modern Hydraulic Modeling

This test file holds special historical significance in the development of stormwater modeling. Originally published in the 1981 EXTRAN 3 manual by CDM (now CDM Smith), it was specifically designed to validate orifice calculations in hydraulic networks. The file served as a critical quality assurance tool during the evolution of SWMM, supporting the transition from SWMM3 through SWMM4 and into the current SWMM5.

I documented this file's importance in a 2009 Posthaven blog post, which I have updated using various AI tools to maintain its relevance. Today, this historical test case continues to prove valuable across multiple modern modeling platforms, such as ICM SWMM—as an example. It is also on the EPA GitHub as a test model.

This Example 4 from the Extran Manual was an excellent test model for SWMM back in the early 1980s precisely because it combined several challenging hydraulic elements (multiple inflows, a weir, dynamic wave routing) into a relatively compact network that could be run on what were then very limited computer resources (we used punch cards or terminals and a mainframe computer at UF). At the time, personal computers were not invented for SWMM3, and while they existed by the time of SWMM4, they were slow, and large‐memory mainframes were not readily accessible to most modelers, so every model had to be small enough to fit into limited RAM and run in a feasible amount of CPU time. Yet this example still demonstrated SWMM’s powerful capability to capture unsteady flow conditions—like surcharging, backwater effects, and control structures—in one integrated simulation. The inclusion of a weir, various pipe shapes, and multiple inflow hydrographs showcased SWMM’s flexibility to handle both standard conveyance links and special hydraulic controls, confirming that dynamic wave routing could be effectively computed given the technology of the day. Overall, it illustrated that, despite modest hardware and software constraints, SWMM was already advanced enough to handle complex urban drainage systems, laying the groundwork for today’s much larger and more detailed models.

Yet this example still demonstrated SWMM’s powerful capability to capture unsteady flow conditions—like surcharging, backwater effects, and control structures—in one integrated simulation.

Example Real-Time Control (RTC) rule for a Weir in SWMM5

RULE Orifice1
IF SIMULATION CLOCKTIME >=  01:00:00
AND SIMULATION CLOCKTIME <=  2:00:00
THEN ORIFICE OR1@82309b-15009b SETTING = 1
ELSE ORIFICE OR1@82309b-15009b SETTING = 0
PRIORITY 1
; Opens up the orifice at hour 1 of the simulation

Explanation of Components:

  1. RULE Orifice1:
  2. IF SIMULATION CLOCKTIME >= 01:00:00:
  3. AND SIMULATION CLOCKTIME <= 2:00:00:
  4. THEN ORIFICE OR1@82309b-15009b SETTING = 1:
  5. ELSE ORIFICE OR1@82309b-15009b SETTING = 0:
  6. PRIORITY 1:
  7. ; Opens up the orifice at hour 1 of the simulation:
    Functionality:

This rule effectively opens the orifice "OR1@82309b-15009b" fully at 1:00:00 AM (one hour into the simulation) and keeps it open until 2:00:00 AM. After 2:00:00 AM, the orifice is fully closed.

Variations, Improvements, and Considerations:

  1. Partial Opening:
  2. Time-Based Gradual Opening/Closing:
  3. Sensor-Based Control:
  4. Multiple Conditions:
  5. Multiple Orifices:
  6. Rule Interaction
  7. Saving RTC Rules:
    • RTC rules are typically written in a separate text file (e.g., "rules.txt") and then referenced in the SWMM5 input file (.inp) under the [RULES] section. You would add a line like: [RULES] FILE "rules.txt" Or you can paste the rules directly into the [RULES] section of the .inp file.
      Example of a More Advanced Rule (Conceptual)

Let's say you want to implement a rule that mimics a PID (Proportional-Integral-Derivative) controller to maintain a target water level in a storage unit by adjusting an orifice:


;----------------------------------------------------
; 1) Depth-based control at an upstream node
;    If Node 82309’s water depth exceeds 5 ft,
;    fully open the weir. Otherwise, partially close it.
;----------------------------------------------------
RULE R1
  IF NODE 82309 DEPTH > 5.0
  THEN WEIR 90010 SETTING = 1.0
  ELSE WEIR 90010 SETTING = 0.5
  PRIORITY 1

;----------------------------------------------------
; 2) Flow-based control on an upstream link
;    If Link 8060 flow exceeds 20 cfs, fully open the weir;
;    else keep it half-open.
;----------------------------------------------------
RULE R2
  IF LINK 8060 FLOW > 20.0
  THEN WEIR 90010 SETTING = 1.0
  ELSE WEIR 90010 SETTING = 0.5
  PRIORITY 2

;----------------------------------------------------
; 3) Time-of-day control
;    From 06:00 to 10:00, close the weir;
;    otherwise open it fully.
;----------------------------------------------------
RULE R3
  IF SIMULATION CLOCKTIME >= 06:00
  AND SIMULATION CLOCKTIME < 10:00
  THEN WEIR 90010 SETTING = 0.0
  ELSE WEIR 90010 SETTING = 1.0
  PRIORITY 3

;----------------------------------------------------
; 4) Date-based control
;    During the month of June, open the weir fully;
;    otherwise keep it partially closed.
;----------------------------------------------------
RULE R4
  IF SIMULATION MONTH = 6
  THEN WEIR 90010 SETTING = 1.0
  ELSE WEIR 90010 SETTING = 0.3
  PRIORITY 4

;----------------------------------------------------
; 5) Day-of-week control
;    On weekends (Saturday=7 or Sunday=1 in SWMM’s system),
;    reduce weir setting by 50%, else keep it fully open.
;----------------------------------------------------
RULE R5
  IF SIMULATION DAY = 7
  OR SIMULATION DAY = 1
  THEN WEIR 90010 SETTING = 0.5
  ELSE WEIR 90010 SETTING = 1.0
  PRIORITY 5

;----------------------------------------------------
; 6) Multiple conditions combined
;    Example: If Node 82309 depth > 6.0 ft AND Link 8060 flow > 25 cfs,
;    THEN open the weir fully. Otherwise, keep it at 0.75.
;----------------------------------------------------
RULE R6
  IF NODE 82309 DEPTH > 6.0
  AND LINK 8060 FLOW > 25.0
  THEN WEIR 90010 SETTING = 1.0
  ELSE WEIR 90010 SETTING = 0.75
  PRIORITY 6

;----------------------------------------------------
; 7) System-wide flow control
;    If the total system outflow (SYSTEM FLOW) exceeds 200 cfs,
;    close the weir. Otherwise, open it.
;----------------------------------------------------
RULE R7
  VARIABLE  Q8040 = LINK 8040 FLOW
  VARIABLE  Q8100 = LINK 8100 FLOW
  EXPRESSION Net_Inflow = Q8100 + Q8040
  IF Net_Inflow  > 90
  THEN WEIR 90010 SETTING = 0.0
  ELSE WEIR 90010 SETTING = 1.0
  PRIORITY 7

Minimize image

Edit image

Delete image

RTC SWMM5 version of the original SWMM3 Model

Summary of of the Input FIle

Project Configuration Analysis:

  1. Hydraulic Routing Parameters
    • Flow Units: CFS (cubic feet per second)
    • Routing Method: Dynamic Wave with the following specifications: Inertial Damping: None Normal Flow Limited: Both upstream and downstream Force Main Equation: Hazen-Williams Head Tolerance: Default configuration System Flow Tolerance: 5 Lateral Flow Tolerance: 5
  2. Temporal Configuration
    • Simulation Period: 01/01/2002 00:00:00 to 01/01/2002 08:00:00
    • Critical Time Steps: Reporting Interval: 15 minutes Wet Weather Step: 15 minutes Routing Step: 20 seconds Rule Step: 0 seconds (continuous evaluation)

Network Infrastructure Components:

  1. Node Configuration
    • 9 Junctions with elevations ranging from 101.6 to 128.2 ft
    • 1 Free outfall at elevation 89.9 ft
    • Maximum junction depth range: 8.8 to 42.7 ft
  2. Conveyance System
    • 9 Conduits with varying characteristics: Diameters: 4.0 to 6.0 ft (circular sections) Manning's n: 0.015 to 0.034 Lengths: 300 to 5100 ft
    • 1 Transverse weir (ID: 90010) Crest Height: 3.0 ft Discharge Coefficient: 3.33

Control Logic Implementation:

The system implements 7 hierarchical control rules (R1-R7) managing weir 90010:

  1. Depth-based control (Priority 1)
  2. Flow-based control (Priority 2)
  3. Time-of-day operation (Priority 3)
  4. Seasonal control (Priority 4)
  5. Weekly scheduling (Priority 5)
  6. Multi-condition control (Priority 6)
  7. System-wide flow management (Priority 7)

Inflow Configuration:

  • Three defined inflow nodes (80408, 81009, 82309)
  • Time series data structured with: Peak flows: 40-50 CFS Duration: 3 hours Uniform distribution pattern

The PID RTC SWMM5 version of the original SWMM3 Model

[TITLE]
;;Project Title/Notes
Example 4 of Extran Manual -
Weir

[OPTIONS]
;;Option             Value
FLOW_UNITS           CFS
INFILTRATION         HORTON
FLOW_ROUTING         DYNWAVE
LINK_OFFSETS         DEPTH
MIN_SLOPE            0
ALLOW_PONDING        NO
SKIP_STEADY_STATE    NO

START_DATE           01/01/2002
START_TIME           00:00:00
REPORT_START_DATE    01/01/2002
REPORT_START_TIME    00:00:00
END_DATE             01/01/2002
END_TIME             08:00:00
SWEEP_START          01/01
SWEEP_END            12/31
DRY_DAYS             0
REPORT_STEP          00:15:00
WET_STEP             00:15:00
DRY_STEP             01:00:00
ROUTING_STEP         0:00:20
RULE_STEP            00:00:00

INERTIAL_DAMPING     NONE
NORMAL_FLOW_LIMITED  BOTH
FORCE_MAIN_EQUATION  H-W
VARIABLE_STEP        0.00
LENGTHENING_STEP     0
MIN_SURFAREA         0
MAX_TRIALS           0
HEAD_TOLERANCE       0
SYS_FLOW_TOL         5
LAT_FLOW_TOL         5
MINIMUM_STEP         0.5
THREADS              1

[EVAPORATION]
;;Data Source    Parameters
;;-------------- ----------------
CONSTANT         0.0
DRY_ONLY         NO

[JUNCTIONS]
;;Name           Elevation  MaxDepth   InitDepth  SurDepth   Aponded
;;-------------- ---------- ---------- ---------- ---------- ----------
80408            124.6      13.4       0          0          0
80608            118.3      16.7       0          0          0
81009            128.2      8.8        0          0          0
81309            117.5      12.5       0          0          0
82309            112.3      42.7       0          0          0
10309            101.6      9.4        0          0          0
15009            111.5      13.5       0          0          0
16009            102        18         0          0          0
16109            102.8      22.2       0          0          0

[OUTFALLS]
;;Name           Elevation  Type       Stage Data       Gated    Route To
;;-------------- ---------- ---------- ---------------- -------- ----------------
10208            89.9       FREE                        NO

[CONDUITS]
;;Name           From Node        To Node          Length     Roughness  InOffset   OutOffset  InitFlow   MaxFlow
;;-------------- ---------------- ---------------- ---------- ---------- ---------- ---------- ---------- ----------
8040             80408            80608            1800       0.015      0          0          0          0
8060             80608            82309            2075       0.015      0          2.2        0          0
8100             81009            81309            5100       0.015      0          0          0          0
8130             81309            15009            3500       0.015      0          0          0          0
1030             10309            10208            4500       0.016      0          0          0          0
1570             15009            16009            5000       0.0154     0          0          0          0
1600             16109            16009            500        0.015      0          0          0          0
1630             16009            10309            300        0.015      0          0          0          0
1602             82309            16109            5000       0.034      0          0          0          0

[WEIRS]
;;Name           From Node        To Node          Type         CrestHt    Qcoeff     Gated    EndCon   EndCoeff   Surcharge  RoadWidth  RoadSurf   Coeff. Curve
;;-------------- ---------------- ---------------- ------------ ---------- ---------- -------- -------- ---------- ---------- ---------- ---------- ----------------
90010            82309            15009            TRANSVERSE   3.0        3.33       NO       0        0          YES

[XSECTIONS]
;;Link           Shape        Geom1            Geom2      Geom3      Geom4      Barrels    Culvert
;;-------------- ------------ ---------------- ---------- ---------- ---------- ---------- ----------
8040             CIRCULAR     4                0          0          0          1
8060             CIRCULAR     4                0          0          0          1
8100             CIRCULAR     4.5              0          0          0          1
8130             CIRCULAR     4.5              0          0          0          1
1030             TRAPEZOIDAL  9                0          3          3          1
1570             CIRCULAR     5.5              0          0          0          1
1600             CIRCULAR     6                0          0          0          1
1630             TRAPEZOIDAL  9                0          3          3          1
1602             CIRCULAR     5                0          0          0          1
90010            RECT_OPEN    3.0              3.0        0          0

[CONTROLS]

;----------------------------------------------------
; 1) Depth-based control at an upstream node
;    If Node 82309’s water depth exceeds 5 ft,
;    fully open the weir. Otherwise, partially close it.
;----------------------------------------------------
RULE R1
  IF NODE 82309 DEPTH > 5.0
  THEN WEIR 90010 SETTING = 1.0
  ELSE WEIR 90010 SETTING = 0.5
  PRIORITY 1

;----------------------------------------------------
; 2) Flow-based control on an upstream link
;    If Link 8060 flow exceeds 20 cfs, fully open the weir;
;    else keep it half-open.
;----------------------------------------------------
RULE R2
  IF LINK 8060 FLOW > 20.0
  THEN WEIR 90010 SETTING = 1.0
  ELSE WEIR 90010 SETTING = 0.5
  PRIORITY 2

;----------------------------------------------------
; 3) Time-of-day control
;    From 06:00 to 10:00, close the weir;
;    otherwise open it fully.
;----------------------------------------------------
RULE R3
  IF SIMULATION CLOCKTIME >= 06:00
  AND SIMULATION CLOCKTIME < 10:00
  THEN WEIR 90010 SETTING = 0.0
  ELSE WEIR 90010 SETTING = 1.0
  PRIORITY 3

;----------------------------------------------------
; 4) Date-based control
;    During the month of June, open the weir fully;
;    otherwise keep it partially closed.
;----------------------------------------------------
RULE R4
  IF SIMULATION MONTH = 6
  THEN WEIR 90010 SETTING = 1.0
  ELSE WEIR 90010 SETTING = 0.3
  PRIORITY 4

;----------------------------------------------------
; 5) Day-of-week control
;    On weekends (Saturday=7 or Sunday=1 in SWMM’s system),
;    reduce weir setting by 50%, else keep it fully open.
;----------------------------------------------------
RULE R5
  IF SIMULATION DAY = 7
  OR SIMULATION DAY = 1
  THEN WEIR 90010 SETTING = 0.5
  ELSE WEIR 90010 SETTING = 1.0
  PRIORITY 5

;----------------------------------------------------
; 6) Multiple conditions combined
;    Example: If Node 82309 depth > 6.0 ft AND Link 8060 flow > 25 cfs,
;    THEN open the weir fully. Otherwise, keep it at 0.75.
;----------------------------------------------------
RULE R6
  IF NODE 82309 DEPTH > 6.0
  AND LINK 8060 FLOW > 25.0
  THEN WEIR 90010 SETTING = 1.0
  ELSE WEIR 90010 SETTING = 0.75
  PRIORITY 6

;----------------------------------------------------
; 7) System-wide flow control
;    If the total system outflow (SYSTEM FLOW) exceeds 200 cfs,
;    close the weir. Otherwise, open it.
;----------------------------------------------------
RULE R7
  VARIABLE  Q8040 = LINK 8040 FLOW
  VARIABLE  Q8100 = LINK 8100 FLOW
  EXPRESSION Net_Inflow = Q8100 + Q8040
  IF Net_Inflow  > 90
  THEN WEIR 90010 SETTING = 0.0
  ELSE WEIR 90010 SETTING = 1.0
  PRIORITY 7

[INFLOWS]
;;Node           Constituent      Time Series      Type     Mfactor  Sfactor  Baseline Pattern
;;-------------- ---------------- ---------------- -------- -------- -------- -------- --------
80408            FLOW             80408            FLOW     1.0      1.0
81009            FLOW             81009            FLOW     1.0      1.0
82309            FLOW             82309            FLOW     1.0      1.0

[TIMESERIES]
;;Name           Date       Time       Value
;;-------------- ---------- ---------- ----------
82309                       0          0
82309                       0.25       40
82309                       3.0        40
82309                       3.25       0
82309                       12.0       0
;
80408                       0          0
80408                       0.25       45
80408                       3.0        45
80408                       3.25       0
80408                       12         0
;
81009                       0          0
81009                       0.25       50
81009                       3.0        50
81009                       3.25       0
81009                       12         0

[REPORT]
;;Reporting Options
CONTROLS   YES
SUBCATCHMENTS ALL
NODES ALL
LINKS ALL

[TAGS]

[MAP]
DIMENSIONS -1113.687 2165.261 10650.527 7792.630
Units      None

[COORDINATES]
;;Node           X-Coord            Y-Coord
;;-------------- ------------------ ------------------
80408            10115.790          7536.840
80608            7463.160           7536.840
81009            9989.470           2421.050
81309            7568.420           2421.050
82309            4957.890           7536.840
10309            389.470            2421.050
15009            4978.950           2421.050
16009            2494.740           2421.050
16109            2494.740           7536.840
10208            -578.950           4947.370

[VERTICES]
;;Link           X-Coord            Y-Coord
;;-------------- ------------------ ------------------

[Polygons]
[LABELS]
;;X-Coord          Y-Coord            Label
2431.580           1052.630           "EXAMPLE 4 OF EXTRAN MANUAL" "" "Arial" 12 1 1
9780.790           8204.590           "Inflow" "" "Arial" 10 0 0
4655.530           8141.960           "Inflow" "" "Arial" 10 0 0
9694.740           2084.210           "Inflow" "" "Arial" 10 0 0

 How does this look in ICM InfoWorks and ICM SWMM?

Minimize image

Edit image

Delete image

InfoSWMM Engine == OneSWMM for InfoDrainage and ICM SWMM

Full Reference for the 1981 version of Extran for SWMM3

Minimize image

Edit image

Delete image

EPA-600/2-84-109b
Final Draft, November 1981
Sixth Printing, July 1983

STORMWATER MANAGEMENT MODEL USER'S MANUAL VERSION III Addendum I EXTRAN
by
Larry A. Roesner
Robert P. Shubinski
John A. Aldrich
Camp Dresser & McKee Inc.
Annandale, Virginia 22003

EPA COOPERATIVE AGREEMENT NO. CR8O5664
Project Officer
Douglas C. Ammon
Storm and Combined Sewer Section
Wastewater Research Division
Municipal Environmental Research Laboratory
Cincinnati, Ohio 45268

Closing Note

Thank you for reading these articles. I appreciate your engagement and support. Thank you again, and I hope you'll join me on this ongoing journey of learning and discovery. Until next time you read one of these posts.

The articles in this newsletter highlight temporal asymmetries. They discuss topics that, while only universally relevant at some times, become crucial for those in need. These pieces are resources, and they are ready to let you know and help when specific circumstances arise.

Leave a Reply

Translate »
Scroll to Top

Discover more from SWMM5, ICM SWMM, ICM InfoWorks, Ruby and Vibe Apps, InfoSWMM, InfoSewer

Subscribe now to keep reading and get access to the full archive.

Continue reading