Sunday, December 29, 2024

SWMM5 Delphi GUI Uinlet.pas Summary

 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

    1. InletType: An integer representing the type of inlet (grate, curb, combo, slotted, drop grate, drop curb, or custom).
    2. Data[0..MAX_INLET_PROPS]: An array of strings storing property values for the selected inlet type. The properties are indexed constants such as GRATE_INLET_TYPE, GRATE_INLET_LENGTH, etc.
  • Important Methods

    • constructor Create;
      Initializes the new TInlet object with default properties (DefInlet array).
    • function GetID: String;
      Returns the ID name of the inlet design from the global Project.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

    1. InletLink: The link where the inlet is placed.
    2. InletNode: The node that receives flow from the inlet (i.e., the “capture” node).
    3. Inlet: A reference to a TInlet object describing the inlet design.
    4. 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

  1. Inlet Placement

    • AUTOMATIC = 0
    • ON_GRADE = 1
    • ON_SAG = 2
  2. Inlet Types

    • GRATE_INLET = 0
    • CURB_INLET = 1
    • COMBO_INLET = 2
    • SLOTTED_INLET = 3
    • DROP_GRATE = 4
    • DROP_CURB = 5
    • CUSTOM_INLET = 6
  3. 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.
  4. 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.

  1. 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 in Project.Lists[INLET], filling in property fields.
  2. 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.
  3. EditInletDesign(I: Integer): String

    • Launches a UI form (TInletEditorForm) allowing editing of an inlet design in the Project.Lists[INLET].
    • If I < 0, creates a new inlet design; if I >= 0, edits the existing one.
    • Updates name changes, sets the Modified flag.
  4. ExportInletDesigns(S: TStringList)

    • Writes out all inlet definitions in [INLETS] format to a string list S.
    • Breaks out logic for GRATE, CURB, COMBO, SLOTTED, DROP inlets or custom inlets.

3.2 Reading / Writing “Inlet Usage” Data

These handle the [INLET_USAGE] section in an SWMM input file.

  1. 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, and TInlet; creates a TInletUsage object stored in theLink.Inlet.
  2. EditInletUsage(Index: Integer; var S: String; var Modified: Boolean): String

    • Invokes the user interface (InletUsageForm) to let the user configure inlet usage for a link Index in the CONDUIT 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).
  3. ExportInletUsage(S: TStringList)

    • Writes out data lines in [INLET_USAGE] format for each link that has an associated TInletUsage object.

3.3 Utility Functions

  1. 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).
  2. 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.
  3. 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.
  4. DeleteInletsByType(aInletType: TInlet): Boolean

    • If a user removes an inlet design from the project, all usage references to it must be destroyed.
  5. 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

  1. Reading from INP

    • While parsing [INLETS], the parser calls ReadInletDesignData, producing one or more TInlet objects.
    • While parsing [INLET_USAGE], the parser calls ReadInletUsageData, creating or updating TInletUsage references on relevant CONDUIT links.
  2. During Editing

    • The user might open an Inlet Design Editor (EditInletDesign) to add or modify a TInlet.
    • The user might open an Inlet Usage Editor (EditInletUsage) for a given link to specify the # of inlets, clogging fraction, etc.
  3. Writing to INP

    • When saving the model, ExportInletDesigns writes the [INLETS] section, and ExportInletUsage writes [INLET_USAGE].
  4. When Deleting

    • If a node or a specific inlet design is removed, any associated inlets (TInletUsage) get cleaned up in the link database.

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:

A comprehensive explanation of how minimum travel distance relates to link length in InfoSewer

In hydraulic modeling of sewer networks, the minimum travel distance is a fundamental parameter that affects how accurately the model can si...