Rockwell Automation 5370-CVIM2 Module User Manual

Page 372

Advertising
background image

Chapter 7

Inspection Tools

7–134

sqrt –– The “

sqrt

” (square root) function calculates the square root of the

value entered after the opening parenthesis. Thus, the formula “

sqrt(25)

will return a value of 5.000.

*sum –– The “

sum

” function calculates the expression entered after the

opening parenthesis. Thus, the formula “

sum(1,2,3,4)

” will return a value of

10.000, while the formula “

sum(25/20)

” will return a value of 1.250.

Similarly, the formula “

sum({Tool 1},{Tool 2})

” will return a value of

190.000, where the

Tool 1

result is 43.000 and the

Tool 2

result is 147.000.

Further, “

sum({Tool 1.Area#})

” will return the sum of the area values for

tool 1.

*The

sum

function can perform “list” processing on inspection tools that

produce multiple results, such as a window tool performing a black contour
operation in a window tool. For details of the list processing function, refer
to the Example: List Processing section on page 7–141.

int –– The “

int

” (integer) function converts a floating point value to an

integer. It performs the conversion by truncating the fractional portion of the
value. Thus, the formula “

int(56.034)

” will return a value of 56.000

(“

int(–56.034)

” will return –56.000).

frac –– The “

frac

” (fraction) function converts a floating point value to a

fraction. It performs the conversion by truncating the integer portion of the
value. Thus, the formula “

frac(56.034)

” will return a value of 0.034.

xscale –– The “

xscale

” function returns the “X scale” parameter from the

calibration data pertaining to a specific camera number, which is entered
after the opening parenthesis. The

xscale

function formula takes the form

xscale(C1)

,” where

C1

is a camera number (1 through 6).

The X scale parameter is the computed ratio of the measurement unit (such
as inches) used in the calibration to a linear measurement, in pixels, along the
X–axis. Thus, 311.656 pixels along the X–axis may represent a calibrated
value of 3.000 inches for Camera 1. In this case, the scale factor would be
0.010 (rounded to three places). Therefore, the formula “

xscale(1)

” would

return a value of 0.010.

yscale –– The “

yscale

” function performs the same function as the “

xscale

function , except it returns the “Y scale” parameter.

Advertising