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

Chapter 4
Defining Formulas
4–22
Subtraction example: The following formula uses the subtraction operator to
find the difference between two gage measurements:
GAGE2 – GAGE1
In this example, each of two gages is set to measure the X position of the
center of an object (see Figure 4.8). Two gages are used, because the objects
being measured are of different colors, so each of the two gages is assigned
the appropriate color. The above formula subtracts the gage 1 result from the
gage 2 result, yielding the horizontal distance between the two objects.
Figure 4.8 Example application, using the subtraction operator
Gage 1
X
X
Gage 2
Unary minus operator:
Format/Usage: The unary minus operator (
) negates the value to its
immediate right in the formula. The unary minus operator can be used with
1) operands, including parenthetical expressions, and 2) operator/operand
portions of the formula – that is, operators of the type that are followed by a
parenthetical listing of operands.
Formula symbol: When you pick the
key to enter the unary minus into a
formula, the “–” (minus) symbol is entered. Take care not to confuse this
with the subtraction operator, which looks the same when entered.
Example usage: Use the
operator to negate the value of an operand:
– GAGE2
*
GAGE3
Use the
operator to negate the value of an operator/operand:
1.250
*
– AVG (GAGE2, GAGE3, GAGE4)