Extended and Expanded Summary of the Uinlet.pas
Unit
The Uinlet.pas
unit in EPA SWMM manages the logic, data storage, and I/O routines for modeling street and channel inlets within a SWMM project. Inlet definitions determine how flow enters a conduit link through different inlet geometries (e.g., grates, curb openings, etc.). The unit also covers the usage details of those inlets, including how many inlets are placed, how clogged they might be, or where captured flow is directed.
Below is a comprehensive summary of the unit’s structures, functionality, and main procedures.
1. Data Structures
1.1 TInlet
Class
-
Purpose
Represents a type of inlet design, specifying geometry and relevant characteristics such as length, width, fraction of open area, etc. -
Key Fields
InletType
: An integer representing the type of inlet (grate, curb, combo, slotted, drop grate, drop curb, or custom).Data[0..MAX_INLET_PROPS]
: An array of strings storing property values for the selected inlet type. The properties are indexed constants such asGRATE_INLET_TYPE
,GRATE_INLET_LENGTH
, etc.
-
Important Methods
constructor Create;
Initializes the newTInlet
object with default properties (DefInlet
array).function GetID: String;
Returns the ID name of the inlet design from the globalProject.Lists[INLET]
array.
1.2 TInletUsage
Class
-
Purpose
Describes how a particular inlet design (TInlet
) is used on a specific conduit link (TLink
) in the network. -
Key Fields
InletLink
: The link where the inlet is placed.InletNode
: The node that receives flow from the inlet (i.e., the “capture” node).Inlet
: A reference to aTInlet
object describing the inlet design.Data[0..USAGE_MAX_INDEX]
: An array of strings holding usage properties (e.g., number of inlets, percent clogged, maximum flow limit, local depression geometry, etc.).
2. Constants & Index Definitions
-
Inlet Placement
AUTOMATIC
= 0ON_GRADE
= 1ON_SAG
= 2
-
Inlet Types
GRATE_INLET
= 0CURB_INLET
= 1COMBO_INLET
= 2SLOTTED_INLET
= 3DROP_GRATE
= 4DROP_CURB
= 5CUSTOM_INLET
= 6
-
TInlet.Data[]
Field Indexes (0..MAX_INLET_PROPS
)- Grate-specific fields, e.g.,
GRATE_INLET_TYPE
,GRATE_INLET_LENGTH
, etc. - Curb-specific fields, e.g.,
CURB_INLET_LENGTH
,CURB_INLET_HEIGHT
, etc. - Slotted or custom inlet fields.
- Grate-specific fields, e.g.,
-
Usage Indexes (0..
USAGE_MAX_INDEX
)USAGE_NUM_INLETS
,USAGE_PCNT_CLOGGED
,USAGE_FLOW_RESTRICT
,USAGE_DEPRESS_HEIGHT
,USAGE_DEPRESS_WIDTH
,USAGE_PLACEMENT
.
3. Main Routines
3.1 Reading / Writing “Inlet Design” Data
These handle the [INLETS]
section in an SWMM input file.
-
ReadInletDesignData
- Called when parsing a line from
[INLETS]
in a SWMM input file. - Determines which inlet “type” is being read (e.g.,
GRATE
,CURB
,COMBO
,SLOTTED
,CUSTOM
, etc.) based on keywords. - Creates or updates a
TInlet
object inProject.Lists[INLET]
, filling in property fields.
- Called when parsing a line from
-
Helper Functions
ReadGrateInletData(...)
Reads data tokens for a grate or combination inlet.ReadCurbInletData(...)
Reads data tokens for a curb or combo inlet.ReadSlottedInletData(...)
Reads data tokens for a slotted drain inlet.ReadCustomInletData(...)
Reads data tokens for a custom inlet, referencing rating curves, etc.
-
EditInletDesign(I: Integer): String
- Launches a UI form (
TInletEditorForm
) allowing editing of an inlet design in theProject.Lists[INLET]
. - If
I < 0
, creates a new inlet design; ifI >= 0
, edits the existing one. - Updates name changes, sets the
Modified
flag.
- Launches a UI form (
-
ExportInletDesigns(S: TStringList)
- Writes out all inlet definitions in
[INLETS]
format to a string listS
. - Breaks out logic for GRATE, CURB, COMBO, SLOTTED, DROP inlets or custom inlets.
- Writes out all inlet definitions in
3.2 Reading / Writing “Inlet Usage” Data
These handle the [INLET_USAGE]
section in an SWMM input file.
-
ReadInletUsageData
- Reads tokens from
[INLET_USAGE]
lines: link ID, inlet ID, node ID, # of inlets, clogging, flow restriction, local depression geometry, etc. - Locates the associated
TLink
,TNode
, andTInlet
; creates aTInletUsage
object stored intheLink.Inlet
.
- Reads tokens from
-
EditInletUsage(Index: Integer; var S: String; var Modified: Boolean): String
- Invokes the user interface (
InletUsageForm
) to let the user configure inlet usage for a linkIndex
in theCONDUIT
list. - Filters out which inlet designs are valid for the link’s cross-section shape (e.g., street cross-section might only allow drop inlet types, or channel shapes might not allow standard curb inlets).
- Invokes the user interface (
-
ExportInletUsage(S: TStringList)
- Writes out data lines in
[INLET_USAGE]
format for each link that has an associatedTInletUsage
object.
- Writes out data lines in
3.3 Utility Functions
-
GetInletNode(aLink: TLink): TNode
- Returns the node that is assigned as the capture node in
InletUsage
for that link (may differ from link’s Node1 or Node2 depending on local geometry).
- Returns the node that is assigned as the capture node in
-
GetCaptureNode(aLink: TLink): TNode
- Looks at the invert elevations of Node1 and Node2 to see which is physically lower or if a user-specified capture node is set.
-
DeleteInletsByNode(aNode: TNode): Boolean
- When a node is deleted from the project, any references to that node in an inlet usage must also be freed.
-
DeleteInletsByType(aInletType: TInlet): Boolean
- If a user removes an inlet design from the project, all usage references to it must be destroyed.
-
CheckForValidInlet(aLink: TLink): Boolean
- Verifies that a link’s cross-section shape is actually compatible with the assigned inlet type.
- If incompatible, the code frees the
TInletUsage
object.
4. Typical Workflow
-
Reading from INP
- While parsing
[INLETS]
, the parser callsReadInletDesignData
, producing one or moreTInlet
objects. - While parsing
[INLET_USAGE]
, the parser callsReadInletUsageData
, creating or updatingTInletUsage
references on relevantCONDUIT
links.
- While parsing
-
During Editing
- The user might open an Inlet Design Editor (
EditInletDesign
) to add or modify aTInlet
. - The user might open an Inlet Usage Editor (
EditInletUsage
) for a given link to specify the # of inlets, clogging fraction, etc.
- The user might open an Inlet Design Editor (
-
Writing to INP
- When saving the model,
ExportInletDesigns
writes the[INLETS]
section, andExportInletUsage
writes[INLET_USAGE]
.
- When saving the model,
-
When Deleting
- If a node or a specific inlet design is removed, any associated inlets (
TInletUsage
) get cleaned up in the link database.
- If a node or a specific inlet design is removed, any associated inlets (
5. Conclusion
The Uinlet.pas
unit centralizes all inlet design and inlet usage logic within SWMM. It keeps track of:
- Which inlets are defined (their geometry, type, etc.).
- How they are used on each conduit link (the capture node, number of inlets, local depressions, or flow restrictions).
Through a set of well-defined read/write methods and user-interface hooks, it ensures consistent modeling of inlet flow capacity within the broader SWMM network.
No comments:
Post a Comment