skip to main content
RiverWare Policy Language
Executing DMIs from RPL
The following two changes were made to the utility that executes DMIs from RPL blocks:
Individual DMIs vs Groups
Individual DMIs can now be executed from RPL blocks. Previously only DMI groups could be executed.
Database DMIs
Database DMIs can now be fully executed from RPL blocks. Previously, there were issues executing Database DMIs, particularly that executing a HDB dataset would not ask for a login and would post a meaningless message.
Link to External Documentation
Functionality was added to allow you to link a RPL set to documentation that resides in a separate file viewable by commonly used programs. The following is an overview of the capabilities, additional information can be found RPL External Documentation in RiverWare Policy Language (RPL):
• From a RPL dialog, you are able to easily access external documentation for the RPL item associated with that dialog. This button only appears once the documentation is configured.
• The four supported types of documents are:
– HTML,
– MS Word,
– PDF, and
– plain Text
• You are able to specify the applications for both viewing and editing each type of document.
• Two modes of access are provided:
– Edit - you can view, create, and change the contents of the document.
– View - you can view but not change the contents of the document.
• The granularity of the documentation is flexible. You can associate a separate document with each RPL object within a RPL set or you can document an entire RPL set with a single document.
• When using HTML, the application can open to the most relevant portion of the document.
• The user can create an HTML template of the RPL set that contains the description field for each object. The user can then expand the documentation using an HTML editor.
New Predefined Functions- GetSeriesSlots
The GetSeriesSlots RPL predefined function was added. This function takes an Object as an argument and returns a list of visible series slots on that object. See GetRunIndex in RiverWare Policy Language (RPL) for more information
RPL Debugging
As a first step towards future debugging of RPL execution, RPL expressions now optionally save the value to which they last evaluated and you can easily view these values.
To enable this feature, in the RPL Parameter dialog (Policy RPL Parameters), select the toggle which enables RiverWare to collects RPL debugging information, i.e., whether or not values are cached during RPL expression evaluation. This is a workspace-level toggle and applies to the execution of all RPL expressions associated with the current model. Note that collecting this information (and, more generally, supporting interactive debugging) has a significant impact on both computation time and memory usage.
When RPL debugging has been enabled, the user can interact with the RPL editor windows to view execution data. At any time between runs or when a run in paused (through the Run Control dialog) when the user selects a RPL expression, if that expression has been evaluated at some point, then the last value to which it evaluated is displayed in a tooltip.
The value shown is the last value of that expression at either the end of the run or the end of the timestep (when stepping). Multiple evaluations of an expression may lead to different results. Also, if that expression has not evaluated, no value will be shown.
RPL File Menus
On most RPL Editor menus, the File menu was improved to better indicate the type of RPL set that you would like to open or save. Depending on the application, this includes a RBS Ruleset, Global Function Set, or Optimization Policy Set. Also, the cascading Reopen menus were added to the File menu.
RPL Global Function Sets
Global functions were added to allow you to define a function in one location and then use it in any of the RPL applications including:
• Rulebased Simulation Rulesets,
• Optimization Policy Sets,
• Object Level Accounting Method Set,
• MRM Rules, and
• RPL Expressions Slots.
Global RPL Functions exist within Global Functions Sets. Multiple Global Function Sets can be opened within a RiverWare session and apply to all RPL applications in that model. All functions must have a unique name and cannot conflict across global function sets. All relevant global function sets should be opened before trying to load a ruleset.
For more information on global functions, see Global RPL Functions in RiverWare Policy Language (RPL).
RPL User Interface
Undo/Redo
Undo/Redo has been added for editing RPL expressions and is available from the Edit menu, right-click context, or keyboard shortcuts (ctrl-z undo; ctrl-shift-z redo)
Undo and redo are on a per-dialog basis; the dialog must be selected before the undo/redo operation is performed. Also, the history of changes is preserved if a RPL dialog is closed and re-opened, but is not preserved if the set is closed.
The number of undos/redos is only limited to take you back to the original expression; there is no artificial limit imposed
Cut/Delete Operations
The cut and delete operations for RPL editing were modified to exhibit more standard behavior:
• delete - deletes the selected item (expression or statement)
• cut - copies the selected item to the copy buffer then deletes it
There is one minor exception: if an empty expression which is an item in a list is selected, that list item is removed from the list. Thus to remove a non-empty expression from a list, one can cut/delete it twice -- the first cut will clear the expression, the second will remove it.
In addition, the Clear operation was removed (Cut and Delete now subsume Clear).
Numeric Syntax
RPL numeric value and units are now specified with double quotes instead of square brackets and double quotes. For example, previously, you would type:
1000 [“acre-ft/day”]. Now you can type 1000 “acre-ft/day”
On input the double quotes can be omitted when the unit name is a single word with no punctuation (i.e., does not contain '-', '/', '*', or a multiplicative factor).
Examples of valid syntax:
• 1.0
• 1.0 cfs
• 1.0 “cfs”
• 1.0 “cfs-day”
• 1.0 “1000 cfs-day”
The old syntax is still supported for input, but it will be display and written to files using the new syntax.
Display of Brackets, Braces and Parenthesis
On RPL expressions, the display of parentheses, brackets and braces were improved.
RPL Icons
Changed the RPL icons further to improve the interface. Each type of RPL item now has a unique letter, icon, and/or color:
 
Letter
Icon
Item
 
Letter
Icon
Item
G
Goal
 
S
Set
M
Method
 
=
Statement
P
Policy Group
 
F
User-defined Function
F
Predefined Functions
 
U
Utility Group
R
Rule
 
U
Utility Group of predefined functions
RPL Dialog Set buttons
The above icons were added to RPL dialogs to show you the type of the current dialog. Also the “Set” icon button was added to allow you to show the containing set for the given RPL dialog. Select the button to follow back to the upper level dialog and the tree view will be expanded and the appropriate item will be selected.
Sizing of Windows
RPL dialogs were modified to better allocate space when re-sizing the window. When an execution constraint is shown, the statement display portion of the RPL block (rule) editor dialog (i.e. the upper half) will now take as much vertical space as is available. For example, if you resize the dialog, the statements frame will grow and the description and execution constraints frames will retain their vertical heights, to a certain degree. There is still area for improvement in this operation.
Revised: 07/03/2024