beautypg.com

2 running average and total of rain, 3 use of multiple scans – Campbell Scientific CR1000 Measurement and Control System User Manual

Page 246

background image

Section 7. Installation

246 

 

 

'Count how many times the DataEvent “DeltaT_C>=3” has occurred. The

'TableName.EventCount syntax is used to return the number of data storage events

'that have occurred for an event driven table. This example looks in the data

'table “Event”, which is declared above, and reports the event count. The (1,1)

'after EventCount just needs to be included.

HowMany = Event.EventCount(1,1)

'Call Data Tables

CallTable

(OneMin)

CallTable

(Event)

NextScan

EndProg

 

7.8.17.2 Running Average and Total of Rain

CRBasic Example 53. Running Average and Running Total of Rain 

'Rain is measured using PulseCount(). Running Average is calculated using the

'AvgRun(). Running Total is calculated from the result of AvgRun() by

'multiplying the result by the AvgRun() Number parameter (3rd parameter).

Public

MeasuredRain

Public

TotRun, RainAvg

Const

Number = 15.0

BeginProg

Scan

(1,Sec,0,0)

PulseCount

(MeasuredRain,1,1 ,2,0,0.01,0)

AvgRun

(RainAvg,1,MeasuredRain,Number)

TotRun = Number * RainAvg

NextScan

EndProg

 

7.8.17.3 Use of Multiple Scans

CRBasic example Use of Multiple Scans

(p. 246)

demonstrates the use of multiple

scans. Some applications require measurements or processing to occur at an
interval different from that of the main program scan. Secondary, or slow
sequence, scans are prefaced with the SlowSequence instruction.

CRBasic Example 54. Use of Multiple Scans 

'This program demonstrates the use of multiple scans. Some applications require

'measurements or processing to occur at an interval different from that of the main

'program scan. Secondary scans are prefaced with the SlowSequence instruction.

'Declare Public Variables

Public

PTemp

Public

Counter1