skip to main content
Rulebased Simulation
RPL Analysis Dialog (“Rule Calling Tree”)
The new RPL Analysis Dialog is a tool for analyzing and documenting a RPL set. This highly customizable dialog displays detailed information about all objects in a RPL Set (including descriptions and performance information) and the relationships between these objects. Below is a brief description of the RPL Analysis Dialog.
This new dialog is available from any RPL editor dialog by selecting Ruleset->Ruleset Analysis....
Detailed documentation on the use of the RPL Analysis Dialog can be found in the online help under Rulebased Simulation Documentation. Some key features of the new RPL Analysis Dialog are described below:
• + Three synchronized treeviews onto the entire ruleset:
– 1) the classic groups view
– 2) descending the static call graph (displays which functions are called by an object)
– 3) ascending the static call graph (displays which functions call an object)
• + Selecting an object in one view automatically selects and scrolls to the same object in the other views)
• + Displays information and relationships between any user-selectable object types, including: statements, predefined functions, rules, etc.
• + User-customizable column types, including object descriptions and performance information.
• + Opens any RPL editor dialog, including "Replace existing editor" mode where opening a new dialog closes the previously opened dialog to avoid screen clutter.
• + Allows printing and exporting (tab-delimited text files) of any portion of the views.
• + Navigation shortcuts for each treeview.
New Palette Buttons for Set Operations (where lists are sets)
Union
The set union expression takes two lists and returns a single list that contains the items that are in either list or both lists. Duplicate items are removed.
Intersection
The set intersection expression takes two lists and returns a single list that contains the items that are in both lists.
<L> - <L> Set Difference
The set difference expression takes two lists and returns a single list that contains the items that are in the left hand list but not in the right hand list.
<L> ^ <L> Set Symmetric Difference
The set symmetric difference expression takes two lists and returns a single list that contains the items that are not in both lists. This is equivalent to the expression:
(list1 U list2) - (list1 intersect list2)
This is also equivalent to the expression:
(list1 - list2) U (list2 - list1)
Rules Palette Predefined Functions
Following is a brief description of new predefined functions and changes to existing predefined functions available for use in the RiverWare Policy Language. Details on the use of these functions and the syntax involved are available in the Rulebased Simulation Documentation in the online help.
Modified Predefined Functions
The following predefined functions have been modified to return the account names in ascending priority date order:
AccountNamesByAccountType
AccountNamesByWaterType
AccountNamesByWaterOwner
AccountNamesFromObjReleaseDestination
AccountNamesFromObjReleaseDestinationIntra
(Previously these predefined functions returned the account names in alphabetical order, though this behavior was not a documented feature.)
Slot Sum Functions Now Accept Periodic Slots
RiverWare 4.5 supports periodic slots as arguments to RPL predefined functions which, in prior releases, only supported series slots. Where appropriate, RiverWare uses lookups on the periodic slot at dates in synch with the run series. The following predefined functions were enhanced to work for periodic slots: SumFlowsToVolume, SumFlowsToVolumeSkipNaN, SumSlot, SumSlotSkipNaN, GetSlotVals, GetDisplayVal.
Since Periodic Slots often have multiple columns, new predefined functions were added to sum slots or get slot values by column: SumFlowsToVolumeByCol, SumFlowsToVolumeByColSkipNaN, SumSlotByCol, SumSlotByColSkipNaN, GetSlotValsByCol, GetDisplayValByCol. These functions can also be used to sum columns on Aggregate Series slots.
AccountPriorityDate (STRING AccountName)
This function accepts one STRING argument, an account name, and returns a DATETIME, the account’s priority date. The function fails if the account doesn’t exist or if it doesn’t have a priority date. (PassThroughAccounts do not have a priority date; StorageAccounts and DiversionAccounts have a priority date if the user specified one in the user interface.)
AccountNameFromPriorityDate (DATETIME PriorityDate)
This function accepts one DATETIME argument, a priority date, and returns a STRING, the name of the account with the priority date. The function fails if no account has the priority date.
Note that the two new predefined functions described above can be used with the existing Maplist predefined function to map a list of account names to a list of priority dates, or a list of priority dates to a list of account names.
SortPairsAscending (LIST pairs) SortPairsDescending (LIST pairs)
The input LIST, pairs, must be a list of lists and each member list must contain at least two elements. The pairs are sorted into ascending/descending order by the second element’s value and a list containing the first elements of this sorted list of pairs is returned. Duplicates are not removed.
Sort (LIST)
This functions sorts a list into increasing order.
Reverse (LIST)
This function reverses the order of items in a list.
GetDate (STRING dateText)
This function returns the date which corresponds to the input text. Legal text is the same as is legal for symbolic date/times. In other words, it takes a STRING and turns it into the corresponding DATETIME. For example, the expression
GetDate(“January 1, Current Year”)
is exactly equivalent to the expression
@“January 1, Current Year”
SolveOutflowGivenEnergyInflow
This function returns the outflow of the specified reservoir given a value for energy and inflow.
Inline Comments in Rules
Rulesets (and all other RPL sets) have been enhanced to allow inline comments. Two new buttons have been added to the RPL Palette: Add Comment and Delete Comment. These features are used to add or remove a text comment from the body of the rule or function.
Printing Rulesets
The dialogs used to print RPL sets have been re-implemented in Qt. As part of this work new printing options and features have been made available. Information is available in the online help under Rulebased Simulation Documentation if more detail is required on printing and formatting RPL sets.
Revised: 01/05/2024