Analysis: BOR Truckee LBAO 1.2: Sum Flows to Volume
Phil Weinstein, David Neumann, Edie Zagona, CADSWES, 10-26-2017
Document Home:
R:\doc\SlotDialogs\2017\BorLbao1p2-SumFlows-Analysis.docx
The SCT and the Open Series Slot dialog (and other tabular numeric series data displays based on the SlotQtDlg class) present an optionally displayed "Selection Statistics" panel along the bottom of the dialog. This shows dynamically computed stats for the set of selected slot/timestep cells. Both the SCT and the SlotQtDlg displays currently show these computed statistics in the units of the first selected slot:
The BOR Truckee LBAO 1.2 requirement is to show the sum the selected Flow quantities as a Volume. This will be done with the following provisions:
*Currently, the SCT's Integrated Sum value is presented in a scale and units derived from the Flow (or Power) units. The per-time factor is dropped, and the values are automatically scaled to provide a "reasonably sized" numeric value.
The following is a screenshot of an Open Slot dialog showing a Flow-units slot. The arrow indicates the line where the Integrated Sum (Volume) for the selected flow values would appear.
The following two screenshots show an SCT's summation of Flow values and Power values, respectively. Note that the "integrated" units are derived from the "rate" units (Flow or Power).
The SCT's cell selection is represented with the SctSlotTstepSet class. This has provisions for efficiently representing the selection of whole display rows or columns (which correspond to either slots or timesteps, depending on the SCT view's access orientation), and other individual cells. (Care is taken to ensure that no cell is represented redundantly within the selection).
Many operations on the selected set of slot/timestep cells are implemented using a Visitor-patterned class, a subclass of SctSlotTstepSet::ForEachFunction, having a single virtual method:
The process of visiting each slot/timestep cell is taken care of by the SctSlotTstepSet class. All the ForEachFunction subclass needs to do is provide an implementation for this processItem() virtual method.
The following ForEachFunction subclasses are defined in the SCT:
That last one is used to do initial statistical computations on the set of selected slot/timestep cells. The SelectionStatsRecorder::processItem (int slotInx, int tstepInx) function adds the slot/timesteps "integrated sum" (in standard units) to an SelectionStatsRecorder::_integratedSum variable. Individual values are computed using double SctModelData::stdIntegratedValue (int slotInx, const Date_Time& tstepDT) const . That stdIntegratedValue() function very efficiently multiplies the length of the timestep (in seconds) to the rate value for that timestep. This is done very directly -- instead of using the UnitManagers "convertType" utilities. Those would be much less efficient when applied to very large slot/timestep cell selections (many levels of calls with many parameters).
The stdIntegratedValue() method can be adapted for the Open Slot Dialog classes (SlotQtDlg and related classes) for computing the integrated sum (volumn or energy) of a slot/timestep cell in standard units.
The SlotQtDlg class, and related classes, support not only most of the Open Slot Dialogs, but also the Edit Account Dialog, Object Account Summary Dialog, Exchange Balance Dialog and Slot Viewer (for series slots). All can show the Selection Statistics panel for statistics on the selected set of slot/timestep cells -- but only for series slot data (e.g. not for a Table Slot).
The set of selected slot/timestep cells has a different, but functionally analogous implementation (to the SCT's implementation) for the representation of selected slot/timestep cells. This is represented as a list of SlotQDlgSelection instances, each of which representing a contiguous set of timesteps on a single slot. The list of SlotQDlgSelections is encapsulated in its own class. The SlotQDlgSelectionList's computeStats() method computes selection statistics, encapsulated in the SlotQDlgSelectionStats class. The computeStats method explicitly interates over the individual SlotQDlgSelection instances, calling the compileValidVals() method. It is in that method where an Integrated Sum would be computed for "rate" unit types (Flow and Power).
--- (end) ---