skip to main content
RiverWare Policy Language
RPL User Interface
Comments on Statements
Previously, comments could be added to RPL expression, but not RPL statements themselves (Assignment, Print, ForEach, etc...). Now the user can add comments to RPL statements using the Add Comment or Delete Comment buttons on the palette.
DateTime Support Changes
The RPL DateTime syntax was modified for a more compact notation for referencing the current timestep. The symbolic DateTime grammar was extended to support “t” for “current timestep”, “t-1” for “Previous Timestep”, and “t+1” for “Next Timestep”. In addition, numerics within the date/time string no longer require the unit of “Timestep”. For example, the DateTime notation “Start Timestep + 2 Timesteps” is now represented as “Start Timestep +2”. All DateTime are shown in this new format, the user can still type in the old format and they will be automatically converted.
Editing types in RPL Looping variables
Menu based entering of RPL types of looping variables (For, With, While) in RPL expressions has been provided. Users can now individually select and edit the type and name of a variable name declaration. To edit a type, the user double-clicks on the type, is presented with a pull-down menu listing all the RPL types, and the user selects one of these types. The user edits a name as they would a literal value. The inline editor prevents the user from entering invalid names. See Data Types for Looping Variables in RiverWare Policy Language (RPL) for more information.
Note:  Previously, it was possible to copy/paste a type/name pair together, now the type and name must be selected/copied/pasted individually.
Editing Values
Users no longer have to hit enter when editing literal values in RPL editors. Clicking the mouse outside of the edit field is considered completion of the edit.
Modified display of looping expressions
The display of the RPL FOR expression was modified from:
to:
This provides an explicit visual cue to what is done with the result of evaluating the body.
Also, the display of the WHILE expression was modified to:
Open and Load
When using the Open and Load command from the Policy menu RiverWare will now open the ruleset whether it is valid or not. Previously, if the selected ruleset was not valid RiverWare would post a message in the Diagnostic Output and not open the set. Now, RiverWare still posts the message but also open the set without loading it.
Policy Group Priority Range
The RPL list view in the RPL dialog has been modified to show the priority range for Policy Groups whose members are not currently visible. For example, in the screenshot, the group Big Res Rules contains rules 1-5 and the group Small Res Rules contains rules 8-11.
RPL Function Argument Editor
This dialog provides a structured interface to specifying the type and names of a RPL function's arguments. For example, in the screenshot, there are two existing arguments (OBJECT res, and DATETIME Date) and the user is configuring a third argument. The old way of specifying function arguments by entering them directly into the function editor is still supported.
RPL Value Inline Editor Changes
The RPL value inline editor now uses a pull-down menu which provides a history of previous edits within the dialog. This effects the editing of literal values within RPL expressions. As before, the user initiates the edit by double-clicking on the terminal expression they wish to edit (a value or an empty expression). This creates an inline editor which allows the user to edit the value in place. If an existing value is being edited, the editor is initialized with the text corresponding to that value, otherwise it is empty. This editor differs from the previous one in the following ways. At the right-hand side of the editor is a button which provides access to a menu containing the previous values entered in the dialog. There is also a popup menu (accessible by right-clicking within the editor) which provides basic editing operations such as copy and paste. See Entering Values in RiverWare Policy Language (RPL) for more information.
This means there are three ways to edit the contents of the inline editor.
• Type in a value,
• Select one of the values in the pull-down menu, or
• Use the editing operations (copy/paste) in the popup menu.
The user signals completion of editing by hitting Enter or by clicking somewhere outside of the inline editor. This closes the editor and replaces the originally selected expression with the entered value. As before, if the entered text is not valid the user is provided with a notification window and the expression reverts to its original value. The entered text is added to the list of values which will be accessible in the inline editors menu the next time a value is edited in the dialog whether it is valid or not. C
Tip:  This feature is useful when the user enters invalid text in a RPL expression. Previously the user would have to retype the entire input, with the new features, the user can simply select what was previously typed and correct any mistakes within the text entry.
TCL user-defined functions are no longer supporter
The RiverWare Policy Language (RPL) no longer supports Tool Command Language (TCL) user-defined functions. When the RPL set is loaded (the set can still be opened) and an enabled Tcl function is found, an error is issued: “RPL no longer supports Tcl functions. Please remove or disable the function.” Please convert any TCL functions into RPL functions.
RPL Palette
NanToZero Operator
A NanToZero operator was added to the RPL Palette. This operator has a single numeric sub-expression; that sub-expression is a lookup of an invalid value (NaN), then NaNToZero evaluates to 0.0 in the units of the lookup slot. Otherwise it simply returns the value in the lookup slot, unchanged. This operator provides a simple and efficient way to treat a missing slot value as zero, a common requirement of water accounting policy. This is only useful when the sub-expression is an object/slot lookup expression. See Miscellaneous Buttons in RiverWare Policy Language (RPL) for more information.
Tool Tips
Mouse-over tool tips were added for all palette buttons. These will help the user find the appropriate button without having to look in the help.
Predefined Functions
The following predefined functions were added or modified. If the user previously had a user-defined function of the same name, the user-defined function name will have to be changed or the set will not load
FloodControl
The FloodControl function executes the selected flood control method on the computational subbasin and returns slots and values to set on those slots. Now, the function also returns the Target Balance Level is and its value. The Target Balance Level stores what was previously shown on the Temp Balance Level slot. See FloodControl in RiverWare Policy Language (RPL) for more information.
GetAccountFromSlot
GetAccountFromSlot(SLOT slot) predefined function has been added to the RiverWare Policy Language. Given a Slot, the function return its parent account name as a String. It is an error if the slot is not on an account. See GetAccountFromSlot in RiverWare Policy Language (RPL) for more information.
GetObjectFromSlot Function
GetObjectFromSlot(SLOT slot) predefined function has been added to the RiverWare Policy Language. Given a Slot, the function return its parent Object. The slot must either be on a Simulation Object or an account, otherwise it is an error. See GetObjectFromSlot in RiverWare Policy Language (RPL) for more information.
GetRowIndexByDate Function
GetRowIndexByDate(SLOT slot, DATETIME date) predefined function has been added to the RiverWare Policy Language. Given a slot with rows indexed by date, this function returns the 0-based numeric index corresponding to a given date. The value -1 is returned if the given date is not within the date range of the slot. This function is applicable to the following types of slots: Series Slot, Table Series Slot, and Periodic Slot. It is considered an error if the slot is not indexed by date. See GetRowIndexByDate in RiverWare Policy Language (RPL) for more information.
GetSlotName Function
GetSlotName (SLOT slot) predefined function has been added to the RiverWare Policy Language. Given a SLOT, return the slot name portion of the full name as a String. See GetSlotName in RiverWare Policy Language (RPL) for more information.
HasRuleFiredSuccessfully Function
The RPL predefined function HasRuleFiredSuccessfully now accepts the string “Current Rule” as a reference to the currently executing rule (block). This prevents the user from having to type in the full name of the rule and edit the name each time the rule name changes. See HasRuleFiredSuccessfully in RiverWare Policy Language (RPL) for more information.
HydropowerRelease
The HydropowerRelease function determines the releases to meet an energy demand or load. If the Seasonal Load Time method is selected on a reservoir, the HydropowerRelease now also returns the Load slot and value to set on that slot. See HydropowerRelease in RiverWare Policy Language (RPL) for more information.
Run Time Function
RunTime predefined function has been added to the RiverWare Policy Language. This function returns the number of seconds which have elapsed since the current run began, or if called from outside a run, the total number of seconds within the last run. This function is useful for analyzing performance. See RunTime in RiverWare Policy Language (RPL) for more information.
Slot Functions now work on Table Series Slots
The following functions take a slot and time range as input and either gets or sums values within a range on the slot. These were extended to work on Table Series Slots:
• GetSlotVals
• GetSlotValsByCol
• SumSlot
• SumSlotByColumn
• SumSlotSkipNaN
• SumSlotByColSkipNaN
• SumFlowsToVolumne
• SumFlowsToVolumeSkipNaN
• SumFlowsToVolumeByCol
• SumFlowsToVolumeBySkipNaN
RPL Set Analysis - Find Next Button
In the Search field, the “Find Next” button has been replaced with two simple arrow icon buttons, up-triangle and down-triangle to search forward or backward, respectively. In addition, pressing Return in the search box now searches forward.
Executing DMIs from Rules
When executing a DMI from a rule (using pre and post execution DMIs) it is no longer necessary to execute a DMI group. Now a rule can execute a single DMI directly.
Revised: 07/05/2022