Sunday, December 29, 2024

SWMM5 Delphi GUI Dunithyd.pas Summary

 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:

  1. Assign a unique name to the unit hydrograph group,
  2. Specify which rain gage the RDII is associated with,
  3. Provide UH parameters (R,T,K)(R, T, K) for each of the three unit hydrographs, for each month (January, February, etc.), or for “All Months,”
  4. Provide initial abstraction parameters (Dmax,Drec,D0)(D_{max}, D_{rec}, D_0) 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

  1. UHName (TEdit):
    • The user-specified name of the unit hydrograph group.
  2. RGname (TComboBox):
    • The name of the rain gage that drives this RDII. The user picks from among the project’s list of raingages.
  3. PageControl1 with two tabs:
    • TabSheet1: A grid (UHGridEdit) for editing the (R,T,K)(R, T, K) 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 (Dmax,Drec,D0D_{max}, D_{rec}, D_0) for each of the three UHs.
  4. 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 (R,T,K)(R, T, K) or (Dmax,Drec,D0(D_{max}, D_{rec}, D_0).
  5. 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 (R,T,K)(R, T, K) 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 (Dmax,Drec,D0(D_{max}, D_{rec}, D_0` 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

  1. FormCreate:

    • Sets up the grids, ensuring 4 rows (one for “Response” label, plus short/medium/long) and 3 columns (R,T,KR, T, K or (Dmax,Drec,D0)(D_{max}, D_{rec}, D_0)).
    • Fills MonthsCombo with “All Months,” “January,” “February,” etc.
  2. SetData(Index, aUnitHyd):

    • Called to load the existing data for a unit hydrograph group:
      1. UHIndex := Index.
      2. UHName.Text with the name from Project.Lists[HYDROGRAPH].Strings[Index].
      3. RGname.Text with the stored raingage name.
      4. Copies each month’s (R,T,K)(R, T, K) and (Dmax,Drec,D0)(D_{max}, D_{rec}, D_0) from aUnitHyd.Params[] / aUnitHyd.InitAbs[] into UHParams[] / IAParams[].
      5. Finds the first month that has any data, sets MonthsCombo.ItemIndex to that month, and displays those data in the two grids.
  3. GetData(S, aUnitHyd):

    • After user presses OK, retrieves the final name UHName.Text into S.
    • Copies the currently displayed month’s data from the grids to UHParams[] and IAParams[].
    • Then writes all months’ data back into aUnitHyd.Params[] and aUnitHyd.InitAbs[].
    • Also sets aUnitHyd.Raingage to RGname.Text.
  4. 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.
  5. 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.

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, (R,T,K)(R, T, K) or (Dmax,Drec,D0(D_{max}, D_{rec}, D_0) 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 (Dmax,Drec,D0D_{max}, D_{rec}, D_0),
  • 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:

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...