Sunday, December 29, 2024

SWMM5 Delphi GUI Fproplot.pas Summary

 Below is a high-level summary of Fproplot.pas, the Delphi unit that implements the TProfilePlotForm in SWMM. This MDI child form displays a profile plot, which is a side-view of water elevations and conduit shapes along a series of connected links/nodes.


1. Purpose

Fproplot.pas defines TProfilePlotForm, an MDI child form that:

  • Renders a longitudinal profile of the drainage system—showing node invert elevations, link inverts/crowns, and simulated water elevations.
  • Can refresh its display (after a re-run), copy its image to files or clipboard, and print or export the plot.

2. Key Elements and Behaviors

  1. Creating and Refreshing the Plot:

    • The CreatePlot method is called with a ReportSelection that includes:
      • List of links forming the profile path.
      • Time period to display (if simulation results exist).
    • The form processes each link and node in the profile, extracting geometry (invert elevations, link lengths, conduit depths) and output data (e.g., node water depth, link water depth if dynamic wave).
    • RefreshPlot:
      • Clears all existing data series.
      • Plots link invert, link crown, node invert, and optionally ground surface.
      • If results exist, it also draws the water surface (HGL) and water-filled interior for each conduit.
  2. Plot Components:

    • Chart1: a TChart displaying the profile line. It contains:
      • LinkInvert (line series for conduit inverts),
      • LinkCrown (line series for conduit crown),
      • NodeInvert (point series for node inverts),
      • GroundLine (line series for node ground elevations),
      • plus dynamic drawing of the water surface.
    • Visual aspects (color, pen style, etc.) are governed by user-settable ProfileOptions and GraphOptions.
  3. Drawing the Water Surface:

    • If in dynamic wave mode, the link’s interior water level is retrieved for each link at the current time step, then a polygon is drawn showing the water-filled portion.
    • The hydraulic grade line (HGL) is drawn from node to node.
  4. Display Options:

    • The user can choose to show or hide the HGL, to auto-scale the vertical axis, or to include ground surfaces.
    • The SetPlotOptions method launches a TProfilePlotOptionsForm to tweak these settings (colors, line thickness, label styles, etc.).
  5. Copying and Printing:

    • CopyTo: sends the plot to the Clipboard or a file in either bitmap or metafile format, via a TCopyToForm dialog.
    • Print: calls SWMM’s shared printing logic (Ugraph.Print) to print or preview.
  6. Data Handling:

    • Gathers link geometry (length, invert offsets) from input data if no run results are available, or from Uoutput’s binary data if run results exist.
    • Gathers node inverts and max depths similarly.
    • When refreshing at a new time period, it updates the water surface polygon/HGL.
  7. User Interaction:

    • Right-clicking on the chart calls SetPlotOptions (the user can change chart style).
    • A Refresh button is shown only if results are not available, to simply re-draw the geometry-only profile.

3. Summary

Fproplot.pas implements the TProfilePlotForm used for generating and refreshing an elevation vs. distance (profile) view along a path of links. It manages conduit shape geometry, node ground/invert elevations, optional water surface fill, hydraulic grade lines, and dynamic wave depths at a selected time step. It also provides user-controlled styling (fonts, colors, line thicknesses), supports copy/print, and collaborates with other SWMM modules (e.g., Uoutput for result data and TProfilePlotOptionsForm for visual options).

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