Campbell Manufacturing CR10 User Manual

Page of 253
SECTION 8.  PROCESSING AND PROGRAM CONTROL EXAMPLES
8-2
04:
P54
Block Move 
01:
9
No. of Values 
02:
12
First Source Loc Temp i-8 
03:
1
Source Step 
04:
11
First Dest. Loc [:Temp i-9 ]
05:
1
Destination Step 
05:
P86
Do 
01:
10
Set high Flag 0 (output) 
06:
P70
Sample 
01:
1
Reps 
02:
2
Loc 10smpl av 
07:
P
End Table 1
In the above example, all samples for the
average are stored in input locations.  This is
necessary when an average must be output
with each new sample.  In most cases,
averages are desired less frequently than
sampling.  For example, it may be necessary to
sample some parameter every 5 seconds and
output every hour an average of the previous
three hours' readings.  If all samples were
saved, this would require 2160 input locations.
The same value can be obtained by computing
an hourly average and averaging the hourly
averages for the past three hours.  To do this
requires that hourly averages be stored in input
locations.
Instruction 80 is used to send the 1 hour
average to Input Storage and again to send the
3 hour average to Final Storage.
Input Location Labels:
1:AVG i-2
2:AVG i-1 
3:AVG i
4:3 HR AVG
5:XX mg/M3
*
1
Table 1 Programs
01:
5
Sec. Execution Interval
01:
P2
Volt (DIFF)
01:
1
Rep
02:
25
2500 mV 60 Hz rejection
03:
3
IN Chan
04:
5
Loc [:XX mg/M3 ]
05:
10
Mult
06:
0
Offset
02:
P92
If time is 
01:
0
minutes into a 
02:
60
minute interval 
03:
10
Set high Flag 0 (output) 
03:
P80
Set Active Storage Area 
01:
3
Input Storage Area 
02:
3
Array ID or location 
04:
P71
Average 
01:
1
Rep 
02:
5
Loc XX mg/M3 
05:
P51
Spatial Average 
01:
3
Swath 
02:
1
First Loc AVG i-2
03:
4
Avg Loc [:3 HR AVG ] 
06:
P80
Set Active Storage Area 
01:
1
Final Storage Area 1 
02:
25
Array ID or location 
07:
P77
Real Time 
01:
110
Day,Hour-Minute 
08:
P70
Sample 
01:
1
Reps 
02:
4
Loc 3 HR AVG 
09:
P91
If Flag/Port 
01:
10
Do if flag 0 (output) is high 
02:
30
Then Do 
10:
P54
Block Move 
01:
2
No. of Values 
02:
2
First Source Loc AVG i-1
03:
1
Source Step 
04:
1
First Dest. Loc [:AVG i-2  ]
05:
1
Destination Step 
11:
P95
End 
12:
P
End Table 1
8.2  RAINFALL INTENSITY
In this example, the total rain for the last 15
minutes is output only if any rain has occurred.
The program makes use of the capability to
direct the output of Output Processing
Instructions to Input Storage.
Every 15 minutes, the total rain is sent to Input
Storage.  If the total is not equal to 0, output is
redirected to Final Storage Area 1, the time is
output and the total is sampled.