04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Section 7. Installation<br />

'Declare Units<br />

Units PTemp_C = deg C<br />

Units AirTemp_C = deg C<br />

Units DeltaT_C = deg C<br />

'Declare Output Table -- Output Conditional on Delta T >=3<br />

'Table stores data at the Scan rate (once per second) when condition met<br />

'because DataInterval instruction is not included in table declaration.<br />

DataTable(DeltaT,DeltaT_C >= 3,-1)<br />

Sample(1,Status.StationName,String)<br />

Sample(1,DeltaT_C,FP2)<br />

Sample(1,PTemp_C,FP2)<br />

Sample(1,AirTemp_C,FP2)<br />

EndTable<br />

BeginProg<br />

Scan(1,Sec,1,0)<br />

'Measure wiring panel temperature<br />

PanelTemp(PTemp_C,_60Hz)<br />

'Measure type T thermocouple<br />

TCDiff(AirTemp_C,1,mV2_5C,1,TypeT,PTemp_C,True,0,_60Hz,1,0)<br />

'Calculate the difference between air and panel temps<br />

DeltaT_C = AirTemp_C - PTemp_C<br />

'Call data table(s)<br />

CallTable(DeltaT)<br />

NextScan<br />

EndProg<br />

7.8.17.7 Capturing Events<br />

CRBasic example Capturing Events (p. 252) demonstrates programming to output<br />

data to a data table at the occurrence of an event.<br />

CRBasic Example 58.<br />

BeginProg / Scan / NextScan / EndProg Syntax<br />

'Example programming to detect and record an event<br />

'An event has a beginning and an end. This program records an event as occurring at<br />

'the end of the event. The event recorded is the transition of a delta temperature<br />

'above 3 degrees. The event is recorded when the delta temperature drops back below<br />

'3 degrees.<br />

'The DataEvent instruction forces a record in data table Event each time an<br />

'event ends. Number of events is written to the reserved variable<br />

'EventCount(1,1). In this program, EventCount(1,1) is recorded in the<br />

'OneMinute Table.<br />

'Note : the DataEvent instruction must be used within a data table with a<br />

'more frequent record interval than the expected frequency of the event.<br />

'Declare Variables<br />

Public PTemp_C, AirTemp_C, DeltaT_C<br />

Public EventCounter<br />

252

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!