Rockwell Automation 5370-CMPK Color CVIM Module MATH-PAK User Manual
Page 44
![background image](/manuals/580817/44/background.png)
Chapter 4
Defining Formulas
4–29
When the value of
GAGE2.3
is positive, the conditional expression
(GAGE2.3 < 0)
equals 0, so that 0 is added to the arctangent value.
Note that the previous example formula does not provide positive angular
measurements for arctangent values between 0
°
and –90
°
(see Figure 4.15),
which would correspond to positive angular measurements from 270
°
to
360
°
. In order to supply values from 270
°
to 360
°
rather than values 0
°
to
–90
°
, you could redefine the formula to also conditionally add 360:
ARC
TAN(GAGE2
/
GAGE2.3)
+
180
*(GAGE2.3
<
0)
+
360
*
(GAGE2.3>0
AND
GAGE2
<
0)
If the value of
GAGE2.3
is positive (meaning the object is to the right of
the workpiece center), and the value of
GAGE2
is negative (meaning the
object is above the workpiece center), the conditional / logical expression
(GAGE2.3>0
AND
GAGE2
<
0)
equals 1. The value 1 is multiplied by
360 and added to the arctangent value. As shown in Figure 4.15, the operand
GAGE2.3
would be a positive value, and the value of
GAGE2
is negative,
so that 360 would be added to the arctangent value –55, for a formula result
of 305.
Figure 4.15 Example application: Finding angular results greater than 270
°
X
q
q
= –55
°
(arctangent
measure of the
object relative to the
workpiece center)
Angle of object, relative to
workpiece center (305
°
)
Statistical Operators
This section discusses the statistical operators, which include
AVG
(average),
MAX
(maximum),
MED
(median),
MIN
(minimum),
MOD
(mode), and
VAR
(variance).
Format/Usage: To use any of the statistical operators, enter the respective
operator
(AVG, MED,
etc.
)
– which includes the open parenthesis “(” – then
enter the operand or expression, and then enter the close parenthesis “).”
The statistical operators can be used with 1) single operands, 2) operator/
operand expressions, such as arithmetic expressions, 3) parenthetical