Extended and Expanded Summary of the Ulid.pas
Unit
The Ulid.pas
unit in EPA SWMM provides functionality for managing Low Impact Development (LID) controls and their assignment to subcatchments. LID controls represent various best management practices such as bio-retention cells, infiltration trenches, permeable pavement, and so on.
Below is a thorough overview of:
- Purpose and Scope
- Core Data Structures
- Key Constants
- Important Routines
- Workflow (How LIDs are read, stored, and used)
- Integration With Other Units
1. Purpose and Scope
Ulid.pas
handles:
- The creation, editing, and storage of LID process data (e.g., infiltration trench geometry, green roof layers, or underdrain parameters).
- The definition of LID usage in specific subcatchments (e.g., how many units of permeable pavement in a subcatchment, or the fraction of impervious runoff directed to a bio-retention cell).
- Reading LID controls from project input files and writing them back out to text.
- Integrating LIDs into the subcatchment object model used by SWMM.
2. Core Data Structures
2.1 LID Process Class: TLid
TLid = class(TObject)
ProcessType : Integer;
SurfaceLayer : array [0..4] of String;
PavementLayer: array [0..6] of String;
SoilLayer : array [0..6] of String;
StorageLayer : array [0..4] of String;
DrainLayer : array [0..6] of String;
DrainMatLayer: array [0..2] of String;
DrainRemovals: TStringlist;
constructor Create;
destructor Destroy; override;
end;
Each TLid
instance holds parameters for a specific LID control design:
ProcessType
: Identifies which type of LID (bio-cell, green roof, infiltration trench, etc.).SurfaceLayer
: An array of strings defining surface layer properties.PavementLayer
: For permeable pavement.SoilLayer
: Soil layer parameters.StorageLayer
: Storage layer parameters (e.g., thickness, void ratio).DrainLayer
: Underdrain (e.g., orifice or weir) parameters.DrainMatLayer
: Drainage mat properties (used in green roofs).DrainRemovals
: Pollutant-specific removal efficiencies for the underdrain outflow.
A TLid
object is stored in Project.Lists[LID]
.
2.2 LID Unit Class: TLidUnit
TLidUnit = class(TObject)
Data: array[0..9] of String;
end;
Each TLidUnit
object represents the application of a specific LID process within a subcatchment:
- The array
Data[0..9]
holds usage parameters, e.g., number of units, area, initial moisture, drainage outlet, etc.
LID units (one or more) are stored in a subcatchment’s LIDs
string list (with the LID name as the string, and a TLidUnit
object as the Objects[]
element).
3. Key Constants
-
LID Process Types
BIO_CELL, RAIN_GARDEN, GREEN_ROOF, INFIL_TRENCH, PERM_PAVE, RAIN_BARREL, ROOF_DISCON, VEG_SWALE
-
LID Process Layers
SURFACE_LAYER, PAVEMENT_LAYER, SOIL_LAYER, STORAGE_LAYER, DRAIN_LAYER, DRAINMAT_LAYER, DRAIN_REMOVALS
-
LID Unit Parameters (indices for
TLidUnit.Data[]
)UNIT_COUNT, UNIT_AREA, UNIT_WIDTH, INIT_MOISTURE, FROM_IMPERV, ROUTE_TO, RPT_FILE_NAME, DRAIN_TO, FROM_PERV, ...
These define how many units are installed, how big they are, how they’re connected, etc.
-
Default layer property arrays (e.g.,
DefSurfaceLayer
,DefPavementLayer
, etc.)
Provide fallback or initial parameter values.
4. Important Routines
4.1 LID Creation and Editing
-
EditLID(const I: Integer): String;
- Launches a form (
TLidControlDlg
) to create or edit aTLid
object. - If
I < 0
, a newTLid
is created. IfI >= 0
, an existing LID is edited. - On success, returns the final name of the LID.
- Launches a form (
-
UpdateLIDName(const OldName, NewName: String);
- Replaces all references to LID
OldName
withNewName
in the subcatchment usage lists.
- Replaces all references to LID
4.2 LID Group Editing
EditLIDGroup(...)
- Allows the user to manage multiple LID units (instances of
TLidUnit
) assigned to a single subcatchment. - E.g., a subcatchment might have some area in permeable pavement, some area in infiltration trenches, etc.
- Allows the user to manage multiple LID units (instances of
4.3 LID Input/Output
-
ReadLidData(...)
- Parses
[LID_CONTROLS]
input lines from an INP file. - Supports reading each layer’s parameters for a given LID (Surface, Pavement, Soil, etc.).
- Parses
-
ReadLidUsageData(...)
- Parses
[LID_USAGE]
input lines from an INP file, assigning an LID to a specific subcatchment.
- Parses
-
ExportLIDs(...)
- Writes
[LID_CONTROLS]
section lines to an output file. - Calls
ExportLIDRemovals(...)
if there are pollutant removal lines.
- Writes
-
ExportLIDGroups(...)
- Writes
[LID_USAGE]
section lines to an output file. - Summarizes all
TLidUnit
usage from each subcatchment.
- Writes
4.4 Utility Methods
-
GetPcntLidArea(I: Integer): Extended;
- Computes total % area of subcatchment
I
covered by LIDs.
- Computes total % area of subcatchment
-
GetPcntArea(Nunits: Integer; AreaStr: String): String;
- Returns a user-friendly string with percent area that an LID usage occupies.
-
HasLIDType(SC: TSubcatch; const LIDType: Integer): Boolean;
- Checks if subcatchment
SC
uses a particular LID process.
- Checks if subcatchment
-
FreeLIDUnits(LidUnits: TStringlist);
- Frees all the
TLidUnit
objects from a subcatchment’s LID usage list.
- Frees all the
5. Workflow
-
Defining an LID
- The user creates a new LID control via
EditLID(I=-1)
. - This defines the LID’s layers: surface, pavement, soil, storage, etc.
- The user creates a new LID control via
-
Assigning LIDs to Subcatchments
- The user calls
EditLIDGroup(indexOfSubcatch, ...)
to select from existing LIDs and apply them in the chosen subcatchment. - Each usage is stored as a
TLidUnit
object in that subcatchment’sLIDs
list.
- The user calls
-
Reading from an INP File
ReadLidData()
reads the[LID_CONTROLS]
section to createTLid
objects.ReadLidUsageData()
reads the[LID_USAGE]
section, creatingTLidUnit
objects that get added to each subcatchment.
-
Writing to an INP File
ExportLIDs()
writes out each LID’s definition in the[LID_CONTROLS]
section.ExportLIDGroups()
writes the usage of each LID in[LID_USAGE]
.
-
Deleting/Updating LIDs
- If an LID is renamed,
UpdateLIDName()
updates references. - If an LID is deleted, references in subcatchments are removed (via
EditLID()
or manual name blanking).
- If an LID is renamed,
6. Integration With Other Units
-
Uproject.pas
- Houses the global
Project
object containing lists for LIDs and subcatchments.
- Houses the global
-
Uglobals.pas
- Defines the indexes for LID object lists and subcatchment categories.
- Manages unit systems (US/SI) used in area conversions.
-
Dlid.pas
(the LID Control Editor Form)- Allows a single LID’s layers to be edited.
- Called from
EditLID()
.
-
Dlidgroup.pas
(the LID Group Editor Form)- Allows multiple LID units to be assigned to a subcatchment.
- Called from
EditLIDGroup()
.
-
Uimport.pas
- Provides routines for reading lines from an INP file, calling
ReadLidData()
orReadLidUsageData()
.
- Provides routines for reading lines from an INP file, calling
-
Uexport.pas
- Provides path manipulations, used for writing file references in
ExportLIDs()
orExportLIDGroups()
.
- Provides path manipulations, used for writing file references in
Concluding Remarks
Ulid.pas
is the primary repository for LID “control” definitions and their usage in subcatchments.- The code uses short arrays (e.g.,
[0..4]
,[0..6]
) for each LID layer to store numeric text parameters. - LID usage is a separate concept from LID definition: the TLid class describes the process/layer specs, while TLidUnit describes how a subcatchment uses it.
This modular approach simplifies reading/writing LID data, editing them in specialized dialog forms, and referencing them from the rest of SWMM’s data structures.
No comments:
Post a Comment