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:
- Takes a TStatsSelection record (from Dstats.pas) describing which object, variable, and analysis type (peak, mean, etc.) to study.
- 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.
- 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
-
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.
- Lists key summary information:
-
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.
-
HistogramPage (HistoChart):
- A bar chart (TBarSeries) of event values, grouped into bins.
- Code calculates bin widths, min & max event values, etc.
-
FrequencyPlotPage (FreqChart):
- An exceedance frequency chart (TAreaSeries), showing event value on x-axis vs. log-based exceedance freq. on y-axis.
3. Key Methods
-
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.)
-
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).
-
RefreshStatsPage / RefreshTablePage / RefreshHistoPage / RefreshFreqPage:
- Each routine populates one of the 4 pages with the newly computed data.
-
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.
-
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.
No comments:
Post a Comment