' imnavait_met.cr1x ' by Joel Bailey 7/10/2005 ' adapted from Ken Irving's das12.cr1 ' constants for base logger-diagnostics precip-te525m rh-pwr-on air-hc2s3 wind-rmyoung air-109 soilsurface-109 barometer-cs106 rh-pwr-off netrad-nrlite snow-sr50a time-variables relay-control-sub camera modem thermistors soilh2o-cs650 pt-aquistar turbidity-obs500 call-met-tables call-hydro-tables call-soil-tables ' 8/26/2015 updated ATB constants, changed steinhart equations for soil thermistors ' 11/18/2015 correctd the stein-hart equations for the soil temp sensors, chaged resistance values to record Kohms instead of ohms ' 10May2017 EKY Changed Met table to -1 from (8 timesteps) ' 10May2017 EKY added wiring diagram. ' 10May2017 EKY added const NR_WS_CORR ' 10May2017 EKY added pir thermistor constants ' 10May2017 EKY added Radiation constants to bottom of ConstTable ' 10May2017 EKY added PIR/PSP to MUX2, need to remove HUksflux stuff ' 16May2017 JPB removed huskflux language, moved all thermistors to one measurment 1-16, changed calc_thermistors() subroutine to use different constants for two rad_temps, ' 5/17/2017 EKY changed multiplexor scan rate to 60 s ' 5/17/2017 EKY acjusted calc thermistor routine to do eppley thermistor first as they were wired to 1 and 2 ' 5/19/2017 JPB changed Alias names for thermistors, moved rad_1 and rad_2 from therm(15) and therm(16) to therm(1) and therm(2), same for rad_r1 and rad_r2 to reflect wiring, removed slow sequence because scan rate is the same as main program ' 5/19/2017 EKY added radiation constants ' 5/20/2017 EKY changed Radraw table, got rid of rad_therm_X and rad_therm_R, added +273.15 to the temp in C, so it is in K, in rad(1) and rad(2) calculation ' 5/20/2017 EKY changed data tables to list all 4 components of radiation ' 7/6/2017 EKY changed Volt Diff parameters for rad() msmt '6sept2023 eky. precip under reported for entire year. tested onsite w/ multiple gauges and they would not work in pp2. switched ws-10m to pp2 and precip to pp1 and it worked with 2 different gauges in pp1. 10 ws appears to work in pp2. not sure why. changeed program for preci to be in p1 and 10m ws to be in p2. '5/16/2024 JPB Converted to CR1000x prorgam, added ATB_1m, ATB_3m, ATB_10m to multiplexor 1 diff 17,18,19 '5/30/2024 JPB changed 3 AT sensors to EE181's, removed new ATB_1m, existing one exists '6/1/2024 EKY Wind speed 10m and ATB didn't work after the installation of 1000x logger and program. adjusted Wind Speed for 1000x programming. Added 3m at/rh programming for HC2S3 (not EE181) with an offset of -50. Check the GWSx3 atb_1m half bridge??? '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''' LOGGER WIRING '''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' SE1 -- AT1m ' SE2 -- RH1m ' SE3 -- AT3m ' SE4 -- RH3m ' SE5 -- AT10m ' SE6 -- RH10m ' SE7 -- ATB ' SE8 -- WD ' SE9 -- NRLite ' SE10 -- NRLite ' AG -- Connected to SE10 ' SE11 -- AM16/32B #2 Com ODD HI ' SE12 -- AM16/32B #2 Com ODD Lo Jumper to AG? ' AGND -- ' SE13 -- ' SE14 -- ' SE15 -- Barometric Pressure ' SE16 -- MUX #1 thermistors, Eppley Thermistors odd hi com, Vx2 'Need an excitation for Eppley PIR Thermistor, Vx2? ' VX1 -- WD ' VX2 -- MUX #1 thermistors, Eppley Thermistor, resistor to SE16 ' VX3 -- ATB ' P1 -- WS ' P2 -- Precip ' C1 -- AM16/32B #1 -- RES ' C2 -- AM16/32B #1 -- CLK ' C3 -- AM16/32B #2 -- RES ' C4 -- RH relay ' C5 -- SR50 ' C6 -- AM16/32B #2 -- CLK ' C7 -- ' C8 -- Barometric Pressure ' SW12V -- Radio Power ' AM16/32B #1 in 4/16 Mode ' RES - CR1000 C1 ' CLK - CR1000 C2 ' 12V - CR1000 12V ' G - CR1000 G ' COM ODD HI - CR1000 SE16, Precision Resistor to CR1000 VX2 ? ' COM ODD LO - CR1000 AG ' Com EVEN HI - ' Com EVEN LO - ' Diff Channel 1 odd PIR lw up thermistor ' Diff Channel 2 odd PIR lw down thermistor ' Diff Channel 3-16 soil thermistors ' Diff Channel 17-18 Atb_3m, and Atb_10m ' AM16/32B #2 in 4/16 Mode ' RES - CR1000 C3 ' CLK - CR1000 C6 ' 12V - CR1000 12V ' G - CR1000 G ' COM ODD HI - CR1000 SE11 ' COM ODD LO - CR1000 SE12 ' Com EVEN HI - ' Com EVEN LO - ' Diff Channel 1 odd PIR lw up red Hi, black L ' Diff Channel 2 odd PIR lw down red Hi, black L ' Diff Channel 3 odd PSP sw up red Hi, black L, jumper from L to AG ' Diff Channel 4 odd PSP sw down red Hi, black L, jumper from L to AG Const TWOPI = 4 * ATN2(1,0) Const NR_WS_CORR = 0.021286 Const MUX_PULSE_USEC = 10000 '' Steinhart & Hart constants for soil temp sensors and PIR sensors Const kA = 0.0014654354 Const kB = 0.0002386780 Const kC = 0.0000001000 Const pir_kA = 0.0010295 Const pir_kB = 0.0002391 Const pir_kC = 0.0000001568 '' Steinhart & Hart constants for YSI '' steinhart-hart-constants for ATB Const ATB_kA = 0.0014654354 Const ATB_kB = 0.0002386780 Const ATB_kC = 0.0000001000 ConstTable Const PAKBUS_INFO = 185 Const P_MODL = "TE525MM" Const P_TIP = 0.1 Const P_UNITS = "mm" Const P__PP = P1 Const RH_RELAY__CP = C4 Const RH_1M_MODL = "HC2S3" Const RH_1M_SN = "XXX" Const RH_1M_MULT = 0.1 Const RH_1M_OFS = 0 Const AT_1M_MULT = 0.1 Const AT_1M_OFS = -40 Const AT_1M__SE = 1 Const RH_1M__SE = 2 Const RH_3M_MODL = "HC2S3" Const RH_3M_SN = "XXX" Const RH_3M_MULT = 0.1 Const RH_3M_OFS = 0 Const AT_3M_MULT = 0.1 Const AT_3M_OFS = -40 Const AT_3M__SE = 3 Const RH_3M__SE = 4 Const RH_10M_MODL = "HC2S3" Const RH_10M_SN = "XXX" Const RH_10M_MULT = 0.1 Const RH_10M_OFS = 0 Const AT_10M_MULT = 0.1 Const AT_10M_OFS = -40 Const AT_10M__SE = 5 Const RH_10M__SE = 6 Const WS_1M_MODL = "014A MET ONE" Const WS_1M_UNITS = "m/s" Const WS_1M__PP = C7 Const WS_3M_MODL = "014A MET ONE" Const WS_3M_UNITS = "m/s" Const WS_3M__PP = C8 Const WS_10M_MODL = "RMY 05103" Const WS_10M_UNITS = "m/s" Const WS_10M_MULT = 0.098 Const WD_10M_UNITS = "deg" Const WD_10M_OFS = 0 Const WD_10M_MULT = 355 Const WS_10M__PP = P2 Const WD_10M__SE = 8 Const WD_10M__EX = Vx1 Const ATB_MODL = "ATB_GW_SCI" Const ATB_SN = "XXX" Const ATB_MULT = 1 Const ATB_OFS = 0 Const ATB__SE = 7 Const ATB__EX = Vx3 Const ATB_REF_OHMS = 1000 Const PB_MODL = "CS106" Const PB_SN = "XXX" Const PB_UNITS = "mBar" Const PB_MULT = 0.24 Const PB_OFS = 600 Const PB__SE = 15 Const NR_MODL = "NR-LITE" Const NR_SN = "114128" Const NR_CALIB = 11.9 Const NR_CALIB_UNITS = "uV/W/m^2" Const NR_UNITS = "W/m^2" Const NR__DIFF = 5 Const SNW_MODL = "SR50A" Const SNW_SN = "4415" Const SNW_HT_CM = 176 Const SNW_SDI_ADDR = 0 Const SDI12__CP = C5 Const MODM_PWR__CP = SW12_1 Const MODM_MODL = "FGR115" Const MODM_SN = "XXX" Const MODM_ON_MIN = 0 Const MODM_OFF_MIN = 10 Const MODM_PERIOD = 30 Const MODM_V_LIM = 12.4 Const MODM_HOLD_V_LIM = 12.6 Const THERMISTOR_TYPE = "XXX" Const THERMISTOR_QTY = 18 Const MUX_SE_QTY = 1 Const MUX_THERM__SE = 16 Const MUX_RESET__CP = C1 Const MUX_CLOCK__CP = C2 Const MUX__EX = Vx2 Const R_REF_KOHMS = 4 Const HUSKFLUX_QTY = 2 Const MUX2_RESET__CP = C3 Const MUX2_CLOCK__CP = C6 Const MUX2__DIFF = 6 Const PIR_MODL_LW_UP = "Eppley PIR" Const PIR_SN_LW_UP = "27597F3" Const PIR_MULT_LW_UP = 275.485 Const PIR_MODL_LW_DOWN = "Eppley PIR" Const PIR_SN_LW_DOWN = "21172F3" Const PIR_MULT_LW_DOWN = 233.100 Const PSP_MODL_SW_UP = "Eppley PSP" Const PSP_SN_SW_UP = "30157F3" Const PSP_MULT_SW_UP = 144.928 Const PSP_MODL_SW_DOWN = "Eppley PSP" Const PSP_SN_SW_DOWN = "29095F3" Const PSP_MULT_SW_DOWN =133.156 Const NO_OF_EPPLEY = 4 Const R_REF_OHMS = 1000 EndConstTable ' base: Public progSig As Long ' logger-diagnostics: Public battery, PanelT Units PanelT = degC Units battery = Volts ' precip-te525m: Public precip ' air-hp45c 1m Public at_1m, rh_1m, dp_1m Units at_1m = degC Units dp_1m = degC Units rh_1m = percent ' air-hp45c 3m Public at_3m, rh_3m, dp_3m Units at_3m = degC Units dp_3m = degC Units rh_3m = percent ' air-hp45c 10m Public at_10m, rh_10m, dp_10m Units at_10m = degC Units dp_10m = degC Units rh_10m = percent ' Met_one at 1m Public ws_1m Alias ws_1m = windSpeed_1m Units ws_1m = m/s ' Met_one at 3m Public ws_3m Alias ws_3m = windSpeed_3m Units ws_3m = m/s ' wind-rmyoung at 10m: Public ws_10m, wd_10m Alias ws_10m = windSpeed_10m Units ws_10m = m/s Alias wd_10m = windDir_10m Units wd_10m = WD_UNITS ' atb GWS Public atb, atb_X, atb_R Units atb = degC Units atb_X = volts Units atb_R = ohms ' barometer-cs106: Public pb Units pb = mbar ' netrad-nrlite: Public nr(2) Alias nr = netRad_raw,netRad ' eppley-pir Public rad_mv(4), rad(4) Dim k Alias rad = rad_lw_up, rad_lw_down, rad_sw_up, rad_sw_down Units rad_mv() = mV Units rad() = w/m2 ' snow-sr50a: Public sr50_raw(2), sr50_down, snowdepth, sr50_height Alias sr50_raw(2) = sr50_quality ' time-variables: Dim Time(9) Alias Time(4) = thisHour Alias Time(5) = thisMinute Alias Time(9) = thisDOY ' modem: Public modemOnMin, modemOffMin, modemPeriod, modemVlim, modemHldVlim Public modemHold As Boolean, modemForce As Boolean ' thermistors: Public therm(THERMISTOR_QTY), therm_R(THERMISTOR_QTY) Dim i,therm_X(THERMISTOR_QTY) Alias therm = rad_temp1, rad_temp2, st_plus_5cm_snow,st_sfc,st_5cm,st_10cm,st_20cm,st_30cm,st_40cm,st_50cm,st_60cm,st_80cm, st_100cm, st_120cm, atb_3m, atb_10m Alias therm_R = rad_R1, rad_R2,st_plus_5cm_snow_R,st_sfc_R,st_5cm_R,st_10cm_R,st_20cm_R,st_30cm_R,st_40cm_R,st_50cm_R,st_60cm_R,st_80cm_R, st_100cm_R, st_120cm_R, atb_3m_R, atb_10m_R Units therm_R() = KOhms Units therm() = degC 'might need to redefine these. 'Public therm_R 'Dim therm_X 'Units therm_R = Ohms ' Daily: base precip-te525m air-hc2s3 wind-rmyoung air-109 netrad-nrlite snow-sr50a DataTable(Daily,1,-1) DataInterval(0,1440,Min,0) Sample(1,progSig,uint2) Totalize(1,precip,fp2,0) Average(1,at_1m,fp2,0) Average(1,at_3m,fp2,0) Average(1,at_10m,fp2,0) Average(1,ws_1m,fp2,0) Average(1,ws_3m,fp2,0) WindVector(1,windSpeed_10m,windDir_10m,fp2,0,0,0,0) Average(1,atb,fp2,0) Average(1,netRad,fp2,0) Average(4,rad(),fp2,0) Average(1,snowdepth,fp2,0) Average(1,atb_3m,fp2,0) Average(1,atb_10m,fp2,0) EndTable ' HrlyAtms: base precip-te525m air-hc2s3 wind-rmyoung air-109 barometer-cs106 netrad-nrlite snow-sr50a DataTable(HrlyAtms,1,-1) DataInterval(0,60,Min,0) Sample(1,progSig,uint2) Totalize(1,precip,fp2,0) Sample(1,at_1m,fp2) Average(1,at_1m,fp2,0) Minimum(1,at_1m,fp2,0,0) Maximum(1,at_1m,fp2,0,0) Sample(1,rh_1m,fp2) Minimum(1,rh_1m,fp2,0,0) Maximum(1,rh_1m,fp2,0,0) Sample(1,dp_1m,fp2) Average(1,dp_1m,fp2,0) Minimum(1,dp_1m,fp2,0,0) Maximum(1,dp_1m,fp2,0,0) Sample(1,at_3m,fp2) Average(1,at_3m,fp2,0) Minimum(1,at_3m,fp2,0,0) Maximum(1,at_3m,fp2,0,0) Sample(1,rh_3m,fp2) Minimum(1,rh_3m,fp2,0,0) Maximum(1,rh_3m,fp2,0,0) Sample(1,dp_3m,fp2) Average(1,dp_3m,fp2,0) Minimum(1,dp_3m,fp2,0,0) Maximum(1,dp_3m,fp2,0,0) Sample(1,at_10m,fp2) Average(1,at_10m,fp2,0) Minimum(1,at_10m,fp2,0,0) Maximum(1,at_10m,fp2,0,0) Sample(1,rh_10m,fp2) Minimum(1,rh_10m,fp2,0,0) Maximum(1,rh_10m,fp2,0,0) Sample(1,dp_10m,fp2) Average(1,dp_10m,fp2,0) Minimum(1,dp_10m,fp2,0,0) Maximum(1,dp_10m,fp2,0,0) Sample(1,windSpeed_1m,fp2) Sample(1,windSpeed_3m,fp2) Sample(1,windSpeed_10m,fp2) Sample(1,windDir_10m,fp2) WindVector(1,windSpeed_10m,windDir_10m,fp2,0,0,0,0) Maximum(1,windSpeed_1m,fp2,0,0) Maximum(1,windSpeed_3m,fp2,0,0) Maximum(1,windSpeed_10m,fp2,0,0) Sample(1,atb,fp2) Average(1,atb,fp2,0) Minimum(1,atb,fp2,0,0) Maximum(1,atb,fp2,0,0) Sample(1,pb,fp2) Average(1,pb,fp2,0) Average(1,netRad,fp2,0) Average(4,rad(),fp2,0) Average(1,snowdepth,fp2,0) Average(1,atb_3m,fp2,0) Minimum(1,atb_3m,fp2,0,0) Maximum(1,atb_3m,fp2,0,0) Average(1,atb_10m,fp2,0) Minimum(1,atb_10m,fp2,0,0) Maximum(1,atb_10m,fp2,0,0) EndTable ' HrlyDiag: base logger-diagnostics DataTable(HrlyDiag,1,-1) DataInterval(0,60,Min,0) Sample(1,progSig,uint2) Average(1,battery,fp2,0) Average(1,PanelT,fp2,0) EndTable ' HrlySoil: base soilsurface-109 thermistors soilh2o-cs650 DataTable(HrlySoil,1,-1) DataInterval(0,60,Min,0) Sample(1,progSig,uint2) Average(THERMISTOR_QTY,therm(),fp2,0) EndTable ' Met: base precip-te525m air-hc2s3 wind-rmyoung air-109 barometer-cs106 netrad-nrlite snow-sr50a DataTable(Met,1,-1) DataInterval(0,60,Min,0) Sample(1,progSig,uint2) Totalize(1,precip,fp2,0) Average(1,at_1m,fp2,0) Sample(1,rh_1m,fp2) Average(1,at_3m,fp2,0) Sample(1,rh_3m,fp2) Average(1,at_10m,fp2,0) Sample(1,rh_10m,fp2) Average(1,windSpeed_1m,fp2,0) Average(1,windSpeed_3m,fp2,0) WindVector(1,windSpeed_10m,windDir_10m,fp2,0,0,0,0) Average(1,atb,fp2,0) Average(1,pb,fp2,0) Average(1,netRad,fp2,0) Average(4,rad(),fp2,0) Average(1,snowdepth,fp2,0) Average(1,atb_3m,fp2,0) Average(1,atb_10m,fp2,0) EndTable ' SR50: base air-hc2s3 snow-sr50a DataTable(SR50,1,-1) DataInterval(0,60,Min,0) Sample(1,progSig,uint2) Average(1,at_3m,fp2,0) Average(1,snowdepth,fp2,0) Sample(1,sr50_height,fp2) Average(1,sr50_quality,fp2,0) EndTable ' Therm-R: base thermistors DataTable(Therm_Res,1,-1) DataInterval(0,60,Min,0) Sample(1,progSig,uint2) Average(THERMISTOR_QTY,therm_R(),fp2,0) EndTable ' Epply Radiometer RAW: DataTable(RadRaw,1,-1) DataInterval(0,60,Min,0) Sample(1,progSig,uint2) Average(4,rad_mv(),fp2,0) Average(1,therm_X(1),fp2,0) Average(1,therm_X(2),fp2,0) Average(1,therm_R(1),fp2,0) Average(1,therm_R(2),fp2,0) Average(1,therm(1),fp2,0) Average(1,therm(2),fp2,0) EndTable ' relay-control-sub:relayControl() Sub relayControl(relayPort,onMin,offMin,period,Vlimit,holdVlimit,hold,force) ' uses globals thisMinute, battery If force Then Call setRelayState(relayPort,1) If thisMinute MOD period = onMin AND battery >= Vlimit Then Call setRelayState(relayPort,1) If thisMinute MOD period = onMin AND battery < holdVlimit Then hold = 0 If thisMinute MOD period = offMin AND NOT hold Then Call setRelayState(relayPort,0) EndSub ' relay-control-sub:setPortState() Sub setRelayState(relay,state As Boolean) ' portSet() does not allow variable for port, so brute force it: If relay = SW12_1 Then SW12(SW12_1,state,0) EndIf EndSub ' thermistors:calc_thermistors() Sub calc_thermistors() Dim j, lnR For j=1 To 2 '' calculate thermistor resistance from ratio and ref R: therm_R(j) = R_REF_KOHMS * therm_X(j) / (1-therm_X(j)) '' calculate natural log of thermistor resistance: lnR = LN(therm_R(j)*1000) '' use Steinhart & Hart equation to derive temperature: therm(j) = (1/(pir_kA + pir_kB*lnR + pir_kC*lnR^3)) Next j For j=3 To 16 '' calculate thermistor resistance from ratio and ref R: therm_R(j) = R_REF_KOHMS * therm_X(j) / (1-therm_X(j)) '' calculate natural log of thermistor resistance: lnR = LN(therm_R(j)*1000) '' use Steinhart & Hart equation to derive temperature: therm(j) = (1/(kA + kB*lnR + kC*lnR^3)) - 273.15 Next j For j=17 To 19 '' calculate thermistor resistance from ratio and ref R: therm_R(j) = R_REF_KOHMS * therm_X(j) / (1-therm_X(j)) '' calculate natural log of thermistor resistance: lnR = LN(therm_R(j)*1000) '' use Steinhart & Hart equation to derive temperature: therm(j) = (1/(ATB_kA + ATB_kB*lnR + ATB_kC*lnR^3)) - 273.15 Next j EndSub ' thermistors:calc_atb() Sub calc_atb() Dim lnR '' calculate thermistor resistance from ratio and ref R: atb_R = ATB_REF_OHMS * atb_X / (1-atb_X) '' calculate natural log of thermistor resistance: lnR = LN(atb_R) '' use Steinhart & Hart equation to derive temperature: atb = (1/(ATB_kA + ATB_kB*lnR + ATB_kC*lnR^3)) - 273.15 EndSub BeginProg ' for base: progSig = status.ProgSignature ' for snow-sr50a: sr50_height = SNW_HT_CM ' for modem: modemOnMin = (MODM_ON_MIN + MODM_PERIOD) MOD MODM_PERIOD modemOffMin = (MODM_OFF_MIN + MODM_PERIOD) MOD MODM_PERIOD modemPeriod = MODM_PERIOD modemVlim = MODM_V_LIM modemHldVlim = MODM_HOLD_V_LIM Scan(60,sec,0,0) ' logger-diagnostics: PanelTemp(PanelT,250) battery(battery) ' precip-te525m: PulseCount(precip,1,P__PP,1,0,P_TIP,0) ' rh-pwr-on: PortSet(RH_RELAY__CP,1) Delay(0,2000,mSec) ' air-hp45c 1m: 'VoltSe(at_1m,1,mV5000,AT_1M__SE,1,0,250,AT_1M_MULT,AT_1M_OFS) 'VoltSe(rh_1m,1,mV5000,RH_1M__SE,1,0,250,RH_1M_MULT,RH_1M_OFS) ' air-EE181 1m at and rh VoltSe(at_1m,1,mV1000,AT_1M__SE,1,0,15000,AT_1M_MULT,-40) VoltSe(rh_1m,1,mV1000,RH_1M__SE,1,0,15000,RH_1M_MULT,RH_1M_OFS) DewPoint(dp_1m,at_1m,rh_1m) ' air-hp45c 3m: 'VoltSe(at_3m,1,mV5000,AT_3M__SE,1,0,250,AT_3M_MULT,AT_3M_OFS) 'VoltSe(rh_3m,1,mV5000,RH_3M__SE,1,0,250,RH_3M_MULT,RH_3M_OFS) ' air-HC2S3 3m at and rh VoltSe(at_3m,1,mV1000,AT_3M__SE,1,0,15000,AT_3M_MULT,-50) VoltSe(rh_3m,1,mV1000,RH_3M__SE,1,0,15000,RH_3M_MULT,RH_3M_OFS) DewPoint(dp_3m,at_3m,rh_3m) 'HC2S3 (panel switched power) Temperature & Relative Humidity Sensor measurements 'AirTC_2' and 'RH_2' 'SW12(SW12_1,1,0) 'Delay(0,3,Sec) 'VoltSE(AirTC_2,1,mV1000,5,False,0,15000,0.1,-40) 'VoltSE(RH_2,1,mV1000,6,False,0,15000,0.1,0) 'SW12(SW12_1,0,0) 'If RH_2>100 AND RH_2<103 Then RH_2=100 ' air-hp45c 10m: 'VoltSe(at_10m,1,mV5000,AT_10M__SE,1,0,250,AT_10M_MULT,AT_10M_OFS) 'VoltSe(rh_10m,1,mV5000,RH_10M__SE,1,0,250,RH_10M_MULT,RH_10M_OFS) ' air-EE181 10m at and rh VoltSe(at_10m,1,mV1000,AT_10M__SE,1,0,15000,AT_10M_MULT,-40) VoltSe(rh_10m,1,mV1000,RH_10M__SE,1,0,15000,RH_10M_MULT,RH_10M_OFS) DewPoint(dp_10m,at_10m,rh_10m) 'short cut example EE181 (panel switched power) Temperature & Relative Humidity Sensor measurements 'AirTC' and 'RH' 'SW12(SW12_1,1,0) 'Delay(0,2,Sec) 'VoltSE(AirTC,1,mV1000,3,False,0,15000,0.1,-40) 'VoltSE(RH,1,mV1000,4,False,0,15000,0.1,0) 'SW12(SW12_1,0,0) 'If RH>100 And RH<103 Then RH=100 '014A Wind Speed Sensor measurement 'WS_1m' PulseCount(ws_1m,1,WS_1M__PP,2,1,0.8,0.447) If ws_1m<0.457 Then ws_1m=0 '014A Wind Speed Sensor measurement 'WS_3m' PulseCount(ws_3m,1,WS_3M__PP,2,1,0.8,0.447) If ws_3m<0.457 Then ws_3m=0 ' wind-rmyoung 10m: PulseCount(ws_10m,1,WS_10M__PP,5,1,WS_10M_MULT,0) BrHalf(wd_10m,1,mV5000,WD_10M__SE,WD_10M__EX,1,2500,True,20000,15000,WD_10M_MULT,WD_10M_OFS) 'shortcut example 05103 Wind Speed & Direction Sensor measurements 'WS_ms' and 'WindDir' 'PulseCount(WS_ms,1,P1,5,1,0.098,0) 'BrHalf(WindDir,1,mV5000,2,VX2,1,2500,True,20000,15000,355,0) 'If WindDir>=355 OR WindDir<0 Then WindDir=0 ' atb GWS BrHalf (atb_X,1,mV5000,ATB__SE,ATB__EX,1,2500,True,0,15000,ATB_MULT,ATB_OFS) calc_atb() 'Generic Half Bridge measurements 'HalfBr' 'BrHalf(HalfBr,1,mV5000,1,VX1,1,2500,True,500,15000,1,0) ' barometer-cs106: VoltSe(pb,1,mV5000,PB__SE,1,0,250,PB_MULT,PB_OFS) ' rh-pwr-off: PortSet(RH_RELAY__CP,0) ' netrad-nrlite: VoltDiff(nr,1,mV200,NR__DIFF,True,0,250,1000/NR_CALIB,0) netRad = netRad_raw If windSpeed_10m > 5 Then netRad = netRad_raw * (1 + NR_WS_CORR * (windSpeed_10m-5)) ' snow-sr50a: '' read SR50A snow depth sensor: '' read distance in m (positive) and quality number into sr50_raw() '' make distance down negative, convert to cm '' apply correction for speed of sound as f(temperature, 0C) '' calculate snow depth as sum of sensor height and distance down '' SDI12Recorder(sr50_raw, SDI12__CP, SNW_SDI_ADDR, "M1!", 1, 0) sr50_raw = sr50_raw * -100.0 sr50_down = sr50_raw * SQR((at_3m+273.15) / 273.15) snowdepth = sr50_height + sr50_down ' modem: relayControl(MODM_PWR__CP,modemOnMin,modemOffMin,modemPeriod,modemVlim,modemHldVlim,modemHold,modemForce) ' thermistors: PortSet(MUX_RESET__CP,1) i = 1 SubScan(0,Sec,THERMISTOR_QTY) PulsePort(MUX_CLOCK__CP,MUX_PULSE_USEC) BrHalf (therm_X(i),1,mV5000,MUX_THERM__SE,MUX__EX,1,2500,True,0,250,1.0,0) i = i + 1 NextSubScan PortSet(MUX_RESET__CP,0) calc_thermistors() 'Eppley Radiometers PortSet(MUX2_RESET__CP,1) k=1 SubScan(0,uSec,NO_OF_EPPLEY) 'Switch to next AM16/32 Multiplexer channel PulsePort(MUX2_CLOCK__CP,MUX_PULSE_USEC) ' read 2 PIR with thermistors, read 2 PSP If k=1 Then VoltDiff(rad_mv(1),1,mV200C,MUX2__DIFF,True,0,250,1,0) ElseIf k=2 Then VoltDiff(rad_mv(2),1,mV200C,MUX2__DIFF,True,0,250,1,0) ElseIf k=3 Then VoltDiff(rad_mv(3),1,mV200C,MUX2__DIFF,True,0,250,1,0) ElseIf k=4 Then VoltDiff(rad_mv(4),1,mV200C,MUX2__DIFF,True,0,250,1,0) EndIf k = k + 1 NextSubScan rad(1) = (rad_mv(1)*PIR_MULT_LW_UP) + (5.6697E-8 * (therm(1))^4) rad(2) = (rad_mv(2)*PIR_MULT_LW_DOWN) + (5.6697E-8 * (therm(2))^4) rad(3) = rad_mv(3)* PSP_MULT_SW_UP rad(4) = rad_mv(4)* PSP_MULT_SW_DOWN 'Turn AM16/32 Multiplexer Off PortSet(MUX2_RESET__CP,0) ' time-variables: RealTime(Time()) ' call-met-tables: CallTable Daily CallTable HrlyAtms CallTable HrlyDiag CallTable SR50 CallTable Met ' call-soil-tables: CallTable HrlySoil CallTable Therm_Res CallTable RadRaw NextScan EndProg