'CR200 Series 'RUECR216V13.CR2 'Rhodes University 'Location : Estates Division 'Latitude : 33d 18'.789 S = -33.31315 'Longitude : 26d 30'.917 E = 26.51528 'Altitude : 552 metres 'Original programmed by Campbell Scientific South Africa - obtained on 2008/06/19 ' NOTE: This program is extremely sensitive to number of variables and table size. As it stands, no extra table ' entries are possible without deleting existing entries. In particular ETo calculations are not feasible asr ' things stand. The public table is much less resource hungry, not being an array. Maybe it could be used, as ' the data in it is available every time the station is polled? ' Each time you upload a program file to the logger it resets the tables, but it backs up the previously ' downloaded files. 'Revisions: '2008/06/21 - v1.1 - Jacot - small changes a) Use averages instead of samples in some tables ' b) Calculate barometric altitude correction to sea level from 552 ' metres ' dP = 1013.25(1 - (1 - E/44307.69231)^5.25328)), where E is the elevation in metres ' dP = 64.58090166 at 552 metres ' c) Add dP to the offset in the measurement instruction. ' It changes from VoltSe(BP_mbar,1,3,0.24,500) ' to VoltSe(BP_mbar,1,3,0.24,564.5809) ' d) Change order and content of tables 1 and 2 ' e) Check that leaf wetness is providing readings - yes, but 10 times ' bigger than expected! ' f) Correct leaf wetness time calcs - scale mV values by 10 for ' comparisons ' g) Fix up some missing Units definitions ' h) Many fixes in understanding how to upload program files, sorting ' out the output files, as well as realising that the contents of ' the public "table" is uploaded each time and gives values at that ' instant. The other tables are uploaded hourly (Table 1) and daily ' (Tables 2 and 3) ' i) Sort out scheduling and work out which tables get uploaded, and ' how ' j) Sort out basic RTMC web pages and serve them up ' k) Oops - looks like you can't average wind direction :-( '2008/06/22 - v1.1 - Jacot - more changes l) Record max wind speed in Table 1 ' m) Review unit names and tidy up ' n) How do you assign Units to FieldNames? '2008/06/24 - v1.2 - Jacot - complete rewrite to try and eliminate some issues ' o) Calculate ETo, Wind Run, Heat Index, Cumulative daily rainfall ' p) Screwed up barometric pressure and soil measurements :;( '2008/06/25 - v1.3 - Jacot - start again - modify original program and rather add in the other stuff 'Declare Variables and Units Dim TF_44 Public Batt_Volt Public WS_ms Public WindDir Public TRHData(2) Public Rain_mm Public SlrW Public SlrMJ Public BP_mbar Public Results(3) Public LWmV Public LWMDry Public LWMCon Public LWMWet Public Rain24 Public WR Public HI_C Alias TRHData(1)=AirTC Alias TRHData(2)=RH Alias Results(1)=SoilM Alias Results(2)=unused Alias Results(3)=SoilT Units Batt_Volt=Volts Units WS_ms=meters/second Units WindDir=Deg Units Rain_mm=mm Units SlrW=W/mē Units SlrMJ=MJ/mē Units BP_mbar=mbar Units LWmV=mV Units LWMDry=Minutes Units LWMCon=Minutes Units LWMWet=Minutes Units AirTC=Deg C Units SoilT=Deg C Units SoilM=mV Units RH=% Units Rain24=mm Units WR=meters Units HI_C=Deg C 'Define Data Tables DataTable(Table1,True,-1) DataInterval(0,60,Min) Average(1,AirTC,False) Average(1,RH,False) Totalize(1,Rain_mm,False) Average(1,SlrW,False) Average(1,BP_mbar,False) Average(1,SoilT,False) 'Average(1,SoilM,False) WindVector (WS_ms,WindDir,False,0,1) FieldNames("WS_ms_S_WVT,WindDir_D1_WVT") Sample(1,Rain24) EndTable DataTable(Table2,True,-1) DataInterval(0,1440,Min) WindVector (WS_ms,WindDir,False,0,1) FieldNames("WS_ms_S_WVT,WindDir_D1_WVT") Maximum(1,WS_ms,False,False) Maximum(1,AirTC,False,False) Minimum(1,AirTC,False,False) Totalize(1,SlrMJ,False) Average(1,BP_mbar,False) ETo(AirTC,RH,WS_ms,SlrW,-33.3132,26.5153,552,False) FieldNames("AirTC_Avg,RH_Avg,WS_ms_Avg,SlrW_Avg,ETo") Totalize(1,Rain_mm,False) EndTable DataTable(Table3,True,-1) DataInterval(0,1440,Min) Minimum(1,Batt_Volt,False,False) Totalize(1,LWMDry,False) Totalize(1,LWMCon,False) Totalize(1,LWMwet,False) EndTable 'Main Program BeginProg Scan(10,Sec) 'Default Datalogger Battery Voltage measurement Batt_Volt: Battery(Batt_Volt) '03001 Wind Speed & Direction Sensor measurements WS_ms and WindDir: PulseCount(WS_ms,P_LL,1,1,0.75,0.2) If WS_ms<0.21 Then WS_ms=0 ExDelSE(WindDir,1,1,1,mV2500,3000,0.142,0) If WindDir>=360 Then WindDir=0 'TE525/TE525WS Rain Gauge measurement Rain_mm: PulseCount(Rain_mm,P_SW,2,0,0.254,0) 'CS300 Pyranometer measurements SlrMJ and SlrW: VoltSe(SlrW,1,2,1,0) If SlrW<0 Then SlrW=0 SlrMJ=SlrW*0.00005 SlrW=SlrW*5.0 'PTB110 Barometric Pressure Sensor (CSL) measurement BP_mbar, corrected for sea level: PortSet(2,1) VoltSe(BP_mbar,1,3,0.24,564.5809) ' BP_mbar=BP_mbar*1.0 'LWS Dielectric Leaf Wetness Sensor measurement LWmV: ExDelSE(LWmV,1,4,1,mV2500,10000,1,0) 'Determine Minutes Dry (LWMDry), Minutes Wet or Contaminated (LWMCon), and Minutes Wet (LWMWet) for this Scan: LWMDry=0 LWMCon=0 LWMWet=0 If LWmV<274 Then LWMDry=0.16666 Else If LWmV>=284 Then LWMWet=0.16666 Else LWMCon=0.16666 EndIf EndIf 'CS215 Temperature & Relative Humidity Sensor (CSL) measurements AirTC and RH: SDI12Recorder(AirTC,"0M!",1,0) 'Generic SDI-12 Sensor measurements SoilT, SoilM, Result3, 'Result4, Result5, Result6, Result7, Result8, and Result9: SDI12Recorder(SoilM,"1M!",1,0) '24 Hour Running Total calculation Rain24: Rain24=Rain24+Rain_mm If IfTime(0,1440,Min) Then Rain24=0 'Wind Run calculation WS_ms: 'Convert to meters per second if needed and multiply by the scan rate in seconds. WR=WS_ms*10.0 'Heat Index calculation HI_C: TF_44=1.8*AirTC+32 HI_C=-42.379+2.049*TF_44+10.143*RH-0.22476*TF_44*RH-6.8378*10^-3*TF_44^2-5.4817*10^-2*RH^2+1.2287*10^-3*TF_44^2*RH+8.5282*10^-4*TF_44*RH^2-1.99*10^-6*TF_44^2*RH^2 If TF_44<80 OR RH<40 OR HI_C