'****************************** 'Version History '****************************** 'V1.0 12/08/08 Changes by AR. 'IRT's added for the Mast Hut surfaces. Labelled "MastNorth", MastEast", MastSouth", "MastWestATT", "MastWestCTT", and "MastRoof". 'The MastWest sensor is an Apogee IRTS-P with Apparent Target (ATT) and Body temperatures and requires calculations for Calculated Target Temperature (CTT) '****************************** 'SequentialMode PipeLineMode Const SCAN_INTERVAL = 100 '100 mSec const CSAT_opt=int(1000/scan_interval) 'compute csat3 execution parameter Const SDM_PER=30 'Declare Public Variables 'Example: Public PTemp_C, batt_volt 'Rain Guage Public RainTips Units RainTips = Pulses 'Sonic CSAT3 public csat(5) alias csat(1)=Ux alias csat(2)=Uy Alias csat(3)=Uz Alias csat(4)=Ts Alias csat(5)=diag 'Other Sensors Units Batt_Volt=Volts Units PTemp_C=Deg C 'IRT's Public MastSouthATT Public MastSouthCTT Public MastNorth 'J Public MastEast 'J1 Public MastRoof 'J6 Public MastWest 'K5 Units MastSouthATT=Deg C Units MastSouthCTT=Deg C Units MastNorth=Deg C Units MastEast=Deg C Units MastRoof=Deg C Units MastWest=Deg C 'Program Variables Dim n 'Number of samples in the on-line covariances. Units n = samples 'Measurement variables without delays. Dim CSAT_in(5) 'CSAT3 data, before adding delay. 'Apogee IRT correction variables. Dim SB_C_5 Dim Psb_6 Dim Hsb_7 Dim Ksb_8 Dim SEC_9 'Program Control flags. Public PRG_CNT 'Define Data Tables 'Sonic and CS7500: sample rate 10 Hz DataTable (Fast,true,-1) Sample(5,csat(1),IEEE4) EndTable 'IRT's DataTable(Temp,True,-1) DataInterval(0,5,Min,10) Average(1,PTemp_C,FP2,False) StdDev(1,PTemp_C,FP2,False) Average(1,MastSouthATT,FP2,False) StdDev(1,MastSouthATT,FP2,False) Average(1,MastSouthCTT,FP2,False) StdDev(1,MastSouthCTT,FP2,False) Average(1,MastNorth,FP2,False) StdDev(1,MastNorth,FP2,False) Average(1,MastEast,FP2,False) StdDev(1,MastEast,FP2,False) Average(1,MastRoof,FP2,False) StdDev(1,MastRoof,FP2,False) Average(1,MastWest,FP2,False) StdDev(1,MastWest,FP2,False) EndTable '************************* 'Program '************************* BeginProg ' n= 1 ' PRG_CNT=0 'Set all CSAT3 variables to NaN. Move (CSAT_in(1),5,NaN,1) 'Set the SDM clock speed. SDMSpeed (SDM_PER) 'High-frequency scan at given interval Scan (100,mSec,800,0) 'Get CSAT3 data. CSAT3(csat(1),1,3,91,10) 'Delay the CSAT3 measurements by one or four scans. ' CallTable(BUFFER) ' If ( scan_count >= ANASYS_DELAY ) Then 'Load in CSAT3 measurements that have been delayed by one or four scans. ' GetRecord (CSAT_Ux,BUFFER,CSAT_DELAY) 'Compute the AGC (Automatic Gain Control) ' IRGA_AGC = INT ((IRGA_Dia AND &h000f) * 6.25 + 0.5) ' Else ' scan_count = scan_count+1 ' EndIf ' RealTime(SYS_RealTime) ' If (SYS_RealTime(7) < 50000 AND ((SYS_Realtime(6) MOD 2) = 0)) Then (PRG_CNT = 0) 'less than 50 msec reset timing every 2 seconds 'If (PRG_CNT = 1) ' 'Wiring Panel Temperature Logger PanelTemp(PTemp_C,250) 'Battery Volatage Battery (Batt_Volt) 'EndIf 'If(PRG_CNT=2) 'IRTS-P Precision Infrared Temperature Sensor measurements MastWestATT and MastWestCTT: 'Measure apparent target temperature with IRTS-P. TCDiff(MastSouthATT,1,mV20C,10,TypeK,PTemp_C,True,0,250,1,0) 'Measure IRTS-P body temperature. TCDiff(SB_C_5,1,mV20C,9,TypeK,PTemp_C,True,0,250,1,0) 'Calculate P, H, & K coefficients. Psb_6=49.9092+(0.59237*SB_C_5)-(0.00558*SB_C_5^2) Hsb_7=4.2828+(0.4248*SB_C_5)-(0.00077*SB_C_5^2) Ksb_8=52.0705-(5.3816*SB_C_5)+(0.387*SB_C_5^2) 'Calculate correction factor. SEC_9=(0.25/Psb_6)*((MastSouthATT-Hsb_7)^2-Ksb_8) 'Calculate corrected target temperature. MastSouthCTT=MastSouthATT-SEC_9 'EndIf 'If(PRG_CNT=3) 'Type K (chromel-alumel) Thermocouple measurements MastNorth: TCDiff(MastNorth,1,mV20C,11,TypeJ,PTemp_C,True,0,250,1,0) 'EndIf 'If(PRG_CNT=4) 'Type K (chromel-alumel) Thermocouple measurements MastEast: TCDiff(MastEast,1,mV20C,12,TypeJ,PTemp_C,True,0,250,1,0) 'EndIf 'If(PRG_CNT=5) 'Type K (chromel-alumel) Thermocouple measurements MastRoof: TCDiff(MastWest,1,mV20C,13,TypeK,PTemp_C,True,0,250,1,0) 'EndIf 'If(PRG_CNT=6) 'Type J (iron-constantan) Thermocouple measurements MastSouth: TCDiff(MastRoof,1,mV20C,14,TypeJ,PTemp_C,True,0,250,1,0) 'EndIf CallTable(Fast) CallTable(Temp) ' PRG_CNT = PRG_CNT + 1 'increase counter for timing ' If(PRG_CNT=20) ' PRG_CNT=0 ' EndIf NextScan EndProg