Configure Color Alerts
Use this procedure to define the conditions for which you want to trigger Color Alerts. You can define separate Color Alert configurations for any number of slots.
1. Go to the Edit Series Slot List tab. Alternatively, press Alt+Shft+S.
2. Select the Configure Color Alerts option.
The display changes to show color alert specifications that have already been defined.
3. Right-click a slot in the list and select Edit Color Alerts in the shortcut menu.
The SCT Color Alert Configuration dialog appears for that slot.
4. Select one of the two Condition Type options:
5. Select the Reference Slot.
The Reference Slot is the slot on which the formatting is based. The default selection is the slot to which the Color Alerts are being applied. Alternatively, you can chose the option for Select Slot and then use the chooser button to open the Slot Selector. You would use this option if you want the formatting of a slot to be based on the value in another slot.
6. Define the Color Alert Conditions.
The display of the Conditions panel and the steps to define the conditions depend on which Condition Type is selected.
Define Intervals with Thresholds
Use this procedure to define the threshold values at which you want to trigger Color Alerts when you have selected
Intervals as the Condition Type (see
Select one of the two Condition Type options:). You can configure alerts to trigger with one of the following types of events:
– When the Reference Slot value exceeds a defined fixed value
– When the Reference Slot value exceeds the value of another slot
By default, there is a Normal interval, which uses the default cell flag color. You can define any number of alert intervals and their associated colors.
Note: Each interval is inclusive of its Upper Threshold Value.
a. Add an interval by selecting
Plus .
b. In the Interval Label field, enter an interval name.
The Interval Label will be displayed as a tool tip when hovering over any value in that interval.
c. Proceed as follows, depending on how you want to define the upper threshold for the interval.
• Go to
Step d. to define the upper threshold as a fixed value.
• Go to
Step e. to obtain the upper threshold value from a slot.
d. To define the upper threshold as a fixed value, proceed as follows.
1. Select the Upper Threshold Value option.
2. In the Upper Threshold Value field, enter the upper value.
e. To obtain the upper threshold value from another slot, proceed as follows:
1. Select the Upper Threshold Slot option.
2. Enter the exact slot name directly into the
Upper Threshold Slot entry field. Alternatively, select the
Chooser button to use the Slot Selector to select the slot whose value you want to use to define the upper threshold for the interval.
f. In the Interval Color menu, select the color for the interval. The menu displays all custom colors defined for the SCT. The <default> selection indicates to use the cell flag color.
Note: A custom color entry may apply to cell text, the cell background, or both, depending on how the color entry has been defined.
g. Optionally, repeat
Step a. through
Step f. to define additional intervals. You can delete an interval by selecting
Minus Define Condition Functions
Use this procedure when you have selected
Functions as the Condition Type to trigger Color Alerts with user-defined RPL functions (see
Select one of the two Condition Type options:).
Note: When condition functions are used for Color Alerts, evaluation of the functions can take a noticeable amount of time, so the Color Alerts displayed in the SCT are not updated every time a value changes. Color Alerts are updated at the following times.
• When the SCT opens
• At the completion of a run
• When the SCT is manually refreshed, either by selecting
Refresh from the
View menu of the SCT, or by selecting the
Refresh button
on the SCT tool bar.
a. Create one or more RPL user-defined functions to use as the condition functions.
See
Writing a User-defined Function in RiverWare Policy Language (RPL) for information on how to create a user-defined function. Functions used as SCT condition functions must meet the following criteria.
• Must have a return type of Boolean (true/false).
• Can have no more than four arguments, one of each of the following types: OBJECT, SLOT, NUMERIC, TIMESTEP.
When a condition function uses arguments, the arguments will be filled at the time of function evaluation at each timestep based on the Reference Slot (see
Select the Reference Slot.), where the NUMERIC is the Reference Slot value at that timestep.
The following is an example of a valid SCT condition function.
Assume that the Reference Slot is Aspen.Outflow, and at 12:00 March 16, 2024, Aspen.Outflow has a value of 2,453 cfs. On this timestep, the function will evaluate as
2,453 “cfs” > Aspen.Max Outflow [@”12:00 March 16, 20224]
If the Aspen.Max Outflow is 2,000 cfs on that timestep, the function will evaluate to TRUE, and the Color Alert will be applied based on this condition.
Tip: Most SCT condition functions are expected to be relatively simply and efficient, such as the example shown above. However, RPL is a powerful tool capable of expressing complex logic. Condition functions are evaluated for each timestep, so care should be taken regarding the use of overly complex logic to prevent negative impacts on SCT performance.
b. In the SCT Color Alert Configuration, add a condition by selecting
Plus .
Selecting the Plus button at the bottom left of the dialog will append a new condition to the bottom of the condition list. Selecting the Plus button to the left of an existing condition will add a new condition above the selected condition.
c. In the Condition Label field, enter a name for the condition.
The label will be displayed as a tool tip when hovering over a value for which the condition applies.
d. In the
Condition Function column select the
Chooser button. Then use the Function Selector to select which function to use for the condition.
e. In the Condition Color menu, select the color for the condition. The menu displays all custom colors defined for the SCT. The <default> selection indicates to use the cell flag color.
Note: A custom color entry may apply to cell text, the cell background, or both, depending on how the color entry has been defined.
f. Optionally repeat
Step a. through
Step e. to define additional conditions. You can delete a condition by selecting
Minus g. To re-order the conditions, click on a condition row to select it; then use the up and down arrows at the bottom left to move the condition.
Click and drag over multiple condition rows or use Ctrl + click to select multiple condition rows to move together.
Note: Conditions are evaluated in order from the top of the list to the bottom, and the first condition that evaluates to TRUE is used to format the cell. In other words, if multiple conditions are true, the highest true condition in the list controls the formatting.
Note: If all conditions evaluate to FALSE, the cell is colored using the default flag color.
Note: In the context of SCT condition functions, if a function encounters a NaN during evaluation and thus cannot fully evaluate, it is treated as if it evaluates to FALSE.
7. When you are finished defining Color Alerts, select OK to apply the changes.
The SCT Color Alert Threshold Configuration dialog box closes, and the Edit Series Slot List tab is updated with the Color Alert specifications you have defined.
8. To view the effect, go to the Series Slots tab.
Any values that have exceeded the defined thresholds or satisfy one of the condition functions are displayed using the colors you have defined. Hover over a slot value to see a tool tip displaying the alert that has been applied to that value.
9. To manually update Color Alerts that use condition functions, select
Refresh from the
View menu of the SCT, or select the
Refresh button
on the SCT tool bar.
Note: SCT condition functions for Color Alerts automatically evaluate at the following times.
• When the SCT is opened
• When a run completes
Note: Cells with Color Alert conditions that cannot be fully evaluated are drawn with a dotted pattern and have tool tips indicating the error. This could occur for interval thresholds if the Upper Threshold Slot is not defined, does not exist, or contains NaN. For condition functions, this could occur if a function does not exist, is not valid, or encounters an error on evaluation. Errors in condition functions will also be posted as red error messages in the Diagnostic Output Window.
Related topics