beautypg.com

Campbell Scientific CR9000X Measurement and Control System User Manual

Page 313

background image

Section 8. Processing and Math Instructions

If number1 is:

Number2 is:

The result is:

-1 Any

Number -1

-1

NAN (not a number)

NAN

0 Any

Number

Number 2

0 NAN

NAN


Expressions are evaluated to a number (Section 4.5) and can be used in place of
one or both of the numbers. Comparison expressions evaluate as True (-1) or
False (0). For example:

If Temp(1) > 50

OR

Temp(3) < 20 Then

X = True
Else
X = False
EndIf

See Section 4.2.11.4 Logical Expressions for more on Logical Expressions

PeakValley (DestPV, DestChange, Reps, Source, Hysteresis)

PeakValley is used to detect peaks and valleys (local maxima and minima) in a
signal. When a new peak or valley is detected, the new peak or valley as well
as the change from the previous peak or valley are stored in variables.

Parameter
& Data Type

Enter

PEAKVALLEY PARAMETERS

DestPV
Variable or
array

Variable or array in which to store the new peak or valley. When a new peak or valley is
detected, the value of the peak or valley is loaded in the destination. PeakValley will
continue to load the previous peak or valley until the next peak or valley is detected.

DestChange
Variable or
array

Variable or array in which to store the change from the previous peak or valley. When a new
peak or valley is detected, the change from the previous peak or valley is loaded in the
destination. When a new peak or valley has not yet been reached, 0 is stored in the
destination. When Reps are greater than 1, the array must be dimensioned to Reps+1. The
additional element is used to flag when a new peak or valley is detected in any of the source
inputs. The flag element is stored after the changes [e.g., changevar(Reps+1)] and is set to -
1 (true) when a new peak or valley is detected and set to 0 (false) when none are detected.

Reps

Constant

The number of inputs to track the peaks and valleys for. Each input is tracked independently.
When reps are greater than 1 the source and DestPV arrays must be dimensioned to at least
the number of repetitions; DestChange must be dimensioned to Reps+1.

Source
Var. or Array

The variable or array containing the inputs to check for peaks and valleys.

Hysteresis
Constant, Var,
or expression

The minimum amount the input has to change to be considered a new peak or valley. This
would usually be entered as a constant.

8-27