'CR6 Series 'Created by Short Cut (4.0) 'Declare Variables and Units Public BattV Public progSig As Long Public PTemp_C Public AT Public SR50A_M(2) Public SR50A(11,2) Public Result_SR50A(11,2) Public TCDT Public LEVEL_M Public LEVEL_FT Public Inital_Dist = 8.10 : Units Inital_Dist = m 'Distance to ground. Public Level_cm '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 SR50ACtrl As Boolean 'Set this flag to measure and store the initial distance from the 'SR50AT to the ground. Public SR50A_MID As Boolean Dim n 'used as a counter Alias SR50A_M(1)=DT : Units DT = m Alias SR50A_M(2)=Q Units BattV=Volts Units PTemp_C=Deg C Units AT=Deg C 'Define Data Tables DataTable(Hydro,True,-1) DataInterval(0,15,Min,10) Sample(1,progSig,uint2) Sample(1,AT,FP2) Average(1,AT,FP2,False) Sample(1,TCDT,FP2) Sample(1,Q,FP2) Sample(1,Level_cm,IEEE4) Average(1,Level_cm,IEEE4,False) Sample(1,LEVEL_M,IEEE4) Average(1,LEVEL_M,IEEE4,False) Sample(1,LEVEL_FT,IEEE4) Average(1,LEVEL_FT,IEEE4,False) EndTable DataTable(HrlyDiag,True,-1) DataInterval(0,60,Min,10) Sample(1,progSig,uint2) Sample(1,BattV,FP2) Average(1,BattV,FP2,False) Average(1,PTemp_C,FP2,False) EndTable 'Main Program BeginProg progSig = status.ProgSignature n=1 'Main Scan Scan(60,Sec,1,0) 'Default CR6 Datalogger Battery Voltage measurement 'BattV' Battery(BattV) 'Default CR6 Datalogger Wiring Panel Temperature measurement 'PTemp_C' PanelTemp(PTemp_C,60) '109 Temperature Probe measurement 'AT' Therm109(AT,1,U2,U1,0,60,1,0) 'Automated Water stage measurement. Must occur two minutes before 'actual storage time to get 11 measurements completed. If TimeIntoInterval (13,15,Min) Then SR50ACtrl = True EndIf 'Set this flag to true to get the initial distance from the SR50AT 'to the ground. If SR50A_MID Then SR50ACtrl = True 'Logic to make 11 water stage measurements, sort them, and store 'the corrected values. If SR50ACtrl Then 'SR50AT Sonic Ranging Sensor (SDI-12 Output) measurements 'MDT, MQ, & MAir SDI12Recorder(SR50A_M(),C1,"1","M1!",1,0) 'Load the array to be sorted. SR50A(n,1) = SR50A_M(1) SR50A(n,2) = SR50A_M(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 Level_cm = (Inital_Dist - TCDT)*100 LEVEL_M = (Level_cm / 100) LEVEL_FT = Level_cm*0.0328 EndIf EndIf 'Call Data Tables and Store Data CallTable Hydro CallTable HrlyDiag NextScan EndProg