This section describes the following functions and operators available: • Functions
Property Description
Tag List Drops down a list of tags currently used in the project. You can
select a user-defined tag or a system tag. Tags are listed in alphabetical order, user-defined tags followed by System Tags.
Functions & Operators List
Drops down a list of available functions and operators for mathematical, logical, and relational expressions.
Recent Expressions List
Drops down a list of the 10 most recently entered tags, expressions, and control device addresses. Select an item in the list to reuse it for the tag assignment.
• Relational Operators • Logical Operators • Constants
• Order of Precedence
You can access all operators by selecting the Operators and Functions icon located on any screen where you enter an address.
Functions
The equations in the Functions table are based on the following graphic.
Symbol Example Description
SIN(x) SIN(b)=o/h Generates the sine of value x.
COS(x) COS(b)=a/h Generates the cosine of value x.
TAN(x) TAN(b)=o/a Generates the tangent of value x.
ASIN(x) ASIN(o/h)=b Generates the arc sine of value x. This is also known
as the inverse of sine.
ACOS(x) ACOS(a/h)=b Generates the arc cosine of value x. This is also
known as the inverse of cosine.
ATAN(x) ATAN(o/a)=b Generates the arc tangent of value x. This is also
known as the inverse of TAN.
LOG(x) LOG(tag) Generates the natural base logarithm of the value x.
String Functions
In the above examples, assume strString = "Parker Automation". Also assume strTrim = " Xpress ", (there are 3 spaces on either side of the string tag strTrim).
DEG(x) DEG(tag); DEG(2) Converts radians (value x) to degrees.
Symbol Example Description
LEFTSTRING(string,Num berOfCharacters)
LEFTSTRING(strString,4) Returns "Park".
MIDSTRING(string,Start Position,
NumberOfCharacters)
MIDSTRING(strString,2,5) Returns "arker" .
RIGHTSTRING(string,Nu
mberOfCharacters) RIGHTSTRING(strString,3) Returns "ion" .
STRLEN(string) STRLEN(strString) Returns 17.
TRIMLEFT(string) TRIMLEFT(strTrim) Returns "Xpress ". No spaces to the left of
the string but keeps the spaces to the right.
TRIMRIGHT(string) TRIMRIGHT(strTrim) Returns " Xpress". No spaces to the right
of the string but keeps the spaces to the left.
Mathematical Operators
Relational Operators
Logical Operators
Symbol Example Description
+ tag1 + tag2 Addition - sums the left and right values.
- tag1 - 45 Subtraction - subtracts the right value from the left
value.
* tag1 * 2.45 Multiplication - multiplies the left and right values.
/ tag1 / 100 Division - divides the left value by the right value.
% tag1 % 3 Modulus - returns the remainder of the division of
the left value by the right value.
<< tag1 << 4 Bit shift left - shifts the bits of the binary value to the
left, by the number of times specified by the right value.
>> tag1 >> tag2 Bit shift right - shifts the bits of the binary value to
the right, by the number of times specified by the right value.
Symbol Example Description
< tag1 < 50.5 Less Than — TRUE if the left value is less than the
right value.
<= tag1 <= tag2 Less Than or Equal To — TRUE if the left value is less
than or equal to the right value.
> tag1 > tag2 Greater Than — TRUE if the left value is greater than
the right value.
>= tag1 >= 50.5 Greater Than or Equal To — TRUE if the left value is
greater than or equal to the right value.
== tag1 == tag2 Equality — TRUE if the left value is equal to the right
value.
!= tag1 != 0 Does Not Equal — TRUE if the left value does not
equal the right value.
& Tag1 & 12
Result: If Tag1 = 5
Bitwise And — Compares two operands bit by bit. The resulting bit is one only if both bits in the operands are one.
| Tag1 | 12
Result: If Tag1 = 5
Bitwise Or — Compares two operands bit by bit. The resulting bit is one if one of the two bits in the operands is one.
^ Tag1 ^ 12
Result: If Tag1 = 5
Bitwise Exclusive Or — Compares two operands bit by bit. The resulting bit is one if one of the two bits (but not both) in the operands is one.
~ ~Tag1
Result: If Tag1 = 5
5 in binary: 0101 therefore the result is 1010.
Bitwise Not — Changes each one to a zero and each zero to a one.
Constants
Symbol Example Description
_CONST_E E + 2
Result: 4.718281.
Natural exponential function — The value of E is approximately 2.718281.
Returns the constant value of E. E is the natural logarithmic base used in mathematical equations to compute, among other things, compound interest and statistical bell curves.
Use this tag in the Address field of the Tag Editor as part any mathematical equations you need.
Type: LREAL
Initial Value: 2.718281828 Access: Read only
_CONST_PI PI + 3
Result: 6.141592.
Pi— The ratio of the circumference to the diameter of a circle. Approximately 3.141592.
Returns the constant value of pi. Pi is the ratio of the circumference of a circle to its diameter.
Use this tag in the Address field of the Tag Editor as part any mathematical equations you need.
Type: LREAL
Initial Value: 3.141592654 Access: Read only
FALSE FALSE
Result: Address reference is set to FALSE or zero.
Returns a constant value of FALSE. In Boolean, False = 0.
Type: Boolean Initial Value: FALSE Access: Read only
TRUE TRUE
Result: Address reference
Returns a constant value of TRUE. In Boolean, True = 1.
2 * 3 + 4 = 10
but with added parenthesis, the expression is evaluated differently: 2 * (3 + 4) = 14
The following table lists the order of precedence, with the topmost operator evaluated first: