Where is the "Enable Rules Model Run Analysis" checkbox state used?
Phil Weinstein, CADSWES, 1-30-2015 (RW 6.6).
(A) Analysis Highlights
- The "Enable Rules Model Run Analysis" checkbox dates back to (ostensibly before) the Qt port of the dialog in Feb. 2005.
- The only significant user feature dependent on complex data whose computation depends on this checkbox being on is: the Rules Effects feature of the Run Analysis Dialog. This includes the Rules Effects panel. The central features on the Run Analysis Dialog DO NOT depend on it.
- BAD: There is a PROFOUND performance problem with the Rules Effects Panel's QTreeView. I was using a version of the Gnats 5580 bug model from Mitch. This feature was effectively UNUSABLE! Huge delays when running, and clicking a different grid cell. In the debugger, I can see that there is virtually constant rebuilding of, and geometry computations in the RulesEffectsTree.
- However, I'm not confident that this GUI performance bug was the motivation for introducing this checkbox. It may have originally been about the time it took to collect the data during a run.
Recommendations:
- Fix the profound Rules Effects Panel performance bug.
- See how enabling/disabling this feature effects model run time.
... These can probably be done separately. After confirming that Rules Effects Panel processing is not occurring when the Model Run Analysis dialog is not shown (or hasn't been shown within the current RiverWare session), model run time testing can be done with a current RiverWare version.
(B) The "Enable Rules Model Run Analysis" checkbox

This checkbox is tied to the following state in Rpl/RuleSetMgr:
- bool _collectingRunInfo;
- bool collectingRunInfo() const;
- Note: default is 'true'.
Checkbox implementation:
- QCheckBox* _ui._rulesAnalysisCheckBox; // declared in QtRun/SimParamWidgets.ui
- See handling in QtRun/QtSimParamDlg.cpp
- This checkbox was introduced BEFORE the Qt port of this dialog in February 2005 by Bill.
(C) RuleSetMgr data structures maintained only when "collectingRunInfo" is set
Major Data Structures:
- Series< cwSet<PriorityType> >* _successfulRules;
- cwSlist<RulesetMgr_RuleInfo> _rulesInformation;
... where
RulesetMgr_RuleInfo consists of these fields:
- QString name;
- PriorityType priority;
- bool succeeded;
Minor Data Structures:
- mutable RplSet* _ruleSetUsedInLastModelRun;
- QString _ruleSetUsedInLastModelRun_shortName;
- QString _ruleSetUsedInLastModelRun_longName;
(D) Public RuleSetMgr functions which provide data dependent on "collectingRunInfo" being set.
Note: See more information about these methods in a detail section below.
- RplSet* RuleSetMgr::getRulesetFromLastRun (QString& ruleSetNameRet) const;
- void RuleSetMgr::getRulesFromLastRun (const Date_Time& when, cwSlist<RulesetMgr_RuleInfo>& rulesInfo) const;
- QString RuleSetMgr::ruleNameFromLastRunByPriority (PriorityType) const;
(E) Dialogs making use of those public RuleSetMgr functions
Modules:
- QtRun/QtRunAnalysisDlg.cpp
- QtRun/RulesEffectsTree.cpp
- Q3GUI/SlotDataTableModel.cpp -- only getRulesetFromLastRun()
- QtSCT/SctModelData.Sim.cpp -- only getRulesetFromLastRun()
The use of the relevant complex data structures are limited to support for "Rules Effects" features (in the first two items above). The screenshots below show the Rule Effects panel with "collectingRunInfo" ON and OFF:

Additional Information
(F) Detail: Functions whose processing is dependent on "collectingRunInfo" being set.
(1) After successfully executing a rule within the loaded RuleSet (in RuleSetMgr::executeRuleset()), the priority integer is inserted into this special time series structure:
- Series< cwSet<PriorityType> >* _successfulRules;
(2) in RuleSetMgr::initRunNotify (RunInfo*), the following are set:
- mutable RplSet* _ruleSetUsedInLastModelRun;
- QString _ruleSetUsedInLastModelRun_shortName;
- QString _ruleSetUsedInLastModelRun_longName;
- Rebuilt: cwSlist<RulesetMgr_RuleInfo> _rulesInformation;
- Reallocated: Series< cwSet<PriorityType> >* _successfulRules;
(3) In RuleSetMgr::runInfoChangedNotify(), this list is cleared:
- cwSlist<RulesetMgr_RuleInfo> _rulesInformation;
(4) bool RuleSetMgr::dumpRunAnalysisData (cwostream&) const ... these methods are called only if "collectingRunInfo" is set:
- dumpSuccessfulRules (cwostream&); ... also see next item.
- dumpRulesInformation (cwostream&); ... also see subsequent item.
(5) bool RuleSetMgr::dumpSuccessfulRules (cwostream&) ... generates the following output only if "collectingRunInfo" is set:
- For each timestep of this time series: Series< cwSet<PriorityType> >* _successfulRules ...
- The priority numbers of successful rules at that timestep.
(6) bool RuleSetMgr::dumpRulesInformation (cwostream&) const ... generates the following output only if "collectingRunInfo" is set:
- From cwSlist<RulesetMgr_RuleInfo> _rulesInformation ...
- The name and priority number of each rule, and whether that rule succeeded.
- NEW: the short and long names of the RuleSet used in the last model run.
(7) int RuleSetMgr::loadSuccessfulRules (Tcl_Interp*, int argc, char** argv) -- used in MODEL FILE LOADING ... loads data only if "collectingRunInfo" is set. (Furthermore, it fails an assertion if that state is not set).
- Series< cwSet<PriorityType> >* _successfulRules;
(G) Detail: Functions whose results are dependent on "collectingRunInfo" being set.
(1) RplSet* RuleSetMgr::getRulesetFromLastRun (QString& ruleSetNameRet) const.
- NULL (no RplSet) is returned if "collectingRunInfo" is off.
(2) void RuleSetMgr::getRulesFromLastRun (const Date_Time& when, cwSlist<RulesetMgr_RuleInfo>& rulesInfo) const
- The 'rulesInfo' return parameter (RulesetMgr_RuleInfo list) will not be assigned elements based on values within this structure:
- Series< cwSet<PriorityType> >* _successfulRules;
- ... it will only have a single element for the "UserInput" priority.
(3) QString RuleSetMgr::ruleNameFromLastRunByPriority (PriorityType) const
- If "collectingRunInfo" is off, an empty string is returned.
- Otherwise, generally, a rule name is returned.
--- (end) ---