i_ispare2 = i_ispare2 == 60 ? 0 : i_ispare2 ;
This sets up a counter which is incremented every second. When the counter reaches 60, it is then reset
back to 0.
11.15 Operator Priority and Parenthesising
Operator prioritising means you may occasionally get unexpected results from an equation. Rather than
must consider the priorities of each operation, and write your equation accordingly, it is easier to specify the order
in which you want your calculation evaluated yourself. This can be performed using the parentheses, or brackets.
For example:
8 - 3 * 2 = 2
or (8 - 3) * 2 = 10
It is possible to layer parentheses. In this case the innermost expression will be evaluated first. i.e.
(2 * ((6 - 3) * 3)) = 18
It is possible to have up to 100 levels of nested parentheses.
The priorities are given in the list below, highest priority first. Those symbols adjacent have the same
priority, in which case they are evaluated left to right in the equation.
1 ( )
2 ! @ #
3 * / %
4 + -
5 < <= > >=
6 == !=
7 &
8 ^
9 |
10 &&
11 ^^
12 ||
13 ? :
14 LOG POW SIN COS TAN ASIN ACOS ATAN LN
11.16 Operators: Conditional Jump Loop Labels (IF$LABEL,
$LABEL:)
InSpec UCL can jump to sections of code depending on the logical result (True/False) of a conditional
equation. This is a powerful tool that allows actions to take place only when certain conditions are calculated and
met in other areas of the UCL file. In algorithm terms this allows for the implementation of conditional loops. A
UCL file can switch between functional blocks of code based on user defined conditions.
Every Conditional Jump Loop MUST have two parts.
1 - The conditional part label, IF$TEST1 = [condition to be met. Returns True or false];
and
2 – The jump section label. If the condition to be met is true, then the code will jump to the first line after
$TEST1: The next equation/line in the file after this label will then be calculated.
Note that the 2 parts (conditional label and jump label) are associated by sharing the same name –
TEST1 in the example above. This is important when you include several conditional statements in a file. E.g.,
IF$TEST1=equation; requires associated jump label $TEST1:
IF$TEST2=equation; requires associated jump label $TEST2:
IF$TEST3= equation; requires associated jump label $TEST3: