Appendix B. Example Programs
B-3
If TimeIntoInterval
(58,60,Min)
Then
SR50ACtrl = True
EndIf
'Set this flag to true to get the initial distance from the SR50A
'to the ground.
If
SR50A_MID
Then
SR50ACtrl = True
'Logic to make 11 snow depth measurements, sort them, and store
'the corrected values.
If
SR50ACtrl
Then
'SR50A Sonic Ranging Sensor (SDI-12 Output) measurements
'DT' & 'Q'
SDI12Recorder
(SR50A_Raw(),1,"0","M1!",1,0)
'Calculate the temperature corrected distance.
SR50A(n,1) = SR50A_Raw(1)*SQR((A273.15)/273.15)
SR50A(n,2) = SR50A_Raw(2)
n += 1
If
n > 11
Then
n = 1
SR50ACtrl = False
SortSpa
(Result_SR50A(1,1),11,SR50A(1,1),2)
TCDT = Result_SR50A(6,1)
Q = Result_SR50A(6,2)
If
SR50A_MID
Then
Inital_Dist = TCDT
SR50A_MID = False
EndIf
Snow_Depth = Inital_Dist - TCDT
EndIf
EndIf
'Call Data Tables and Store Data
CallTable
Daily
CallTable
Hour
NextScan
EndProg
B.1.2 CR6 SDI-12 Program
CRBasic Example B-2. CR6 SDI-12 Program
'CR6
'This program contains a number of features not found in Short Cut.
'
'The initial distance value from the SR50A head to the ground is
'measured by setting the flag SR50A_MID to TRUE. Set this flag after
'installing the SR50A in the field. Setting this flag will initiate
'a measurement cycle and the resulting value stored as the initial
'distance. The initial distance is used to calculate snow depth.
'The PreserveVariables instruction is used to store the initial
'distance in non-volatile memory. If power is lost at the site the
'initial distance value will be restored.'
'A control flag is used to initiate the SR50A 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.
'Declare Variables and Units
Содержание SR50A
Страница 2: ......
Страница 6: ......
Страница 30: ...SR50A Series Sonic Ranging Sensors 20...
Страница 32: ......
Страница 53: ...Appendix B Example Programs B 21 CallTable Daily CallTable Hour NextScan EndProg...
Страница 54: ...Appendix B Example Programs B 22...
Страница 56: ......
Страница 78: ...Appendix E Tera Term QuickStart E 10...
Страница 83: ......