Rockwell Automation 5370-CMPK Color CVIM Module MATH-PAK User Manual

Page 33

Advertising
background image

Chapter 4

Defining Formulas

4–18

Table 4.D (part 1 of 2)
Operator Definitions

Key / Symbol

Operator Type

*Result

Type

Operator Usage

Format

Operator Function

Mathematical

+

Add

INT/FP

X +Y

Adds the right operand to the left operand.

Subtract

INT/FP

X – Y

Subtracts the right operand from the left operand.

*

Multiply

INT/FP

X

*

Y

Multiplies the left operand by the right operand.

/

Divide

INT/FP

X / Y

Divides the left operand by the right operand.

±

Unary minus

INT/FP

±

X

When placed to the immediate left of an operand, it
negates the numeric value of the operand.

%

Modulo

INT/FP

X % Y

Produces the whole number remainder of the division
of the left operand by the right operand.

ABS

Absolute value

INT/FP

ABS(X)

Produces the absolute value of the listed operand
(negates the value if it is negative).

SQ

Square

INT/FP

SQ(X)

Computes the square of the listed operand.

SQR

Square root

FP

SQR(X)

Computes the square root of the listed operand.

DST

Distance

FP

DST(X

1

,Y

1

,

X

2

,Y

2)

Computes distance from a point A to a point B – given
four listed coordinate operands X

1

, Y

1

, X

2

, and Y

2

– by

computing the square root of the sum of the squared
differences (X

2

–X

1

and Y

2

–Y

1

).

SIN

Sine

FP

SIN(X)

Computes the sine of a listed operand (angle –
assumed in degrees). Returns a fixed point number.

COS

Cosine

FP

COS(X)

Computes the cosine of a listed operand (angle –
assumed in degrees). Returns a fixed point number.

TAN

Tangent

FP

TAN(X)

Computes the tangent of a listed operand (angle –
assumed in degrees). Returns a fixed point number.

ARC

Arc (prefix to

SIN, COS, or

TAN)

FP

SIN

ARC COS (X)

TAN

ARC combines with SIN, COS, or TAN function, to
create the respective inverse function – arcsine,
arccosine, or arctangent. These inverse functions
produce an angular result (in degrees).

Logical

AND

Logical AND

INT/FP

X AND Y

Produces a “1” result if both the left and right operands
are nonzero; otherwise, produces a “0” result.

OR

Logical OR

INT/FP

X OR Y

Produces a “1” result if either the left or right operand
is nonzero; otherwise, produces a “0” result.

NOT

Logical NOT

INT/FP

NOT X

Used to invert a logical value – Produces a “0” result if
the operand is nonzero; produces a “1” result if
operand is 0.

*

INT=integer format. FP = fixed point (decimal) format

Advertising