beautypg.com

Campbell Scientific CR7 Measurement and Control System User Manual

Page 121

background image

SECTION 12. PROGRAM CONTROL INSTRUCTIONS

12-3

PAR.

DATA

NO.

TYPE

DESCRIPTION

01:

2

Delay

02:

4

Iteration count

The following example involves the use of the
Loop Instruction, without a delay, to perform a
block data transformation.

The user wants one hour averages of the vapor
pressure calculated from the wet- and dry-bulb
temperatures of five psychrometers. One
pressure transducer measurement is also
available for use in the vapor pressure
calculation.

1.

The input locations are assigned as follows:
a) pressure

-location 10

b) dry-bulb temperatures

-location 11-15

c) wet-bulb temperatures

-location 16-20

d) calculated vapor pressure -location 16-20
(vapor pressure is written over the wet-bulb
temperatures.)

2.

The program flow is as follows:
a) Enter the Loop Instruction 87 with

delay=0 and iteration count=5.

b) Calculate the vapor pressure with

Instruction 57 using a normal location
entry of 10 for atmospheric pressure
and Indexed locations of 11, 16, and 16
for the dry-bulb, wet-bulb and
calculated vapor pressure, respectively.

c)

End loop with Instruction 95.

d) Use the If Time Instruction 92 to set the

Output Flag every hour.

e) Use the Average Instruction 71 with 5

repetitions starting at Input Location 16
to average the vapor pressure over the
hour.

The actual keyboard entries for the examples
are shown below with the first example
Instruction location equal to 10. The Input
Instructions to make the pressure and
temperature measurements are assumed.

TABLE 12-3. Loop Example: Block Data

Transform

10:

P87

Beginning of Loop

01:

0

Delay

02:

5

Loop Count

11:

P57

Wet/Dry Bulb Temp to VP

01:

10

Pressure Loc

02:

11--

Dry Bulb Temp Loc DRY BLB#1

03:

16--

Wet Bulb Temp Loc VP #1

04:

16--

Loc [:VP #1 ]

12:

P95

End

13:

P92

If time is

01:

0

minutes into a

02:

60

minute interval

03:

10

Set high Flag 0 (output)

14:

P71

Average

01:

5

Reps

02:

16

Loc VP #1

The Loop with a delay may be used so that only
those instructions within the Loop are executed
while certain conditions are met. As a simple
example, suppose it is desired to execute one
set of instructions from midnight until 6 AM,
another set between 6 AM and 4 PM, and a
third set between 4 PM and midnight. Between
6 AM and 4 PM, samples are desired every ten
seconds; the rest of the time one minute
between samples is sufficient. The execution
interval is set to ten seconds; when a one
minute sample rate is desired, a delay of 6 (6 x
10s = 60s) is used in the loop.

TABLE 12-4. Example: Loop with Delay

Execution Interval = 10 seconds

*

1

Table 1 Programs

01:

10

Sec. Execution Interval

01:

P87

Beginning of Loop

01:

6

Delay

02:

0

Loop Count

11:

P86

Do

01:

1

Call Subroutine 1