![background image](http://html1.mh-extra.com/html/campbell/sr50at/sr50at_instruction-manual_488987038.webp)
Appendix B. Example Programs
B-4
'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)
Sample
(1,AirTempC,FP2)
Sample
(1,TCDT,IEEE4)
Sample
(1,Q,FP2)
EndTable
PreserveVariables
'Main Program
BeginProg
'Main Scan
n = 1
Scan
(10,Sec,1,0)
'Battery Voltage measurement 'BattV'
Battery
(BattV)
'Wiring Panel Temperature measurement 'PnlTmp_C'
PanelTemp
(PnlTmp_C,60)
'Automated snow depth measurement. Must occur two minutes before
'actual storage time to get 11 measurements completed.
If TimeIntoInterval
(58,60,Min)
Then
SR50ATCtrl = True
EndIf
'Set this flag to true to get the initial distance from the SR50AT
'to the ground.
If
SR50AT_MID
Then
SR50ATCtrl = True
'Logic to make 11 snow depth measurements, sort them, and store
'the corrected values.
If
SR50ATCtrl
Then
'SR50AT Sonic Ranging Sensor (SDI-12 Output) measurements