Showing posts with label SWMM5 Delphi GUI Fstats.pas Summary. Show all posts
Showing posts with label SWMM5 Delphi GUI Fstats.pas Summary. Show all posts

Sunday, December 29, 2024

SWMM5 Delphi GUI Fstats.pas Summary

 Below is a high-level summary of Fstats.pas, the Delphi unit that implements the TStatsReportForm in SWMM. This form is used to produce a statistical analysis report of user-specified events (e.g., peaks, totals, durations) taken from simulation results.


1. Purpose

Fstats.pas defines TStatsReportForm, an MDI child form that:

  1. Takes a TStatsSelection record (from Dstats.pas) describing which object, variable, and analysis type (peak, mean, etc.) to study.
  2. Uses Ustats.GetStats to compute the event-based statistics (peak values, durations, volumes, etc.), returning:
    • A list of individual events (EventList).
    • Summary results in a TStatsResults record.
  3. Displays the results in a PageControl with these pages:
    • StatsPage: textual summary of overall event stats (mean, min, max, etc.).
    • TablePage: rank-ordered table of events.
    • HistogramPage: histogram plot of event values.
    • FrequencyPlotPage: exceedance frequency plot of event values.

2. Components and Displays

  1. StatsPage (StatsMemo):

    • Lists key summary information:
      • Object name, Variable name, Units
      • Number of events, min/max/mean values, standard deviation, skewness
      • Period of record and event threshold criteria
    • This text is built from templates in StatsText.
  2. TablePage (EventTable):

    • A rank-ordered list of all events, each with date/time, value, duration, frequency, etc.
    • Includes sortable columns (headers that user can click).
    • Event data come from the EventList.
  3. HistogramPage (HistoChart):

    • A bar chart (TBarSeries) of event values, grouped into bins.
    • Code calculates bin widths, min & max event values, etc.
  4. FrequencyPlotPage (FreqChart):

    • An exceedance frequency chart (TAreaSeries), showing event value on x-axis vs. log-based exceedance freq. on y-axis.

3. Key Methods

  1. CreateReport(StatsSelection):

    • Stores the selected statistical options in a local variable (Stats).
    • Sets up object & variable names, units, and the display caption.
    • (Later, RefreshReport actually runs the analysis.)
  2. RefreshReport:

    • Clears any existing events from EventList.
    • Calls Ustats.GetStats to compute new event data & summary results.
    • Fills in StatsPage (text), TablePage (grid), HistogramPage (bar chart), FrequencyPlotPage (exceedance chart).
  3. RefreshStatsPage / RefreshTablePage / RefreshHistoPage / RefreshFreqPage:

    • Each routine populates one of the 4 pages with the newly computed data.
  4. CopyTo / Print:

    • Allows user to copy or print the currently visible page.
    • For the histogram & frequency pages, uses graph copy/print logic (see Ugraph).
    • For the summary page, copies the text from StatsMemo.
    • For the table page, copies or prints the rank-ordered event table.
  5. SelectAll:

    • Selects all rows/columns in the event table (for e.g. copying to clipboard).

4. Overall Flow

A TStatsSelection describing the event-based analysis is passed to CreateReport, which sets up references to the object/variable and calls RefreshReport. That method invokes Ustats to compute statistics and fill EventList & Results. The results then populate four pages (text summary, event table, histogram, frequency plot). The form supports copying/printing either the text/table pages or the chart pages, and provides “select all” for the event table.


In summary, Fstats.pas manages the creation and display of a statistics report on events (like storm events or flow events) in SWMM, showing both textual summaries and graphical charts of the event data.

Banach-Tarski paradox and SWMM5 modeling.

Banach-Tarski paradox and SWMM5 modeling.  Let's elaborate on how the principles underlying Banach-Tarski could inspire practical hydrau...