Section 7. Installation
7.7.1.2 Conditional Output
CRBasic example Conditional Output (p. 173) demonstrates conditionally sending
data to a data table based on a trigger other than time.
Conditional Output
'This program example demonstrates the conditional writing of data to a data table. It
'also demonstrates use of StationName() and Units instructions.
'Declare Station Name (saved to Status table)
StationName(Delta_Temp_Station)
'Declare Variables
Public PTemp_C, AirTemp_C, DeltaT_C
'Declare Units
Units PTemp_C = deg C
Units AirTemp_C = deg C
Units DeltaT_C = deg C
'Declare Output Table -- Output Conditional on Delta T >=3
'Table stores data at the Scan rate (once per second) when condition is met
'because DataInterval instruction is not included in the table declaration
'after the DataTable declaration.
DataTable(DeltaT,DeltaT_C >= 3,-1)
Sample(1,Status.StationName,String)
Sample(1,DeltaT_C,FP2)
Sample(1,PTemp_C,FP2)
Sample(1,AirTemp_C,FP2)
EndTable
BeginProg
'Measure wiring panel temperature
PanelTemp(PTemp_C,_60Hz)
'Measure type T thermocouple
TCDiff(AirTemp_C,1,mV2_5C,1,TypeT,PTemp_C,True,0,_60Hz,1,0)
'Calculate the difference between air and panel temps
DeltaT_C = AirTemp_C - PTemp_C
'Call data table(s)
CallTable(DeltaT)
NextScan
EndProg
7.7.1.3 Groundwater Pump Test
CRBasic example Groundwater Pump Test (p. 174) shows how to do the following:
• Write multiple-interval data to the same data table
• Use program control instructions outside the Scan() / NextScan structure