'CR1000 'gradient tower at Imnaviat Creek September 2008 'Declare Variables and Units Public Batt_Volt Public LC_(4) Public WindSpeed_2m Public WindSpeed_4m Public WindDir_2m Public WindDir_4m Public HMP45_AirTemp_2m Public HMP45_RH_2m Public HMP45_AirTemp_4m Public HMP45_RH_4m Public SR50(2) Public SR50_Temp_Corr_Distance Public SR50_Snow_Depth Public PTemp,IR_SBTemp,IR_TmV,IR_TargTemp 'Public T_107 Dim Tsqr1,Tsqr2,IR_SBTempK,m,b,IR_TargTempK Dim LCount_3 Public CS300_SlrW Public CS300_SlrMJ Public Radio As Boolean '################# Alias SR50(1)=Raw_Dist Alias SR50(2)=SignalQuality 'Units of parameters Units Batt_Volt=V Units LC_()=mV '################remove "4" to compile program############# Units HMP45_AirTemp_2m=Deg C Units HMP45_RH_2m=% Units HMP45_AirTemp_4m=Deg C Units HMP45_RH_4m=% Units WindSpeed_2m=m/s Units WindSpeed_4m=m/s Units WindDir_2m=degrees Units WindDir_4m=degrees Units SR50_Snow_Depth=m Units IR_TargTemp=Deg C 'Units T_107=Deg C Units CS300_SlrW=W/m² Units CS300_SlrMJ=MJ/m² 'constants for IRR-P sensor Const mC2=75355.4 Const mC1=8545180 Const mC0=1465980000 Const bC2=26595.4 Const bC1=-888883 Const bC0=-3391940 'constant for snow depth sensor (distance to the ground in meters) Const Initial_Distance= 1.32 'Define Data Tables DataTable(ImnaviatCreekData,True,-1) Sample(4,LC_(),IEEE4) Sample(1,PTemp,FP2) Minimum(1,Batt_Volt,FP2,False,False) Sample(1,IR_SBTemp,FP2) Sample(1,IR_TmV,FP2) Sample(1,IR_TargTemp,FP2) Sample(1,WindSpeed_2m,FP2) Sample(1,WindSpeed_4m,FP2) Sample(1,WindDir_2m,FP2) Sample(1,WindDir_4m,FP2) 'WindVector (1,WindSpeed_2m,WindDir_2m,FP2,False,0,0,0) 'WindVector (1,WindSpeed_4m,WindDir_4m,FP2,False,0,0,0) Sample(1,HMP45_AirTemp_2m,FP2) Sample(1,HMP45_AirTemp_4m,FP2) Sample(1,HMP45_RH_2m,FP2) Sample(1,HMP45_RH_4m,FP2) Sample (1,SR50_Snow_Depth,FP2) 'Sample(1,T_107,FP2) Average(1,CS300_SlrW,FP2,False) Totalize(1,CS300_SlrMJ,IEEE4,False) EndTable 'Datatable to determine if radio status is set to HI or not... DataTable(RadioStat,true,-1) '#################### Sample(1,Radio,fp2) '################# EndTable '##################### 'Main Program BeginProg Scan(5,min,1,0) 'turn on multiplexer to take loadcell measurements on ESWE, 5 cells in total PortSet (1,1) LCount_3=1 SubScan(0,uSec,4) 'switch to next multiplexer channel PulsePort(2,10000) 'measure load cells on AM416 BrFull(LC_(LCount_3),1,Autorange,1,1,1,2500,True,True,0,_60Hz,1.0,0) LCount_3=LCount_3+1 NextSubScan 'Turn off AM416 PortSet(1,0) PanelTemp (PTemp,_60Hz) 'Default Datalogger Battery Voltage measurement Batt_Volt: Battery(Batt_Volt) 'measure wind sensors RM Yound 05103 anemometers PulseCount (WindSpeed_2m,1,1 ,1,1,.098,0) BrHalf (WindDir_2m,1,mV2500,3,Vx2,1,2500,True ,0,_60Hz,355,0) If WindDir_2m>=360 Then WindDir_2m=0 PulseCount (WindSpeed_4m,1,2,1,1,.098,0) BrHalf (WindDir_4m,1,mV2500,4,Vx2,1,2500,True ,0,_60Hz,355,0) If WindDir_4m>=360 Then WindDir_4m=0 'IRR-P (SI-111) infrared temperature sensor 'sensor body temperature Therm109 (IR_SBTemp,1,7,Vx3,0,_60Hz,1.0,0) 'mV output of the thermopile VoltDiff (IR_TmV,1,mV2_5,3,True ,0,_60Hz,1.0,0) 'calculation of m(slope) and b (intercept) coefficients for target temperature calculations m=mC2*IR_SBTemp*IR_SBTemp+mC1*IR_SBTemp+mC0 b=bC2*IR_SBTemp*IR_SBTemp+bC1*IR_SBTemp+bC0 IR_SBTempK=IR_SBTemp+273.15 Tsqr1=IR_SBTempK*IR_SBTempK*IR_SBTempK*IR_SBTempK+m*IR_TmV+b Tsqr2=SQR(Tsqr1) IR_TargTempK=SQR(Tsqr2) IR_TargTemp=IR_TargTempK-273.15 'measure hmp45c 'HMP45C (6-wire) Temperature & Relative Humidity Sensor measurements AirTC and RH: PortSet(9,1) Delay(0,150,mSec) VoltSe(HMP45_AirTemp_2m,1,mV2500,8,0,0,_60Hz,0.1,-40.0) VoltSe(HMP45_RH_2m,1,mV2500,9,0,0,_60Hz,0.1,0) PortSet(9,0) If HMP45_RH_2m>100 AND HMP45_RH_2m<108 Then HMP45_RH_2m=100 'HMP45C (6-wire) Temperature & Relative Humidity Sensor measurements AirTC_2 and RH_2: PortSet(9,1) Delay(0,150,mSec) VoltSe(HMP45_AirTemp_4m,1,mV2500,10,0,0,_60Hz,0.1,-40.0) VoltSe(HMP45_RH_4m,1,mV2500,11,0,0,_60Hz,0.1,0) PortSet(9,0) If HMP45_RH_4m>100 AND HMP45_RH_4m<108 Then HMP45_RH_4m=100 SDI12Recorder (SR50(),3,0,"M1!",1.0,0) 'Use air temp high to correct the distance SR50_Temp_Corr_Distance=Raw_Dist*(SQR((HMP45_AirTemp_2m+273.15)/273.15)) 'subtract the corrected distance from the initial distance of the SR50a to the ground SR50_Snow_Depth=Initial_Distance-SR50_Temp_Corr_Distance 'Pyranometer measurements 'SlrMJ' and 'SlrW' VoltSe (CS300_SlrW,1,mV250,13,1,0,60,1.0,0) 'Use mV250 for the CR800 series and CR1000 'Set negative values to zero. If CS300_SlrW<0 Then CS300_SlrW=0 'Convert mV to MJ/m² CS300_SlrMJ=CS300_SlrW*3600*0.000005 'Convert mV to W/m² CS300_SlrW=CS300_SlrW*5.0 'T107, unit removed 7/29/2022 'Therm107 (T_107,1,12,Vx3,0,250,1.0,0) 'Call Data Tables and Store Data CallTable(ImnaviatCreekData) 'radio control. Radio is attached to a relay controlled by port C5 If TimeIsBetween (12,13,24,Hr) Then PortSet(5,1) Radio = 1 '############# CallTable (RadioStat) '################## Else PortSet(5,0) Radio = 0 '################### CallTable (RadioStat) '################## EndIf NextScan EndProg