Below is a high-level summary of the Uupdate.pas
unit, which is responsible for updating references to changed SWMM project data in the user interface (UI) and in SWMM’s underlying data structures.
1. Purpose & Overview
Uupdate.pas
ensures that when certain SWMM data elements (like nodes, subcatchments, pollutants, etc.) change names, or when configuration changes occur (like infiltration model or link offset conventions), all references to those elements remain consistent across the entire project. If an element is renamed or removed, Uupdate.pas
finds all its occurrences in other objects’ properties (e.g., a subcatchment’s outlet, a node’s inflow pollutant, etc.) and adjusts them accordingly.
Core Responsibilities:
- Remove references to deleted object names.
- Rename references to objects that changed names.
- Synchronize property changes across subcatchments, nodes, links, and specialized objects (LIDs, controls, etc.).
- Convert link offsets from “Depth Offsets” to “Elevation Offsets” (or vice versa) and update all link objects accordingly.
- Manage changes in infiltration models and default project options.
2. Key Procedures and Functions
Name/Reference Updates
-
RemoveName(ObjType, OldName)
- Removes all references to an object whose name has been deleted.
- Example: If a node “Node1” is removed, it also removes “Node1” from any links or subcatchments that referenced it.
-
UpdateXYZName(OldName, NewName)
(e.g.,UpdatePollutName
,UpdateRainGageName
,UpdateNodeName
, etc.)- Searches the entire project data for occurrences of
OldName
(e.g., in inflows, subcatchment loadings, or link references) and replaces them withNewName
. - If
NewName
is blank, the references are effectively set to “*” or removed.
- Searches the entire project data for occurrences of
-
UpdateAllLengths
,UpdateObjectLength
- Recompute lengths and areas if the “AutoLength” option is enabled or if geometry changes (like a node reference is updated).
-
UpdateOffsets
,ComputeDepthOffsets
,ComputeElevationOffsets
- Convert link offsets from “Elevation” to “Depth” or vice versa.
- Iterates through all links of type conduit, orifice, weir, or outlet, computing new offset values.
-
UpdateInfilModel
,UpdateDefOptions
- If the default infiltration model changes (e.g., from Horton to Green-Ampt), optionally updates all subcatchments still using the old model to the new one.
- Synchronizes global default options if something like
FLOW_UNITS
orLINK_OFFSETS
changes.
-
UpdateLinkNode
,UpdateSubcatchOutlet
,UpdateLabelAnchor
- Adjusts references for the endpoints or anchors of various objects (links, subcatchments, labels) to a new name while validating that the references make sense (i.e., a link cannot connect a node to itself).
-
UpdateLinkHints
,UpdateUnits
,UpdateMapUnits
- Refreshes UI hints displayed for link offsets if the user toggles between “Depth” vs. “Elevation” offset conventions.
- Updates displayed units if the project’s flow units or infiltration model changes.
3. Typical Use Cases
-
Renaming a Node
- The user edits a node's ID from
NodeA
toNodeB
.UpdateNodeName
replacesNodeA
everywhere it’s used as an outfall, inflow reference, or subcatchment outlet.
- The user edits a node's ID from
-
Removing a Pollutant
- The user deletes “TSS” from the pollutant list.
RemoveName
callsUpdatePollutName(... , "")
, which sets or removes “TSS” from land uses, nodes’ inflows, or LID removal references.
- The user deletes “TSS” from the pollutant list.
-
Switching Offsets
- The user changes link offsets from “Depth” to “Elevation.”
UpdateOffsets
callsComputeElevationOffsets
for each conduit, weir, orifice, and outlet, adjusting offset numbers so the DB remains consistent.
- The user changes link offsets from “Depth” to “Elevation.”
-
Changing Infiltration Model
- The user changes the default infiltration option from “Green-Ampt” to “Horton.”
UpdateInfilModel
optionally updates all subcatchments that were using the old infiltration method to the new one.
- The user changes the default infiltration option from “Green-Ampt” to “Horton.”
4. Integration with the SWMM GUI
Uupdate.pas
works in tandem with theUglobals
andUproject
modules:Uglobals
holds the global flags (e.g.,AutoLength
,UnitSystem
, etc.).Uproject
stores all objects (subcatchments, nodes, links, pollutants, landuses, etc.).
- The UI (e.g.,
Fmain
,Fmap
,Ubrowser
) calls these update routines in response to user edits or preference changes.
5. Conclusion
Uupdate.pas
is essentially a “cleanup and synchronization” module. Whenever an object is renamed or a project-wide setting is changed, it ensures that all references, geometry computations, or label anchors remain valid and consistent throughout the EPA SWMM data environment. This prevents orphan references or outdated settings after user actions.
No comments:
Post a Comment