'Umiat Airfield RAWS 2010-02-01.cr ' changed SensorHt from 206 to 211.5 for snow depth FEU 09/23/10 ' Program modified: Umiat Airfield RAWS 2008-10-15.cr1 ' Modified By: Austin McHugh ' Modifications: created a new snowdepth value in inches for the GOES xmission. ' Program modified: Umiat Airfield RAWS 2007-09-22.cr1 ' Modified By: Austin McHugh ' Modifications: changed SR50 Height from 195 to 206. ' Program modified: Umiat Airfield RAWS 2007-09-20.cr1 ' Modified By: Austin McHugh ' Modifications: changed Daily table to get max of wind speed in m/s not mph ' Program modified: Umiat Airfield RAWS 2007-09-19.cr1 ' Modified By: Austin McHugh ' Modifications: Changed soil temps from xxx to xxx.x, added a daily table, added WSpd_ms and changed the label of the Daily ' wind vector to WindSpeedAvg_ms. added WindSpeedAvg_ms to the end of the Atmospherics table. ' Program modified: Umiat Airfield RAWS 2007-09-18.cr1 ' Modified By: Austin McHugh ' Modifications: Deleted several of the update comments below to make program shorter. Changed GOES WD to hourly from 10 minutes. ' Deleted SlrMj. Changed xmitted GOES precip to accumulated from hourly. Changed HMP45C to Sample from Average. Changed 12inch soil to 6inch soil. ' Program modified: Umiat Airfield RAWS 2007-09-17.cr1 ' Modified By: Austin McHugh ' Modifications: Corrected spelling of HourlyAtmospherics table. Corrected error reading the rain gage was on C6, now P2. ' measure BP Not corrected every 1 minute. ' Program modified: Umiat Airfield RAWS 2007-09-14.cr1 ' Modified By: Austin McHugh ' Modifications: Added code to compute YSI Air Temp in F. Swapped to send the GWS YSI Air Temperature in F with the GOES 7 values and HMP45C temp in F in the upper. ' Program modified: Umiat Airfield 2016-05-21.cr1 ' Modified by Joel Bailey ' Removed Raws and Goes features, added delay for barometric pressure and HMP155 'CRBasic angle units are in Radians by default. AngleDegrees Const SensorHt=211.5 'ENTER HEIGHT OF SNOW DEPTH SENSOR ABOVE GROUND 212 (cm) HERE <----- ' For YSI thermistors -- conversion of kOHM to deg C Const a = 0.0014654354 Const b = 0.0002386780 Const c = 0.0000001000 Dim j Dim D(12) 'Sensor Variables ------------------------------------------------------------------------------------------------------------------------------- Public Batt_Volt, Panel_TempF, AirTempF, RH Public SolarPnlV Public Rain_in Public BP_mBar Public FuelT_F Public Raintot Public Panel_TempC, AirTempC, TdewC, TdewF Public StationID Public WS_mph Public WindDir Public SR50(2), TCDT, SR50_Bad, Snowdepth, Snowdepth_in Alias SR50(1)=DT Alias SR50(2)=SR50_quality Public GWSAirTemp(2), GWSSoilTemp(2), GWSSoil6Temp(2) Public GWSAirTempR(2), GWSSoilTempR(2), GWSSoil6TempR(2) Public GWSAirTempF(2) Units GWSAirTemp()=DegC Units GWSSoilTemp()=DegC Units GWSSoil6Temp()=DegC Units GWSAirTempF()=DegF Const High = True Const Low = False Const ScanInterval = 60 Units WS_mph=miles/hour Units WindDir=degrees Units Batt_Volt=Volts Units SolarPnlV=Volts Units AirTempF=Deg F Units RH=% Units Rain_in=inch Units Raintot=inch Units FuelT_F=Deg F Units AirTempC=Deg c Units TdewF=Deg F Units TdewC = Deg c Units Panel_TempC=Deg c Units Panel_TempF = Deg F Units Snowdepth=cm Units Snowdepth_in=in Units BP_mBar = mBar ' a new table for new met sensors DataTable(HourlyAtms, true, -1) DataInterval(0,60,Min,10) Sample(1, StationID, FP2) Average(1,AirTempC,fp2,SR50_Bad) Maximum (1,AirTempC,FP2,False,False) Minimum (1,AirTempC,FP2,False,False) Sample(1,RH, FP2) Maximum(1,RH, FP2, 0, False) Minimum(1,RH, FP2, 0, False) Average(1,TdewC, FP2, 0) Average(2,GWSAirTemp(),FP2,False) Average(1,Snowdepth,fp2,SR50_Bad)' this is a "cleaned" value Maximum (1,Snowdepth,FP2,False,False) Minimum (1,Snowdepth,FP2,False,False) Sample (1,Snowdepth,FP2) Sample (1,SR50_quality,FP2) Average(1,WS_mph,FP2,False) Sample(1,WS_mph,FP2) Maximum(1,WS_mph,FP2,False,false) Sample(1,WindDir,FP2) WindVector(1,WS_mph,WindDir,FP2,False,0,0,0) FieldNames("WS_mph_S_WVT,WindDir_D1_WVT,WindDir_SD1_WVT") Sample(1,BP_mBar, FP2) Totalize(1,Rain_in, FP2, 0) Sample(1,Raintot, FP2) ' cumulative rain EndTable ' a new table for sub surface measurements DataTable(HourlySubSurface, true, -1) DataInterval(0,60,Min,10) Sample(1, StationID, FP2) Average(2,GWSSoilTemp(),FP2,False) Average(2,GWSSoil6Temp(),FP2,False) EndTable DataTable(HourlyDiag, true, -1) DataInterval(0,60,Min,10) Sample(1, StationID, FP2) Average(1,Batt_Volt, FP2,False) Average(1,Panel_TempC, FP2, False) Average (1,SolarPnlV,FP2,False) EndTable DataTable (Daily, 1,-1) DataInterval(0,1440,Min,0) Sample(1,StationID,fp2) Average (1,AirTempC,FP2,False) Maximum (1,AirTempC,FP2,False,False) Minimum (1,AirTempC,FP2,False,False) Average (2,GWSAirTemp(),FP2,False) Maximum (2,GWSAirTemp(),FP2,False,False) Minimum (2,GWSAirTemp(),FP2,False,False) Average (2,GWSSoilTemp(),FP2,False) Maximum (2,GWSSoilTemp(),FP2,False,False) Minimum (2,GWSSoilTemp(),FP2,False,False) Average (2,GWSSoil6Temp(),FP2,False) Maximum (2,GWSSoil6Temp(),FP2,False,False) Minimum (2,GWSSoil6Temp(),FP2,False,False) Maximum (1,RH,FP2,False,False) Minimum (1,RH,FP2,False,False) Average(1,WS_mph,FP2,False) Sample(1,WS_mph,FP2) Maximum(1,WS_mph,FP2,False,false) Sample(1,WindDir,FP2) WindVector(1,WS_mph,WindDir,FP2,False,0,0,0) FieldNames("WS_mph_S_WVT,WindDir_D1_WVT,WindDir_SD1_WVT") Totalize (1,Rain_in,FP2,False) Average(1,Snowdepth,fp2,SR50_Bad) ' this is a "cleaned" value EndTable 'Main Program ----------------------------------------------------------------------------------------------------------------------------------- BeginProg Scan (ScanInterval,Sec,0,0) 'Const ScanInterval in seconds june 18, 2007 StationID = 3150 Battery(Batt_Volt) PanelTemp(Panel_TempC,250) Panel_TempF=Panel_TempC*1.8+32 VoltSe (SolarPnlV,1,mV2500,15,1,0,250,0.011,0) ''''''''''''''''''''''''''''''''''' '' '' '' Measure HMP155 '' '' '' ''''''''''''''''''''''''''''''''''' ' this sensor is currently wired to 12v and ON always. PortSet(2, 1) Delay(0,5,Sec) VoltSe(AirTempC, 1, mV2500, 3, False, 0, 250, 0.14, -80) VoltSe(RH, 1, mV2500, 4, False, 0, 250, 0.1, 0) PortSet(2, 0) If RH>100 AND RH<108 Then RH=100 AirTempF=AirTempC*1.8+32 ''''''''''''''''''''''''''''''''''' '' '' '' Measure Wind Monitor '' '' '' ''''''''''''''''''''''''''''''''''' '05103 Wind Speed & Direction Sensor measurements 'WS_mph' and 'WindDir' PulseCount(WS_mph,1,1,1,1,0.2192,0) BrHalf(WindDir,1,mV2500,2,1,1,2500,False,20000,250,355,0) If WindDir>=360 OR WindDir<0 Then WindDir=0 ''''''''''''''''''''''''''''''''''' '' '' '' Measure TE525WS '' '' '' ''''''''''''''''''''''''''''''''''' 'TE525/TE525WS Rain Gauge measurement Rain_in 0.01"/tip: PulseCount(Rain_in,1,2,2,0,0.01,0) Raintot = Raintot + Rain_in ''''''''''''''''''''''''''''''''''' '' '' '' Measure GWSAirTemp Thermistors '' '' '' ''''''''''''''''''''''''''''''''''' ' USE HALF BRIDGE TO MEASURE RATIO OF Vse TO Vex ' FOR 2 YSI AIR TEMPERATURE THERMISTORS BrHalf (GWSAirTempR(),2,mV2500,9,Vx2,2,2500,True,0,250,1,0) ' CONVERT VOLTAGE RATIO TO RESISTANCE (kOHM) FOR 2 SENSORS ' FIXED RESISTANCE = 1.0 kOHM GWSAirTempR(1) = 1 * GWSAirTempR(1) / (1 - GWSAirTempR(1)) GWSAirTempR(2) = 1 * GWSAirTempR(2) / (1 - GWSAirTempR(2)) For j=1 To 2 D(j) = LN (1000*GWSAirTempR(j)) 'ln resistance (ohm) GWSAirTemp(j) = (1/(a + b*D(j) + c*(D(j))^3)) - 273.15 'Steinhart & Hart Equation GWSAirTempF(j) = (GWSAirTemp(j)*1.8)+32 ' compute GWS Air Temperature in F Next j ''''''''''''''''''''''''''''''''''' '' '' '' Measure GWSSoilTemp Thermistors '' '' '' ''''''''''''''''''''''''''''''''''' ' first one on EX2 BrHalf (GWSSoilTempR(1),1,mV2500,11,Vx2,2,2500,True,0,250,1,0) GWSSoilTempR(1) = 1 * GWSSoilTempR(1) / (1 - GWSSoilTempR(1)) D(1) = LN (1000*GWSSoilTempR(1)) 'ln resistance (ohm) GWSSoilTemp(1) = (1/(a + b*D(1) + c*(D(1))^3)) - 273.15 'Steinhart & Hart Equation ' second one on EX3 BrHalf (GWSSoilTempR(2),1,mV2500,12,Vx3,1,2500,True,0,250,1,0) GWSSoilTempR(2) = 1 * GWSSoilTempR(2) / (1 - GWSSoilTempR(2)) D(2) = LN (1000*GWSSoilTempR(2)) 'ln resistance (ohm) GWSSoilTemp(2) = (1/(a + b*D(2) + c*(D(2))^3)) - 273.15 'Steinhart & Hart Equation ''''''''''''''''''''''''''''''''''' '' '' '' Measure GWSSoil6Temp Thermistors '' '' '' ''''''''''''''''''''''''''''''''''' ' both on EX3 BrHalf (GWSSoil6TempR(),2,mV2500,13,Vx3,2,2500,True,0,250,1,0) ' CONVERT VOLTAGE RATIO TO RESISTANCE (kOHM) FOR 2 SENSORS ' FIXED RESISTANCE = 1.0 kOHM GWSSoil6TempR(1) = 1 * GWSSoil6TempR(1) / (1 - GWSSoil6TempR(1)) GWSSoil6TempR(2) = 1 * GWSSoil6TempR(2) / (1 - GWSSoil6TempR(2)) For j=1 To 2 D(j) = LN (1000*GWSSoil6TempR(j)) 'ln resistance (ohm) GWSSoil6Temp(j) = (1/(a + b*D(j) + c*(D(j))^3)) - 273.15 'Steinhart & Hart Equation Next j '''''''''''''''''''''''''''''''''''' '' '' '' Measure Snow Depth and Not-Corrected BP every minute '' '' '' '''''''''''''''''''''''''''''''''''' If IfTime(0,15,Min) Then 'SR50 Sonic Ranging Sensor (SDI-12 Output) measurements DT, TCDT, and DBTCDT: SDI12Recorder(DT,3,0,"M1!",100.0,0) 'MEASURE DISTANCE TO SNOW (cm), changed to M1! to get the quaulity number too. TCDT=DT*SQR((GWSAirTemp(1)+273.15)/273.15) 'CORRECT DISTANCE FOR AIR TEMPERATURE (cm) Snowdepth=SensorHt-TCDT 'CALCULATE SNOW DEPTH (cm) Snowdepth_in=Snowdepth/2.54 'calculate snow depth in inches. ' create a variable to not process out-of-range snowdepth values If Snowdepth < -25 OR Snowdepth > 100 Then SR50_Bad = 1 Else SR50_Bad = 0 ' remove the multiplier from the quality number SR50_quality=SR50_quality/100 EndIf 'CS105 Barometric Pressure Sensor measurement 'BP_mbar' If TimeIntoInterval(59,60,Min) Then PortSet(1,1) If TimeIntoInterval(0,60,Min) Then VoltSe(BP_mbar,1,mV2500,1,1,0,250,0.184,600) PortSet(1,0) EndIf ' set Fuel Temperature to 0 as a place holder per Richard Kemnitz request FuelT_F = 0 'The equation used to calculate dew point is: 'Td=(241.88*ln(Vp/0.61078))/(17.558-ln(Vp/0.61078)) DewPoint(TdewC,AirTempC,RH) If TdewC>AirTempC OR TdewC=NAN Then TdewC=AirTempC TdewF=1.8*TdewC+32 'Call Data Tables and Store Data -------------------------------------------- CallTable (HourlyAtms) CallTable (HourlySubSurface) CallTable (HourlyDiag) CallTable (Daily) NextScan EndProg