Slot Sets
Many utilities in RiverWare require you to specify a set of slots, e.g., as part of the configuration of DSS datasets, scripts, and output devices. You can either specify the slots in the configuration of each utility or you can create and name a collection of slots in the Slot Set Manager and refer to that set in one or more utilities.
A Slot Set is a named collection of slots. Slot sets support wild card entries and can be referenced in contexts that require a user-specified set of slots, such as Script actions, DMI datasets, and Output Devices. Where the same set of slots is used in multiple contexts within the same model, the use of named slot sets eliminate duplication of input effort and ensures consistency across the multiple uses. Within RPL, Slot Sets provide a reusable collection of slots that can be referenced by a RPL predefined function.
Slot Set Manager
Slot sets are created, deleted and organized in the Slot Set Manager.
To open the Slot Set Manager, use the Workspace, then Slots, then Slot Set Management menu. The Slot Set Manager dialog appears.
The upper portion (the Sets panel) shows the sets defined in the model; if one of these slots is selected, the lower portion (the Slots panel) lists the slots in the selected set.
Figure 6.56 shows the Slot Set Manager dialog for a model with multiple sets.
Figure 6.56
The selected set in the Sets panel is highlighted in blue, and its slots are shown in the Slots panel. In addition to the slot set name, the Sets panel shows the number of slots in each set and whether the set is Dynamic or Static.
To rearrange the order of the sets, use the arrow buttons to move the selected row up or down. To create a new Set, enter a name in the Add Set field, choose whether it is Dynamic (or conversely Static) and then select the green Plus button. A slot selector will open allowing you to define the slots in the set.
Note: Choosing whether a set is dynamic or static must be done at the time the set is created. It influences how the slot selection is made. The type of set cannot be changed later; although you can delete and re-create it.
The two types of sets are as follows:
• Static Slot Sets contain an ordered list of slots that will not change automatically. You can add and remove slots from the set manually, as well as rearrange their order, but the set will not be updated if slots are added to the model. See
Static Slot Sets for details.
• Dynamic Slot Sets contain a symbolically specified slot selection. With this type of set, if you add an object or slot to the model that meets the set definition, it will automatically be added to the set. See
Dynamic Slot Sets for details.
Static Slot Sets
Static Slot Sets contain a list of slots that will not change automatically. The contents and order of slots in a static set are specified when the set is created and only change when the slot set is edited.
Figure 6.57 shows the resulting Static set.
Figure 6.57
Notice the buttons to rearrange the slots and add or remove slots from the set.
Dynamic Slot Sets
Dynamic Slot Sets contain a symbolically specified slot selection. The contents and order of the slots in a dynamic slot set are determined when the set is used, by evaluating the set specification. The set specification may include wild cards and filters, which could lead to different results for different evaluations.
Figure 6.58 shows the resulting set.
Figure 6.58
Note: There are no buttons to rearrange the slots, as the order in a dynamic set is indeterminate. Also, you cannot add or remove slots, but instead you can Edit Set to modify the selection.
Referencing Slot Sets
The power of Slot Sets is realized when you refer to a Slot Set from various applications. Examples include Scripts setting one or more slots, DMI slot selections, and RPL accessing lists.
This section describes how to reference sets in the Selector and from RPL and DMIs.
Using Slot Sets When Selecting Slots
Slot sets can be referenced in most places that a Slot Selection is made. To refer to a Slot Set, in the Selector, choose
Use Slot Set instead of
Create Selection.
Figure 6.59 shows both views.
Figure 6.59
Within the Use Slot Set view, select the desired Slot Set. The slots in that set are shown in the lower, non-editable panel. Select Ok to confirm.
See
Use Slot Set for details.
Note: When the application only needs one slot (like adding a curve to a plot), the first slot in the Slot Set is used.
Using Slot Sets in RPL and DMIs
Slot Sets can be referenced from RPL logic using the
ListSlotSet predefined function; see
ListSlotSet in RiverWare Policy Language (RPL). This function returns a list where each item is a slot in the set.
Within Database DMIs, Slot Sets can be referenced within the Slot Selection as described above. Within Control-File Executable and Trace Directory DMIs, Slot sets can be referenced using the key word SlotSet and the set name. Thus, the slot specification of a control file entry is:
SlotSet.<slot set name>
For example, SlotSet.Reservoir Hydrologic Inflow: file=~/%o.%s would expand to all of the slots in the Reservoir Hydrologic Inflow set.