![background image](http://html1.mh-extra.com/html/campbell/sr50at/sr50at_instruction-manual_488987050.webp)
Appendix B. Example Programs
B-16
'A control flag is used to initiate the SR50AT measurement cycle. This
'allows for manual control in the field to check distances without
'waiting for the correct time interval to occur. It is also used by
'the datalogger to initiate an automated measurement cycle.
'
'Every measurement cycle is composed of 11 individual measurements
'that are spatially sorted to eliminate any low or high values.
'One measurement is made with each scan. This program has a 10
'second scan rate so it will take 100 seconds to do all 11 scans or
'1 minute and 40 seconds.
'
'The heater is controlled using the HtrCntrl flag. Program uses the
'datalogger SW12 line to power the heater. Battery voltage must be
'greater than 11.7vdc and the air temperature must be less than, or
'equal to, 2°C to power the heater.
PipeLineMode
'Declare Variables and Units
Public
BattV :
Units
BattV
= Volts
'CR1000 battery voltage
Public
PnlTmp_C :
Units
PnlTmp_C = °C
'CR1000 panel temperature
Public
HtrCntrl
As Boolean
'Single measured values.
Public
SR50AT_M(3)
Alias
SR50AT_M(1) = MDT :
Units
MDT = meters
'Distance from the SR50A.
Alias
SR50AT_M(2) = MQ :
Units
MQ = unitless
'Quality number.
Alias
SR50AT_M(3) = MAir :
Units
MAir = °C
'Air temperature.
'Array to hold 11 SR50AT measurements composed of a distance and
'quality number, and air temperature.
Public
SR50AT(11,3)
'Sorted array of 11 SR50AT measurements composed of a distance and
'quality number, and temperature. Measurements are sorted by the
'distance value from smallest to largest.
Public
Result_SR50AT(11,3)
Public
TCDT
:
Units
TCDT
= meters
'Temperature corrected distance
Public
Q
:
Units
Q
= unitless
'Quality number
Public
AirTempC :
Units
AirTempC = °C
'Air temperature
Public
Inital_Dist :
Units
Inital_Dist = meters
'Distance to ground.
Public
Snow_Depth :
Units
Snow_Depth = meters
'Snow depth.
'Controls SR50AT measurement. This flag can be manually controlled to
'run tests in the field or is automatically set 2 minutes before the
'hourly data storage interval. This is done so 11 measurements can
'be made and sorted before the values are stored.
Public
SR50ATCtrl
As Boolean
'Set this flag to measure and store the initial distance from the
'SR50AT to the ground.
Public
SR50AT_MID
As Boolean
Dim
n
'used as a counter
'Define Data Tables
DataTable
(Daily,True,-1)
DataInterval
(0,1440,Min,10)
Minimum
(1,BattV,FP2,False,False)
Maximum
(1,BattV,FP2,False,False)
Minimum
(1,PnlTmp_C,FP2,False,False)
Maximum
(1,PnlTmp_C,FP2,False,False)
EndTable
DataTable
(Hour,True,-1 )
DataInterval
(0,60,Min,10)