Sunday, December 29, 2024

SWMM5 Delphi GUI Dsummary.pas Summary

 Below is an overview of Dsummary.pas, a Delphi unit from SWMM 5.2 that implements a dialog form (TProjectSummaryForm) for summarizing the number of various object types in the current SWMM project. This summary is displayed in a TStringGrid on the form.


1. Purpose and Context

SWMM models contain many different object types:

  • Raingages, Subcatchments, Aquifers, Snowpacks, Hydrographs
  • Node objects (Junctions, Outfalls, Dividers, Storage Units)
  • Link objects (Conduits, Pumps, Orifices, Weirs, Outlets)
  • Controls, Pollutants, Land Uses
  • Special inflows (Time Series, Dry Weather, Groundwater, RDII)
  • LID Controls
  • Treatment Units

The TProjectSummaryForm displays a count of each of these object types currently in the project. It also reveals which infiltration model is used, and what flow units / routing method are selected. This is a quick, top-level summary for the entire project.


2. Main Form: TProjectSummaryForm

2.1 Primary Controls

  1. StringGrid1: The grid where the summary is displayed. Each row corresponds to a particular type of SWMM object or property. The first column of the grid holds a text label, and the second column holds the corresponding count or value.

  2. Constants: The form references a string array S containing 26 items, each one describing an object type or model option (e.g., "Raingages", "Subcatchments", "Routing Model", "Dry Weather Inflows", etc.).

  3. Internal Counters:

    • TSFcount: The number of time series inflow nodes
    • DWFcount: The number of dry weather inflow nodes
    • GWFcount: The number of groundwater inflow nodes
    • IIFcount: The number of RDII inflow nodes
    • TUcount: The number of treatment nodes
    • LIDcount: The number of LID controls across all subcatchments

3. Data Flow

3.1 FormCreate

  • The code sets RowCount in StringGrid1 to the number of summary rows (26 in the S array).
  • Populates the first column (Cells[0,I]) with the text from the S array.
  • For object categories that exist in Project.Lists[...] (like raingages, subcatchments, etc.), it writes Cells[1,X] with the count from Project.Lists[X].Count.
  • For infiltration model name and flow units or routing method, it uses data from Project.Options.Data[...].
  • Calls GetInflowsCount() to fill counters for time series inflows, DWF, RDII, etc.

3.2 GetInflowsCount

  • Loops through subcatchments to find:
    • Subcatchments with groundwater defined (GWFcount).
    • Summation of LID usage across subcatchments (LIDcount).
  • Loops through node types (junctions, storage units, etc.) to see if a node has:
    • Direct external inflow (TSFcount),
    • Dry weather inflow (DWFcount),
    • RDII inflow (IIFcount),
    • Treatment definitions (TUcount).
  • Calls UpdateNodePropertyCount(N: TNode) for each node to update these counters.

3.3 UpdateNodePropertyCount

  • If N.DXInflow.Count > 0, increments TSFcount.
  • If N.DWInflow.Count > 0, increments DWFcount.
  • If N.IIInflow.Count > 0, increments IIFcount.
  • If N.Treatment.Count > 0, increments TUcount.

3.4 Display in StringGrid1

After these counters are computed, the form writes them to the cells:

Cells[1,20] := IntToStr(TSFcount);   // Time Series Inflows
Cells[1,21] := IntToStr(DWFcount);   // Dry Weather Inflows
Cells[1,22] := IntToStr(GWFcount);   // Groundwater Inflows
Cells[1,23] := IntToStr(IIFcount);   // RDII Inflows
Cells[1,24] := IntToStr(LIDcount);   // LID Controls
Cells[1,25] := IntToStr(TUcount);    // Treatment Units

4. Additional UI Behavior

  • The form’s OnKeyDown closes the form when Esc is pressed.
  • It’s read-only: user can’t edit these counts, just observe them.

5. Summary

Dsummary.pas provides TProjectSummaryForm, a small read-only dialog listing how many of each object type the SWMM project contains, plus some global model settings (flow units, infiltration model, etc.). This helps the user get a quick “inventory” of the model’s objects. It also calculates the number of special inflow or LID usage conditions that exist, ensuring the user is aware of all inflow sources and controls in the model.

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