Expression – Rockwell Automation T6200 Compressor Anti-Surge and Capacity Controller User Manual

Page 187

Advertising
background image

Data Structures and Expressions

A-9

Expression

Mathematical and logic expressions are a valid series of constants, variables, and functions that
can be connected by operation symbols to describe a desired computation.

Order of Operations

When an expression contains more than one operation, the Controller performs the operations in
the following order of precedence from highest to lowest:

1. Exponentiation

2. Multiplication, division, and modulo

3. Addition and subtraction

4. Comparison

5. AND

6. Exclusive OR

7. OR

8. Assignment

9. Only if

10. Sequence

Data types and other unary operations are performed as required in the expression. If there is a
tie, expressions are evaluated left to right except exponentiation. To force a different order of
operations, you can supply parentheses in an expression.

You can also use parentheses simply to improve the readability of expression, even if the
parentheses do not change the order in which the Controller would normally perform the
operations.

Spaces between tags, variables, constants, and/or operators are optional and will be ignored
during expression operations. The bracket [] and brace {} characters are used by the ARRAY
function and cannot be used to change the order of an expression operation.

Examples:

Valid Expressions Invalid Expressions


A + B
A+B
A*(B-C)
2 * (4 + A)
((B-3) * 6)/3


[(A-B) * 2]/D

2 * {B-6}

Data conversions are custom to the needs of each operator and the data types of its operands.

Exponentiation (**)

Both operands must be real, fuzzy, or integer. They are converted to real before the operation.
The result is real.

Multiply (*), divide (/), add (+), subtract (-), compare (==, <>, <=, >=)

If either operand is real or fuzzy, both are converted to real: otherwise both operands are converted
to integer. The result is the same as the converted operands.

Advertising