'Program Name BrHEAThe_labdemo 'date 3/12/18 Public LoggerTemp_C, BattVolts_V Public Onicon(12), volt(14), ASHPflow_gpm, boilerflow_gpm Public ElectricalHP(7), ASHPelectric_kWh Public ElectricalHRV(7), ElectricalCOIL(7), ElectricalFAN(7) Public Therm_kOhm(42), Temp_C(42), therm(42) Public setra_V(3),setra_inH2O(3), Airflow_cfm(3) Public Coil_kWh, AHSP_kWh Dim i, J(30), disableCOIL, disableBOILER, disableASHP, disablefan ' For thermistors -- conversion of kOHM to deg C Const a = 0.00114288192250106 Const b = 0.000231314273877631 Const c = 0.00000010934242301857 Const d=-0.0000000000725110851146496 Alias Temp_C (1)=ASHP_defrost_C1 Alias Temp_C (2)=ASHP_defrost_C2 Alias Temp_C (3)=ASHP_defrost_C3 Alias Temp_C (4)=HRV_exhaust_C1 Alias Temp_C (5)=HRV_exhaust_C2 Alias Temp_C (6)=HRV_exhaust_C3 Alias Temp_C (7)=HRV_intake_C1 Alias Temp_C (8)=HRV_intake_C2 Alias Temp_C (9)=HRV_intake_C3 Alias Temp_C (10)=HRV_return_C1 Alias Temp_C (11)=HRV_return_C2 Alias Temp_C (12)=HRV_return_C3 Alias Temp_C (13)=BOXsupply_C1 Alias Temp_C (14)=BOXsupply_C2 Alias Temp_C (15)=BOXsupply_C3 Alias Temp_C (16)=FAN_C1 Alias Temp_C (17)=FAN_C2 Alias Temp_C (18)=FAN_C3 Alias Temp_C (19)=BOX_postfilter_C1 Alias Temp_C (20)=BOX_postfilter_C2 Alias Temp_C (21)=BOX_postfilter_C3 Alias Temp_C (22)=HRVsupply_C1 Alias Temp_C (23)=HRVsupply_C2 Alias Temp_C (24)=HRVsupply_C3 Alias Temp_C (25)=BOX_makeup_C1 Alias Temp_C (26)=BOX_makeup_C2 Alias Temp_C (27)=BOX_makeup_C3 Alias Temp_C (28)=BOX_mix_C1 Alias Temp_C (29)=BOX_mix_C2 Alias Temp_C (30)=BOX_mix_C3 Alias Temp_C (31)=boilersupply_C1 Alias Temp_C (32)=boilersupply_C2 Alias Temp_C (33)=boilersupply_C3 Alias Temp_C (34)=boilerreturn_C1 Alias Temp_C (35)=boilerreturn_C2 Alias Temp_C (36)=boilerreturn_C3 Alias Temp_C (37)=uppertank_C1 Alias Temp_C (38)=uppertank_C2 Alias Temp_C (39)=uppertankair_C Alias Temp_C (40)=lowertank_C1 Alias Temp_C (41)=lowertank_C2 Alias Temp_C (42)=lowertankair_C Alias Onicon(1)=COIL_flowrate_lmin Alias Onicon(2)=COIL_energyrate_kW Alias Onicon(3)=COIL_returntemp_C Alias Onicon(4)=COIL_supplytemp_C Alias Onicon(9)=AHSP_flowrate_lmin Alias Onicon(10)=ASHP_energyrate_kW Alias Onicon(11)=ASHP_cold_C Alias Onicon(12)=ASHP_hot_C Alias ElectricalHP(1)= ASHP_Power_watts Alias ElectricalHP(4)= ASHP_current_amps Alias ElectricalHRV(1)=HRV_power_watts Alias ElectricalCOIL(1)=COIL_pumppower_watts Alias ElectricalFAN(1)=FAN_power_watts Alias Airflow_cfm(1)=FAN_flow_cfm Alias Airflow_cfm(2)=BOXsupply_flow_cfm Alias Airflow_cfm(3)=HRVsupply_flow_cfm 'STATION ID StationName (BrHEAThe_Lab) '\\\\\\\\\\\\\\\\\\\\\\\\ OUTPUT SECTION //////////////////////// DataTable(HourlyRAW, true, -1) DataInterval(0,60,Min,10) Average (1,LoggerTemp_C,FP2,False) Average (1,BattVolts_V,FP2,False) Average (36,therm(),FP2,False) Average (3,setra_V(),FP2,False) Average (14,volt(),FP2,False) EndTable DataTable(Hourly, true, -1) DataInterval(0,60,Min,10) Average (42,Temp_C(),FP2,False) Average (3,Airflow_cfm(),FP2,False) Average (1,Onicon(1),FP2,disableCOIL) Average (1,Onicon(2),FP2,disableCOIL) Average (1,Onicon(3),FP2,disableCOIL) Average (1,Onicon(4),FP2,disableCOIL) Average (1,Onicon(9),FP2,disableASHP) Average (1,Onicon(10),FP2,disableASHP) Average (1,Onicon(11),FP2,disableASHP) Average (1,Onicon(12),FP2,disableASHP) Average (1,ASHPflow_gpm,FP2,disableASHP) Average (1,boilerflow_gpm,FP2,disableBOILER) Average (1,ASHP_Power_watts, FP2, disableASHP) Average (1,HRV_power_watts, FP2, false) Average (1,COIL_pumppower_watts, FP2, disableCOIL) Average (1,FAN_power_watts, FP2, disablefan) EndTable DataTable(minute, true, -1) DataInterval(0,1,Min,10) Average (42,Temp_C(),FP2,False) Average (3,Airflow_cfm(),FP2,False) Average (1,Onicon(1),FP2,disableCOIL) Average (1,Onicon(2),FP2,disableCOIL) Average (1,Onicon(3),FP2,disableCOIL) Average (1,Onicon(4),FP2,disableCOIL) Average (1,Onicon(9),FP2,disableASHP) Average (1,Onicon(10),FP2,disableASHP) Average (1,Onicon(11),FP2,disableASHP) Average (1,Onicon(12),FP2,disableASHP) Average (1,ASHPflow_gpm,FP2,disableASHP) Average (1,boilerflow_gpm,FP2,disableBOILER) Average (1,ASHP_Power_watts, FP2, disableASHP) Average (1,HRV_power_watts, FP2, false) Average (1,COIL_pumppower_watts, FP2, disableCOIL) Average (1,FAN_power_watts, FP2, disablefan) EndTable DataTable(tensecond, true, -1) DataInterval(0,10,Sec,10) Average (42,Temp_C(),FP2,False) Average (3,Airflow_cfm(),FP2,False) Average (1,Onicon(1),FP2,disableCOIL) Average (1,Onicon(2),FP2,disableCOIL) Average (1,Onicon(3),FP2,disableCOIL) Average (1,Onicon(4),FP2,disableCOIL) Average (1,Onicon(9),FP2,disableASHP) Average (1,Onicon(10),FP2,disableASHP) Average (1,Onicon(11),FP2,disableASHP) Average (1,Onicon(12),FP2,disableASHP) Average (1,ASHPflow_gpm,FP2,disableASHP) Average (1,boilerflow_gpm,FP2,disableBOILER) Average (1,ASHP_Power_watts, FP2, disableASHP) Average (1,HRV_power_watts, FP2, false) Average (1,COIL_pumppower_watts, FP2, disableCOIL) Average (1,FAN_power_watts, FP2, disablefan) EndTable '\\\\\\\\\\\\\\\\\\\\\\\\\\\ PROGRAM //////////////////////////// BeginProg Scan(10,Sec,0, 0) Battery(BattVolts_V) PanelTemp(LoggerTemp_C, 250) 'Measure Electricals ACPower (ElectricalHP(),1,60,1,230/333,208,3,30/333,50,1) ACPower (ElectricalHRV(),1,60,2,115/333,115,4,30/333,10,1) ACPower (ElectricalCOIL(),1,60,2,115/333,115,5,30/333,10,1) ACPower (ElectricalFAN(),1,60,2,115/333,115,6,50/333,10,1) 'Measure Air flow VoltSe (setra_V(),3,mV5000,14,1,0,250,.001,0) setra_inH2O()=(0.1*setra_V())-0.25 'for first run assume air density at 68F and 50%RH 0.075lbm/ft3 Airflow_cfm(1)=((setra_inH2O(1)/0.0751)^.5)*1096.7*22/7*(3/12)^2 Airflow_cfm(2)=((setra_inH2O(2)/0.0751)^.5)*1096.7*22/7*(3/12)^2 Airflow_cfm(3)=((setra_inH2O(3)/0.0751)^.5)*1096.7*22/7*(3/12)^2 'measure thermistors PortSet(2,1) i=1 SubScan(0,Sec,14) PulsePort(5,10000) ' Clock mux BrHalf(therm(i),3,mV2500,9,Vx2,2,2500,True,0,_60Hz, 1.0, 0) i=i+3 NextSubScan For i=1 To 42 Therm_kOhm(i) = (10*therm(i))/(1-therm(i)) J(i) = LN (1000*Therm_kOhm(i)) 'ln resistance (ohm) Temp_C(i) = (1/(a + b*J(i) + c*(J(i))^3)+d*(J(i)^4)) - 273.15 'Steinhart & Hart Equation Next i PortSet (2,0) ' turn mux off. 'measure flow meters PortSet (1,1) ' Turn on mux i = 1 SubScan (0,Sec,14) PulsePort(4,10000) ' Clock mux VoltDiff (volt(i),1,AutoRange,4,False,0,_60Hz,1,0) i=i+1 NextSubScan PortSet (1,0) ' turn mux off. 'these need to be corrected once on the Onicons are online Onicon(1)=(0.0237*volt(1)-9.4635) Onicon(2)=(0.055*volt(2)-21.98) Onicon(3)=(0.0382*volt(3)+5.8333) Onicon(4)=(0.0382*volt(4)+5.8333) Onicon(5)=(0.0118*volt(5)-4.7318) Onicon(6)=(0.011*volt(6)-4.3961) Onicon(7)=(0.0556*volt(7)-28.889) Onicon(8)=(0.0556*volt(8)-28.889) Onicon(9)=(0.0118*volt(9)-4.7318) Onicon(10)=(0.011*volt(10)-4.3961) Onicon(11)=(0.0556*volt(11)-28.889) Onicon(12)=(0.0556*volt(12)-28.889) ASHPflow_gpm=(0.0041*volt(13)-1.6135) boilerflow_gpm=(0.0041*volt(14)-1.6135) 'Convert energy rate to total energy Coil_kWh=COIL_energyrate_kW*10/3600000 'BOiLER_kWh=BOILER_energyrate_kW*10/3600000 ASHPelectric_kWh=ASHP_Power_watts*10/3600000/1000 AHSP_kWh=ASHP_energyrate_kW*10/3600000 disableASHP = true If ASHP_Power_watts > .1 Then disableASHP = false disableCOIL = true If COIL_pumppower_watts> .1 Then disableCOIL = false disableBOILER = true If boilerflow_gpm > .1 Then disableBOILER = false disablefan=true If FAN_power_watts>.1 Then disablefan=false 'OUTPUT CallTable HourlyRAW CallTable hourly CallTable minute CallTable tensecond NextScan EndProg