lib/openstudio-standards/hvac_sizing/Siz.HeatingCoolingFuels.rb in openstudio-standards-0.1.4 vs lib/openstudio-standards/hvac_sizing/Siz.HeatingCoolingFuels.rb in openstudio-standards-0.1.5

- old
+ new

@@ -9,10 +9,12 @@ ###### IMPORTANT NOTE ###### class OpenStudio::Model::Model # Get the heating fuel type of a plant loop + # @Todo: If no heating equipment is found, check if there's a heat exchanger, + # or a WaterHeater:Mixed or stratified that is connected to a heating source on the demand side def plant_loop_heating_fuels(plant_loop) fuels = [] # Get the heating fuels for all supply components # on this plant loop. plant_loop.supplyComponents.each do |component| @@ -23,11 +25,11 @@ component = component.to_BoilerHotWater.get fuels << component.fuelType when 'OS_Boiler_Steam' component = component.to_BoilerHotWater.get fuels << component.fuelType - when 'OS_District_Heating' + when 'OS_DistrictHeating' fuels << 'DistrictHeating' when 'OS_HeatPump_WaterToWater_EquationFit_Heating' fuels << 'Electricity' when 'OS_SolarCollector_FlatPlate_PhotovoltaicThermal' fuels << 'SolarEnergy' @@ -36,13 +38,41 @@ when 'OS_SolarCollector_IntegralCollectorStorage' fuels << 'SolarEnergy' when 'OS_WaterHeater_HeatPump' fuels << 'Electricity' when 'OS_WaterHeater_Mixed' - fuels << 'obj.fuelType' + component = component.to_WaterHeaterMixed.get + + # Check if the heater actually has a capacity (otherwise it's simply a Storage Tank) + if component.heaterMaximumCapacity.empty? || component.heaterMaximumCapacity.get != 0 + # If it does, we add the heater Fuel Type + fuels << component.heaterFuelType + end # @Todo: not sure about whether it should be an elsif or not + # Check the plant loop connection on the source side + if component.secondaryPlantLoop.is_initialized + fuels += self.plant_loop_heating_fuels(component.secondaryPlantLoop.get) + end when 'OS_WaterHeater_Stratified' - fuels << 'obj.fuelType' + component = component.to_WaterHeaterStratified.get + + # Check if the heater actually has a capacity (otherwise it's simply a Storage Tank) + if component.heaterMaximumCapacity.empty? || component.heaterMaximumCapacity.get != 0 + # If it does, we add the heater Fuel Type + fuels << component.heaterFuelType + end # @Todo: not sure about whether it should be an elsif or not + # Check the plant loop connection on the source side + if component.secondaryPlantLoop.is_initialized + fuels += self.plant_loop_heating_fuels(component.secondaryPlantLoop.get) + end + + when 'OS_HeatExchanger_FluidToFluid' + hx = component.to_HeatExchangerFluidToFluid.get + cooling_hx_control_types = ["CoolingSetpointModulated", "CoolingSetpointOnOff", "CoolingDifferentialOnOff", "CoolingSetpointOnOffWithComponentOverride"] + cooling_hx_control_types.each {|x| x.downcase!} + if !cooling_hx_control_types.include?(hx.controlType.downcase) && hx.secondaryPlantLoop.is_initialized + fuels += self.plant_loop_heating_fuels(hx.secondaryPlantLoop.get) + end when 'OS_Node', 'OS_Pump_ConstantSpeed', 'OS_Pump_VariableSpeed', 'OS_Connector_Splitter', 'OS_Connector_Mixer', 'OS_Pipe_Adiabatic' # To avoid extraneous debug messages else #OpenStudio::logFree(OpenStudio::Debug, 'openstudio.sizing.Model', "No heating fuel types found for #{obj_type}") end @@ -125,17 +155,25 @@ if heating_coil.plantLoop.is_initialized fuels += self.plant_loop_heating_fuels(heating_coil.plantLoop.get) end when 'OS_Coil_Heating_Water_BaseboardRadiant' heating_coil = heating_coil.to_CoilHeatingWaterBaseboardRadiant.get - if heating_coil.plantLoop.is_initialized + if heating_coil.plantLoop.is_initialized fuels += self.plant_loop_heating_fuels(heating_coil.plantLoop.get) end when 'OS_Coil_Heating_WaterToAirHeatPump_EquationFit' fuels << 'Electricity' + heating_coil = heating_coil.to_CoilHeatingWaterToAirHeatPumpEquationFit.get + if heating_coil.plantLoop.is_initialized + fuels += self.plant_loop_heating_fuels(heating_coil.plantLoop.get) + end when 'OS_Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFit' fuels << 'Electricity' + heating_coil = heating_coil.to_CoilHeatingWaterToAirHeatPumpVariableSpeedEquationFit.get + if heating_coil.plantLoop.is_initialized + fuels += self.plant_loop_heating_fuels(heating_coil.plantLoop.get) + end when 'OS_Coil_WaterHeating_AirToWaterHeatPump' fuels << 'Electricity' when 'OS_Coil_WaterHeating_Desuperheater' fuels << 'Electricity' else @@ -267,18 +305,19 @@ fuels << 'DistrictHeating' when 'OS_ZoneHVAC_LowTemperatureRadiant_Electric' fuels << 'Electricity' when 'OS_ZoneHVAC_PackagedTerminalAirConditioner' equipment = equipment.to_ZoneHVACPackagedTerminalAirConditioner.get - fuel_coil = self.coil_heating_fuels(equipment.heatingCoil) fuels += self.coil_heating_fuels(equipment.heatingCoil) when 'OS_ZoneHVAC_PackagedTerminalHeatPump' fuels << 'Electricity' when 'OS_ZoneHVAC_TerminalUnit_VariableRefrigerantFlow' fuels << 'Electricity' when 'OS_ZoneHVAC_WaterToAirHeatPump' - fuels << 'Electricity' + # We also go check what fuel serves the loop on which the WSHP heating coil is + equipment = equipment.to_ZoneHVACWaterToAirHeatPump.get + fuels += self.coil_heating_fuels(equipment.heatingCoil) else #OpenStudio::logFree(OpenStudio::Debug, 'openstudio.sizing.Model', "No heating fuel types found for #{obj_type}") end end @@ -292,17 +331,20 @@ # Get the cooling fuels for all zone HVAC equipment zone.equipment.each do |equipment| # Get the object type obj_type = equipment.iddObjectType.valueName.to_s case obj_type - when 'to_AirTerminal_SingleDuct_ConstantVolume_CooledBeam' + when 'OS_AirTerminal_SingleDuct_ConstantVolume_CooledBeam' equipment = equipment.to_AirTerminalSingleDuctConstantVolumeCooledBeam.get fuels += self.coil_cooling_fuels(equipment.coilCoolingCooledBeam) - when 'to_AirTerminal_SingleDuct_ConstantVolume_FourPipeInduction' + when 'OS_AirTerminal_SingleDuct_ConstantVolume_FourPipeInduction' equipment = equipment.to_AirTerminalSingleDuctConstantVolumeFourPipeInduction.get if equipment.coolingCoil.is_initialized - fuels += self.coil_heating_fuels(equipment.coolingCoil.get) + fuels += self.coil_cooling_fuels(equipment.coolingCoil.get) end + when 'OS_ZoneHVAC_FourPipeFanCoil' + equipment = equipment.to_ZoneHVACFourPipeFanCoil.get + fuels += self.coil_cooling_fuels(equipment.coolingCoil) when 'OS_Refrigeration_AirChiller' fuels << 'Electricity' when 'OS_ZoneHVAC_IdealLoadsAirSystem' fuels << 'DistrictCooling' when 'OS_ZoneHVAC_PackagedTerminalAirConditioner'