Below is an overview of Dunithyd.pas, a Delphi unit from SWMM 5.2 that implements a dialog form (TUnitHydForm) for editing the properties of an RDII Unit Hydrograph (UH) group. In SWMM, RDII (Rainfall-Dependent Infiltration/Inflow) can be modeled by defining up to three “short-term,” “medium-term,” and “long-term” unit hydrographs, along with initial abstraction parameters, for each month of the year (plus an “All Months” option). This form lets the user specify all those parameters in a systematic way.
1. Purpose and Context
RDII in SWMM is captured using Unit Hydrographs that describe how rainfall infiltrates and enters the sewer system as infiltration/inflow. Each set of unit hydrographs (short-, medium-, long-term) can vary by month. Additional parameters control initial abstraction—how much rainfall is withheld before generating RDII.
The TUnitHydForm helps the user:
- Assign a unique name to the unit hydrograph group,
- Specify which rain gage the RDII is associated with,
- Provide UH parameters for each of the three unit hydrographs, for each month (January, February, etc.), or for “All Months,”
- Provide initial abstraction parameters similarly for each month and each of the three UHs.
Then these RDII definitions can be referenced by nodes that experience infiltration/inflow from that hydrograph group.
2. Main Form: TUnitHydForm
2.1 Key Controls
- UHName (
TEdit
):- The user-specified name of the unit hydrograph group.
- RGname (
TComboBox
):- The name of the rain gage that drives this RDII. The user picks from among the project’s list of raingages.
- PageControl1 with two tabs:
- TabSheet1: A grid (
UHGridEdit
) for editing the parameters (fraction of rainfall, time to peak, and recession constant) for each of three unit hydrographs (“short-term,” “medium-term,” “long-term”). - TabSheet2: A grid (
IAGridEdit
) for editing the initial abstraction parameters () for each of the three UHs.
- TabSheet1: A grid (
- MonthsCombo: A drop-down listing “All Months” plus each month (January ... December). The user can choose which set of monthly parameters to view/edit. Each month has its own set of or ).
- OK, Cancel, Help buttons:
- Finalize changes, discard, or open help topic about RDII hydrographs.
2.2 Internal Data Structures
The form uses:
UHParams[0..12, 1..3, 1..3]
to store for each month (0=All Months, 1=January, ..., 12=December) and each of the three UHs (1=short term, 2=medium term, 3=long term).IAParams[0..12, 1..3, 1..3]
to store ` similarly.
The user sees these in the UHGridEdit.Grid
or IAGridEdit.Grid
depending on the tab. They pick which month to display from MonthsCombo
, and the code copies the arrays to/from the grid for that month.
2.3 Key Methods
-
FormCreate:
- Sets up the grids, ensuring 4 rows (one for “Response” label, plus short/medium/long) and 3 columns ( or ).
- Fills
MonthsCombo
with “All Months,” “January,” “February,” etc.
-
SetData(Index, aUnitHyd):
- Called to load the existing data for a unit hydrograph group:
UHIndex := Index
.UHName.Text
with the name fromProject.Lists[HYDROGRAPH].Strings[Index]
.RGname.Text
with the stored raingage name.- Copies each month’s and from
aUnitHyd.Params[]
/aUnitHyd.InitAbs[]
intoUHParams[]
/IAParams[]
. - Finds the first month that has any data, sets
MonthsCombo.ItemIndex
to that month, and displays those data in the two grids.
- Called to load the existing data for a unit hydrograph group:
-
GetData(S, aUnitHyd):
- After user presses OK, retrieves the final name
UHName.Text
intoS
. - Copies the currently displayed month’s data from the grids to
UHParams[]
andIAParams[]
. - Then writes all months’ data back into
aUnitHyd.Params[]
andaUnitHyd.InitAbs[]
. - Also sets
aUnitHyd.Raingage
toRGname.Text
.
- After user presses OK, retrieves the final name
-
MonthsComboClick:
- Saves the currently displayed grid values to
UHParams
/IAParams
for the old month. - Switches the displayed month to the newly selected month.
- Loads that month’s stored values into the grids.
- Saves the currently displayed grid values to
-
OKBtnClick:
- If the data passes ValidateData (e.g., no empty name, no duplicate name, a valid raingage name), then
ModalResult := mrOK
, otherwise an error message appears.
- If the data passes ValidateData (e.g., no empty name, no duplicate name, a valid raingage name), then
3. Validation Checks
- UHName must be non-empty, unique among
Project.Lists[HYDROGRAPH]
. - Raingage must be non-empty.
- The numeric fields can be left empty if the user is not using them for that month. Typically, or ) can be 0.0 if not used.
4. Additional UI Behavior
- The user can define partial data for some months while leaving “All Months” or other months blank. If a month is set to “All Months,” the grids define the baseline parameters used if no monthly override is provided.
- The grids are small (4 rows, 4 columns). The row 0 is a heading, row 1..3 correspond to the short/medium/long UHs or infiltration sets. The code in
SetData
/MonthsComboClick
copies data to/from arrays, thus letting each month have a separate set of UH/IA parameters.
5. Summary
Dunithyd.pas provides TUnitHydForm, a specialized form in SWMM for editing an RDII unit hydrograph group. It organizes:
- Name of the hydrograph group,
- Associated rain gage,
- (R, T, K) triple for short/medium/long unit hydrographs,
- Initial abstraction data (),
- Month-by-month overrides (or “All Months” default).
Once the user finalizes, SWMM stores these parameters in a THydrograph
object, enabling infiltration/inflow modeling in the sewer system.
No comments:
Post a Comment