Below is an overview of Dlidusage.pas, a Delphi unit from SWMM 5.2 that defines a dialog (TLidUsageDlg) for specifying how a particular LID control is used in a given subcatchment. Unlike the LID control itself (defined in Dlid.pas), which stores the design of the LID, this dialog focuses on deployment details—how many units, what fraction of the subcatchment’s area they occupy, what area of impervious/pervious surfaces they treat, any separate underdrain outlet, and an optional report file.
1. Purpose and Context
When a user is setting up LID usage for a subcatchment, they need to specify:
- Which LID control is being used.
- How many replicate units (e.g., 5 rain barrels or 3 infiltration trenches).
- Each unit’s surface area and width, plus the fraction of the subcatchment’s impervious/pervious surfaces it intercepts.
- Whether outflow from the LID’s underdrain is routed to the outlet or to the pervious area of the subcatchment.
- An optional report file to log performance of the LID usage.
- An optional drain outlet (a node ID), if outflow is routed to a different location.
The TLidUsageDlg collects these parameters from the user and returns them to the calling form (Dlidgroup.pas). The user can then have multiple LID usage rows within a single subcatchment.
2. Key Form Elements
- ComboBox1: A dropdown listing existing LID control names (from the project’s Project.Lists[LID]). The user picks which LID control to deploy.
- NumUnitsUpDn / NumUnitsEdit: The number of replicate LID units to place in the subcatchment.
- UnitAreaEdit and UnitWidthEdit: The area (per unit) and overall width of each LID strip.
- InitSatEdit: The initial percent saturation of the LID’s soil or storage zone at the start of the simulation.
- FromImpervEdit / FromPervEdit: The percentage of impervious or pervious area that drains to this LID usage.
- DrainOutletCheckBox: Indicates if the LID’s underdrain flow is routed to the subcatchment outlet (checked = “1”) or to the subcatchment’s pervious area (unchecked = “0”).
- DrainOutletEdit: An optional node name if outflow is routed somewhere else.
- RptFileEdit (plus BrowseBtn and ClearBtn): An optional text file where the LID usage performance is reported.
- FullAreaCheckBox: If checked, indicates that the LID usage occupies the entire subcatchment area (so that “% of subcatchment” = 100).
- Notebook1 with multiple pages: Displays a small illustration of the chosen LID type (Rain Barrel, Vegetative Swale, Biocell, etc.), helping the user see which LID design they’ve selected.
3. Data Flow
3.1 SetData(Data: array of String)
When called from Dlidgroup.pas, an array of strings defines the usage parameters to load:
Index | Meaning
-----------------------------------------------------
0 | LID Control Name
1 | Number of units
2 | Unit area
3 | Unit width
4 | % initially saturated
5 | % from impervious area
6 | Outflow routing (0=outlet, 1=pervious)
7 | Full report file path
8 | (Unused or path name repeated)
9 | Underdrain outlet node
10 | % from pervious area
SetData populates the controls (e.g., ComboBox1.ItemIndex
, NumUnitsUpDn.Position
, UnitAreaEdit.Text
, etc.). It also sets an internal RptFileName
to track the actual path to the LID’s optional report file.
Finally, DisplayLidImage
loads an appropriate page into Notebook1
based on the LID’s ProcessType
.
3.2 GetData(var Data: array of String)
Once the user presses OK, the code compiles the user’s final entries back into a string array:
Data[0]
= chosen LID control nameData[1]
= number of units- … etc. …
Data[6]
= “1” ifDrainOutletCheckBox
is checked, otherwise “0”Data[7]
= the stored path inRptFileName
Data[9]
=DrainOutletEdit.Text
Data[10]
=% from pervious area
4. Event Handlers and Validation
4.1 OkBtnClick
- Verifies that
ComboBox1
is not blank. - Computes the total % of subcatchment area occupied by this LID usage. If it’s greater than 100, shows an error.
- If checks pass, sets
ModalResult := mrOK
.
4.2 BrowseBtnClick / ClearBtnClick
- Manages the optional report file path.
BrowseBtnClick
opens aTSaveDialog
to pick a file location, storing it inRptFileName
.ClearBtnClick
resetsRptFileName
to empty.
4.3 FullAreaCheckBoxClick
- If checked, sets “LID area = entire subcatchment” logic by:
- Disabling
UnitAreaEdit
- Setting
PcntAreaLabel.Caption = "100.0"
- Automatically computes each replicate unit’s area if there are multiple units.
- Disabling
4.4 NumUnitsEditChange / UnitAreaEditChange
- Recalculates the “% of subcatchment area” shown in
PcntAreaLabel
. This uses a function in Ulid (e.g.,Ulid.GetPcntArea(…)
) that presumably references the subcatchment’s total area.
4.5 DisplayLidImage
- Looks up the chosen LID’s
ProcessType
from the project’sProject.Lists[LID]
. - Switches
Notebook1.ActivePage
to an appropriate image page (e.g., “PermPavePage” for permeable pavement, “VegSwalePage” for a vegetative swale, etc.).
5. Summary of Operation
- Initialization:
SetData
loads the usage’s initial values (which might be blank if new). - User Editing: The user picks from the list of LID controls, sets number of units, fraction from impervious/pervious, etc. They can select a specific file for a performance report and optionally direct the LID’s underdrain outflow to the pervious area or a specified node.
- Validation: On pressing OK, the dialog ensures no invalid conditions (e.g., area > 100%).
- Saving:
GetData
prepares the final usage properties for the caller (Dlidgroup.pas), which stores them in the subcatchment’s LID usage list.
This structure ensures that all relevant details about how an LID control is deployed in a subcatchment are collected and validated, keeping the design (from Dlid.pas) distinct from the usage details here in Dlidusage.pas.
No comments:
Post a Comment