Tutorial 13.3 - User Interface for Scenario Form

Please Note: Our Scenario Engine, AKA Hal, was created to perform virtually any Scenario the operator wishes to create, its potential limited only by need and the imagination.

It is extremely straightforward to use, once the basic premises become familiar to you.

We strongly suggest that you at least View (and preferably mimic) the Video on Building Scenarios below this page. This step by step scenario construction introduces the techniques needed for most scenarios, and will make you familiar with all the tools you will need to turn your own ingenuity loose, create your own stock scenarios, then Play "What If" to your heart's content.

Most of the scenario items are operational, a few likely never used items may remain unusable. If you see any not yet thought of items that you would like created for your uses, please let us know as we wish to expand it relative to need.

The list control has Six columns. This file details the intent and operation of each column.

1. Rule Column:
This column specifies if the line is a condition, a statement, or a logic operator.

We can define a very complex condition, by having a combination of IF, AND, or OR. The following are some samples of conditions:

a. IF X [ DO Z1 DO Z2 DO Z3] - means if condition X is satisfied, changes in the directly following DO lines, Z1, Z2, and Z3 will be applied.

b. IF X AND IF Y DO Z - means if both condition X and condition Y are satisfied, changes in Z will be applied.

c. IF X OR [IF Y AND IF Z] DO W - means if just condition X or both of conditions Y and Z are satisfied, then changes in W will be applied.

To define these conditions in a scenario, each IF or logic operators is in a separate line.

Condition - IF X OR [IF Y AND IF Z] DO W is constructed as follows:
IF X
OR
[
IF Y
AND
IF Z
]
DO W

2. Any/All Column:

Note: The terms "Any and All" refer to those Objects Selected in the Object Column, and not to "Any or All" Objects in the drawing)

a. In every "IF" condition line;
we can introduce a large list of nodes and pipes into the "Object" Column.
Tip: There are a great number of Control Properties. If no specific Object Type is chosen in this Any / All column, the Control Column List will contain all possible Properties for all Objects. T
hus while it is often not necessary to choose a specific object type, selecting an Object Type specifically will reduce the number of options presented to only those applicable in the "Control" List. Thus it makes for easier selection of the desired and applicable property.

ALL = ALL of the hydraulic elements in the "Objects" column list must satisfy the condition to consider the result as true.

E.g. 1: If "ALL Nodes" were selected, all Types of nodes in the "Object" List are considered, and every Node in the list must meet the requirement for the DO to take place.
E.g. 2: If "ALL Junctions" were selected, only the Junctions in the Objects List are considered, and every Junction in the list must meet the requirement for the DO to take place. Other Object Types are NOT considered.

ANY = if ANY single element in the list of objects of this rule, satisfies the condition, the result of the rule is true.

E.g.: If we wished to turn off a Pump if ANY single Node in a group of nodes in the "Any / All" Column, we select "ANY" Node, Junction etc.
If we wished ALL Nodes in the list to be able to turn the Pump On or Off, we would choose "ALL".

b. In every ALL condition line;
ALL is the only appropriate term for the DO line, as DO acts upon all objects specified for action. Thus, when DO is selected, items in the "Any / All" Column change to "ALL"

3. Objects Column:

In this column, we can introduce hydraulic elements which are subject to evaluation for a condition or applying a change.

There are several ways to place Objects into the Objects" Column:

1. Type their IDs separated by comma

2. Select them in the drawing using AutoCAD methods, or by Hydraulic QuickSelect or "Selection Sets". Then, to add the Objects, click "Copy Selected Objects" and the list of all selected objects is added to the rule.

3. By pressing SHIFT key then clicking in this column a ComboBox containing the list of all Saved Selection Sets will appear. By selecting one of them, the IDs of all the objects in that selection set will be copied to this rule.

Viewing and Checking an Object Column List:

For a large list of objects, field shows only "…" .

Verifying all the objects in the list, just by their IDs is very tedious and not practical. If we want to check the objects introduced to a rule, we can click on "Select Objects" when that rule is selected. So it selects all the objects in that rule.

To check all the selected objects one by one, there is a button in "Selection Set" Tab of HydrauliCAD palette named "Copy Selected Elements to Trace". By clicking on that button, it copies the list of selected elements to trace list, so by clicking on "Next" or "Last" icons in toolbar we can select the objects in the list one by one.

To clear the list of objects in a rule, we can clear the edit box or simply deselect objects in the drawing, then click on "Copy Selected Objects".

 
4. Controls:
By clicking in this column, a ComboBox is shown, which contains all the properties of the type of elements we chose in "Any/All" column.
5. · > ? <
It specifies the type of comparison we want to make between an object's property and the value we enter in the next column.

6. Value

To evaluate if a complex condition is satisfied, we need to know how logical expressions are evaluated.

 

Logical Expressions: Relational Operators
A logical expression can only have the values .true. or .false..
Relational operators are used to form logical expressions to determine choice and decision-making structures.
The following Table shows the relational operators and their meanings:

Table 1: Relational Operators
Operator Meaning
= equal to
!= not equal to
< less than
<= less than or equal to
> greater than
>= greater than or equal to

These logical operators are used to compare two values of the same type. Strings could be compared to strings, and numbers to numbers.

Example
Given that the REAL variable Elevation1 has the value 83.4 and the REAL variable Elevation2 has the value 96.3 Table 2 shows possible expressions and their values.
Table 2: Relational Operators
Expression Value
(Elevation1 > 50.0) .true.
(Elevation1 >= 90) .false.
(Elevation1 != Elevation2) .true.

Logical Expressions: Logical Operators
There are also logical operators which are used only between complete logical expressions. (.NOT. operates on one logical expression; all the rest operate on two.) Table 3 shows the logical operators and their meanings.

Table 3: Logical Operators
Operator Meaning
.not. Changes the value of the expression to the opposite value
.and. True only if both logical expressions are true
.or. True if either logical expression is true
.xor. True if only one expression is true (exclusive or)

Example
If a = 3.0 and b = 8.0, then
.not. (a < b) has the value .false.
(a != b) .and. (a < b) has the value .true. (both logical expressions are true)
(a < b) .or. (a > b) has the value .true. (one of the expressions is true)
(a != b) .xor. (a < b) has the value .false. (both expressions are true)


Within the same level of priority, evaluation will proceed from first rule to next.

Rules:
In following rules, parentheses express the priority of expression to be evaluated:


· A .and. (B .or. C) = ( A .and. B) .or. (A .and. C)

· A .or. (B .and. C) = (A .or. B) .and. ( A .or. C)

· .not. ( A .and. B) = (.not. A) .or. (.not. B)

· .not. (A .or. B) = (.not. A) .and. (.not. B)

· [A .and. (B .or. C)] is not necessarily equal to [(A .and. B) .or. C]

To keep logical expressions in Query of HydrauliCAD simple, only .and. and .or. operators are used. The logical operator introduced at the start of every rule, is between the result of last rule and the result of the same rule which operator is in.
Instead of parenthesis, precedence of .and. or .or. operators is specified by a radio button in "Hydraulic Quick Select".