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
-
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.
-
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.). -
Internal Counters:
TSFcount
: The number of time series inflow nodesDWFcount
: The number of dry weather inflow nodesGWFcount
: The number of groundwater inflow nodesIIFcount
: The number of RDII inflow nodesTUcount
: The number of treatment nodesLIDcount
: The number of LID controls across all subcatchments
3. Data Flow
3.1 FormCreate
- The code sets
RowCount
inStringGrid1
to the number of summary rows (26 in theS
array). - Populates the first column (
Cells[0,I]
) with the text from theS
array. - For object categories that exist in
Project.Lists[...]
(like raingages, subcatchments, etc.), it writesCells[1,X]
with the count fromProject.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
).
- Subcatchments with groundwater defined (
- 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
).
- Direct external inflow (
- Calls
UpdateNodePropertyCount(N: TNode)
for each node to update these counters.
3.3 UpdateNodePropertyCount
- If
N.DXInflow.Count > 0
, incrementsTSFcount
. - If
N.DWInflow.Count > 0
, incrementsDWFcount
. - If
N.IIInflow.Count > 0
, incrementsIIFcount
. - If
N.Treatment.Count > 0
, incrementsTUcount
.
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:
Post a Comment