beautypg.com

2 rainfall intensity – Campbell Scientific CR510 Basic Datalogger User Manual

Page 98

background image

SECTION 8. PROCESSING AND PROGRAM CONTROL EXAMPLES

8-2

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.

PROGRAM

*

Table 1 Program

01:

5.0

Execution Interval (seconds)

01:

Volt (Diff) (P2)
1:

1

Reps

2:

25

±2500 mV 60 Hz
Rejection Range

3:

1

DIFF Channel

4:

5

Loc [ XX_mg_M3 ]

5:

10

Mult

6:

0

Offset

02:

If time is (P92)
1:

0

Minutes (Seconds --) into a

2:

60

Interval (same units as
above)

3:

10

Set Output Flag High

03:

Set Active Storage Area (P80)
1:

3

Input Storage Area

2:

3

Array ID or Loc [ avg_i ]

04:

Average (P71)
1:

1

Reps

2:

5

Loc [ XX_mg_M3 ]

05:

Spatial Average (P51)
1:

3

Swath

2:

1

First Loc [ avg_i_2 ]

3:

4

Avg Loc [ 3_Hr_avg ]

06:

Set Active Storage Area (P80)
1:

1

Final Storage Area 1

2:

25

Array ID or Loc [ _________ ]

07:

Real Time (P77)
1: 0110

Day,Hour/Minute

08:

Sample (P70)
1:

1

Reps

2:

4

Loc [ 3_Hr_avg ]

09:

If Flag/Port (P91)
1:

10

Do if Output Flag is High
(Flag 0)

2:

30

Then Do

10:

Block Move (P54)
1:

2

No. of Values

2:

2

First Source Loc
[ avg_i_1 ]

3:

1

Source Step

4:

1

First Destination Loc
[ avg_i_2 ]

5:

1

Destination Step

11:

End (P95)

INPUT LOCATIONS

1 avg_i_2
2 avg_i_1
3 avg_i
4 3_Hr_avg
5 XX_mg_M3

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.

PROGRAM

*

Table 1 Program

01:

60.0

Execution Interval (seconds)

01:

Pulse (P3)
1:

1

Reps

2:

1

Pulse Input Channel

3:

2

Switch Closure

4:

1

Loc [ Precip_mm ]

5:

.254

Mult

6:

0

Offset