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

Page 47

Advertising
background image

Chapter 4

Defining Formulas

4–32

For example, from the list (1, 2, 2, 3, 3), the value 2 and the value 3 both
appear twice. In this case, the value 2 is returned.

Example usage: The formula below finds the mode value among the results
of four object-counting windows:

MOD(WIN1,WIN2,WIN3,WIN4)

In this example, each of four windows is set for object-counting, in order to
identify parts by the number of objects counted (see Figure 4.17). The parts
can rotate from inspection to inspection, so the exact number of objects to be
found in each window is uncertain. Each window identifies object by color,
and by object shape. In this example, if the mode value (most commonly-
occurring value) is not 3, the part is rejected.

Figure 4.17 Example application, using windows and the mode operator

Windows 1-4
each count
objects

Object
identified by
color and
shape

Variance operator:

VAR

The variance operator computes the variance value of the operands and/or
expressions that are listed in parentheses following the operator.

The variance operator computes the variance by:

1) Taking the average of the listed values;

2) Subtracting each listed value from the average, to obtain the difference
from average for each value, then squaring each difference;

3) Adding up all the values obtained in step 2) to obtain the sum of the
squares of the differences;

4) Dividing the sum obtained in step 3) by the number of listed operands.

The variance operator can be used as a means of evaluating variations among
measurements in an inspection.

Advertising