Rockwell Automation 5370-CVIM2 Module User Manual

Page 369

Advertising
background image

5

Chapter

Chapter 7

Inspection Tools

7–131

For example, the following formula calculates the average area of the four
smallest contours in a window using a black or white contour operation:

avg([Win1.Area1],[Win1.Area2],[Win1.Area3],[Win1.Area4])

In this example, if

Area1

= 907,

Area2

= 1022,

Area3

= 1202, and

Area4

=

1302, the formula would calculate an average value of 1108.250.

*max –– The “

max

” (maximum) function finds the largest value in a list of

values. The values must be separated from each other by commas.

For example, the formula “

max(2,34,458,1,8977)

” will return a result of

8977.000.

*min –– The “

min

” (minimum) function finds the smallest value in a list of

values. The values must be separated from each other by commas.

For example, the formula “

min(2,34,458,1,8977)

” will return a result of

1.000.

*med –– The “

med

” (median) function sorts a list of values in ascending

order, then returns the value of the center position for an odd number of
values, or the average of the two center values for an even number of values.
The values must be separated from each other by commas.

For example, in a formula containing an odd number of values, such as

med(82,3,86,2,43)

,” the formula first sorts the values in ascending order,

(2,3,43,82,86), then returns the center value, 43.000.

In a formula containing an even number of values, such as

med(82,3,86,2,–15,8)

,” the formula first sorts the values in ascending

order, (–15,2,3,8,82,86), then returns the average value of the two center
values, 5.500.

*mode –– The

mode

function finds the one value in a list of values that

appears most often. If no value appears any more often that any other value,
the mode function returns the lowest value in the list. The values must be
separated from each other by commas.

For example, the formula “

mode(2,3,2,3,3)

” will return the value 3.000,

since that value occurs more often than 2.

*std –– The “

std

” (standard deviation) function calculates the standard

deviation of a list of values. It calculates the standard deviation for the list of
values.

For example, the formula “

std(34,32,35,37,36,33)

” will return 1.708,

which is the standard deviation for this list of values.

*var –– The “

var

” (variance) function calculates the “variance” of a list of

values. The sequence of calculations is this: Compute the average value of
the values in the list; subtract the average value from each value in the list;
compute the square of each of these differences; compute the average value
of the squared differences.

Advertising