beautypg.com

Syntax – Campbell Scientific CR9000X Measurement and Control System User Manual

Page 307

background image

Section 8. Processing and Math Instructions

Parameter
& Data Type

Enter

IFTIME PARAMETERS

TintoInt
constant

The time into interval sets an offset from the datalogger’s clock to the interval at which the
IfTime will be true. For example, if the Interval is set at 60 minutes, and TintoInt is set to 5,
IfTime will be True at 5 minutes into the hour, every hour, based on the datalogger's real-time
clock. If the TintoInt is set to 0, the IfTime statement is True at the top of the hour.

Interval
constant

The Interval is how often IfTime will be True.

Units

The time units for TintoInt and Interval

Constant

Alpha Code

Numeric Code

Units

Sec 2

Seconds

Min 3

Minutes

Hr 4

Hours

Day 5

Days

Remarks

The IfTime function returns True (-1) or False (0) based on the scan clock.
Time is kept internally by the datalogger as the elapsed time since January 1,
1990, at 00:00:00 hours. The interval is synchronized with this elapsed time
(i.e., the interval is true when the Interval divides evenly into this elapsed time).
The time into interval allows an offset to the interval. The IfTime instruction
can be used to set the value of a variable or it can be used as an expression for a
condition.

The scan clock that the IfTime function checks has the time resolution of the
scan interval (i.e., it remains fixed for an entire scan and increments for the next
scan). IfTime must be within a scan to function.

The window of time in which the IfTime instruction is true is one of its
specified Units. For example, if IfTime specifies 0 into a 10 minute interval, it
would be true any time within the first minute of the ten minute interval. With
0 into a 600 second interval, the interval is still 10 minutes but it would only be
true during the first 1 second of the 10 minute interval.

IfTime will only return true once per interval. For example, a program with a 1
second scan that tests IfTime(0,10, min) -- 0 minutes into a 10 minute interval –
each scan will execute the instruction 60 times during the minute that it could
be true. It will only return true the first time that it is executed, it will not return
true again until another interval has elapsed.

IIF

The IIF function evaluates a variable or expression and returns one of two
results based on the outcome of that evaluation.

Syntax

Result = IIF(Expression, TrueValue, FalseValue)

8-21