Campbell Scientific CR10 CR10 Measurement and Control - Page 159

Example

Page 159 highlights

SECTION 12. PROGRAM CONTROL INSTRUCTIONS average of all the readings in locations 1-10 since the previous output. Because the lntermediate locations are zeroed each time an output occurs, the next nine values will be the current values (samples at the time of output) of locations 2-10. Loops can be nested. lndexed locations within nested loops are indexed to the inner most loop that they are within. The maximum nesting level in the CR10 is 9 deep. This applies to lf Then/Else comparisons and Loops or any combination thereof. An lf Then/Else comparison which uses the Else Instruction (94) counts as being nested 2 deep. PARAM. NUMBER TDAYTAPE 01: 4 02: 4 DESCRIPTION Delay lteration count The following example involves the use of the Loop Instruction, without a delay, to perform a block data transformation. The user wants 'l hour averages of the vapor pressure calculated from the wet- and dry-bulb temperatures of 5 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 1 1-15 c) wet-bulbtemperatures Location 16-20 d) calculated vapor pressure Location 21-25 (Vapor pressure is written over the wet-bulb temperatures.) 2. The program flow is as follows: a) Enter the Loop lnstruction (#87) with DelaY=O 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 lf Time lnstruction (#92) to set the Output Flag every hour. e) Use the Average Instruction (#71) with 5 repetitions starting at input location 21 to average the vapor pressure over the hour. The actual keyboard entries for the examples are shown below with the first examole Instruction location equal to 10. The lnput Instructions to make the pressure and temperature measurements are assumed. TABLE 12-3. Loop Example: Block Data Transform 10: P87 01: 02: 0 5 Beginning of Loop Delay Loop Count 11: P57 01: 10 O2: 11-03: 16-04: 21-12: P95 WeUDry Bulb Temp to VP Pressure Loc Dry Bulb Temp Loc DRY BLB#1 Wet Bulb Temp Loc VP #1 Loc [:VP #1 I End 13: P92 01: 0 02; 60 03: 10 lf time is minutes into a minute interval Set high Flag 0 (output) 14: P71 01: 5 02: 21 Average Reps 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 10 seconds;the rest of the time one minute between samples is sufficient. The execution interval is set to 10 seconds; when a one minute sample rate is desired, a delay of 6 (6 x 10s = 60s) is used in the loop. 12-3

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238

average of all
the
readings in
locations
1-10
since
the
previous
output.
Because
the
lntermediate
locations are zeroed each time an
output occurs,
the
next nine values
will
be
the
current
values
(samples at the
time
of output) of
locations 2-10.
Loops
can be
nested.
lndexed locations within
nested loops
are
indexed to
the
inner most loop
that
they
are
within.
The
maximum nesting
level
in
the
CR10 is
9
deep.
This applies
to
lf
Then/Else
comparisons
and Loops or any
combination
thereof.
An
lf Then/Else
comparison
which
uses
the
Else Instruction
(94)
counts as being nested 2 deep.
PARAM.
DATA
NUMBER
TYPE
DESCRIPTION
01:
4
Delay
02:
4
lteration
count
The
following example
involves
the
use
of
the
Loop Instruction, without a delay,
to
perform a
block data transformation.
The
user
wants
'l
hour averages
of
the
vapor
pressure calculated from the wet- and dry-bulb
temperatures
of
5 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
1
1-15
c)
wet-bulbtemperatures
Location 16-20
d)
calculated
vapor
pressure
Location
21-25
(Vapor
pressure
is
written over
the
wet-bulb temperatures.)
2.
The
program
flow
is as follows:
a)
Enter
the
Loop
lnstruction
(#87) with
DelaY=O
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.
SECTION
12.
PROGRAM CONTROL
INSTRUCTIONS
c)
End loop
with
Instruction
95.
d)
Use
the
lf
Time lnstruction
(#92)
to
set
the Output
Flag every hour.
e)
Use
the
Average
Instruction (#71) with
5
repetitions starting
at
input location
21
to
average
the vapor
pressure over
the
hour.
The actual
keyboard entries for the examples
are shown below with the
first
examole
Instruction location equal
to
10.
The
lnput
Instructions
to
make
the
pressure and
temperature
measurements are assumed.
TABLE 12-3. Loop
Example:
Block
Data
Transform
Beginning
of
Loop
Delay
Loop Count
11: P57
WeUDry Bulb Temp to VP
01: 10
Pressure Loc
O2: 11--
Dry Bulb
Temp
Loc DRY
BLB#1
03: 16--
Wet
Bulb
Temp
Loc VP
#1
04: 21--
Loc
[:VP
#1
I
12: P95
End
10:
P87
01:
0
02:
5
13:
P92
01:
0
02;
60
03:
10
14:
P71
01:
5
02:
21
lf
time
is
minutes into
a
minute interval
Set high Flag
0
(output)
Average
Reps
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
10
seconds;the
rest of the
time one
minute
between
samples
is
sufficient.
The execution
interval is set
to
10
seconds;
when
a
one
minute
sample
rate
is
desired, a delay of
6
(6
x
10s
=
60s)
is used
in
the
loop.
12-3