Download PDF
Download page The Conditional Expression Editor.
The Conditional Expression Editor
The Conditional Expression Editor ("Figure: Conditional Test Editor - Pick Value") is displayed in the Edit Panel of the Zone-Rules tab whenever the selected node in the Zone-Rules tree is an IF or ELSE IF conditional block of an IF_Block.
Figure: Conditional Test Editor - Pick Value
The Conditional Expression Editor is divided into three parts—a name and description row and two panels:
The name field is labeled with the conditional type (e.g., IF Conditional). Unlike the rule editors, this name field is editable. Enter a name or label for the conditional block in this name field. Each conditional block was given the label Untitled by default in order to remind you to give each conditional block a more appropriate label. Use a label that describes the condition(s) defined in the conditional expression or the set of operations that will be added if the conditional expression evaluates to TRUE. And, if you change the conditions, be sure to change the label.
The upper panel gives you the ability to create one or more conditions or comparisons. Each condition is a row in the table. A single condition (row) forms a simple conditional expression. Two or more conditions (rows) can be joined with logical operators to form a compound conditional expression.
The function buttons to the right of the table are for managing the rows, in the table:
Add Cond.—adds a row to the bottom of table. Since the table starts out empty, you must add at least one row to specify a simple conditional expression.
Del. Cond.—deletes the selected row from the table.
The order in which conditional expressions are evaluated is similar to that for mathematical expression. The evaluation order for conditional expressions follow these three basic principles:
- left to right,
- comparison operators before logical operators, and
- if parentheses are used, innermost parenthetical expressions first, moving out from there.
Since the order of the conditions in a compound conditional expression may be important when it is evaluated, functions to rearrange the order of the conditions in the table are provided:
Move Up—swaps the selected row with the row above it.
Move Down—swaps the selected row with the row below it.
When using these functions, think of the first row in the table as the left-most comparison in the compound conditional expression and the last row as the right-most comparison. Like the thumbnail plots in the rule editors, the last function button will help with visualizing what you define in the table:
Evaluate—assembles the rows in the Conditions table into a string and displays the string in a message box so that you can verify that your table entries describe the conditional expression you intended.
The lower panel is for specifying each condition that forms the conditional expression. A condition is formed by two operands, Value 1 and Value 2, and the comparison operator between them:
Value 1 and Value 2—The two operands can be defined as being one for the variable types listed in "Table: Available Variable Types and Their Required Data", which indicates which variable types can be used by each operation and the data required to define them.
Table: Available Variable Types and Their Required Data
Value 1 | Value 2 | Data Required |
Constant | Constant | Enter a numeric value in the text field |
Date/Time | Date/Time | Enter a specific calendar date (e.g., 31Oct1949) and a clock time (0000—2400) in Date and Time fields. A calendar tool can be opened using the |
Current Time Step | Current Time Step | - No user input required - |
Time Series | Time Series | Use the Pick Value button to open the Independent Variable Definition Editor. Use it to select the specific model variable, state variable, or external variable you need. |
Seasonal | Seasonal | Enter a specific day of the year (e.g., 01Apr) in the Date field. |
Time of Day | Enter a clock time (0000—2400) | |
Day of Week | Enter a weekday (e.g., Sun, Mon, etc.) |
The operators that can be used to compare Value 1 to Value 2 are listed in "Table: The Comparison Operators".
Table: The Comparison Operators
= | equal to |
> | greater than) |
>= | greater than or equal to) |
< | less than) |
<= | less than or equal to) |
!= | not equal to) |
The Logical Operators—are AND and OR. Each condition after the first must be joined to the prior condition(s) with a logical operator.
You can include parentheses in your conditional expression by setting Value 1 to the required parenthesis. If you set Value 1 to an open parenthesis ((), the operator and Value 2 selectors will be greyed-out (deactivated); however, you must specify the logical operator that precedes the parenthesis. If you set Value 1 to a close parenthesis ()), all other fields of the lower panel will be greyed-out (deactivated) since the closed parenthesis forms the end of a condition. "Figure: Example of a Compound Conditional Expression and the Associated Evaluate String" shows an example of a compound conditional expression and illustrates the use of parentheses and logical operators.
Figure: Example of a Compound Conditional Expression and the Associated Evaluate String