Class: OpenStudio::Model::ControllerOutdoorAir

Inherits:
Object
  • Object
show all
Defined in:
lib/openstudio-standards/hvac_sizing/Siz.ControllerOutdoorAir.rb

Overview

open the class to add methods to return sizing values

Instance Method Summary collapse

Instance Method Details

#applySizingValuesObject

Takes the values calculated by the EnergyPlus sizing routines and puts them into this object model in place of the autosized fields. Must have previously completed a run with sql output for this to work.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/openstudio-standards/hvac_sizing/Siz.ControllerOutdoorAir.rb', line 14

def applySizingValues

  maximum_outdoor_air_flow_rate = self.autosizedMaximumOutdoorAirFlowRate
  if maximum_outdoor_air_flow_rate.is_initialized
    self.setMaximumOutdoorAirFlowRate(maximum_outdoor_air_flow_rate.get) 
  end

  minimum_outdoor_air_flow_rate = self.autosizedMinimumOutdoorAirFlowRate
  if minimum_outdoor_air_flow_rate.is_initialized
    self.setMinimumOutdoorAirFlowRate(minimum_outdoor_air_flow_rate.get) 
  end
  
end

#autosizeObject

Sets all auto-sizeable fields to autosize



6
7
8
9
# File 'lib/openstudio-standards/hvac_sizing/Siz.ControllerOutdoorAir.rb', line 6

def autosize
  self.autosizeMaximumOutdoorAirFlowRate
  self.autosizeMinimumOutdoorAirFlowRate
end

#autosizedMaximumOutdoorAirFlowRateObject

returns the autosized maximum outdoor air flow rate as an optional double



29
30
31
32
33
# File 'lib/openstudio-standards/hvac_sizing/Siz.ControllerOutdoorAir.rb', line 29

def autosizedMaximumOutdoorAirFlowRate

  return self.model.getAutosizedValue(self, 'Maximum Outdoor Air Flow Rate', 'm3/s')
  
end

#autosizedMinimumOutdoorAirFlowRateObject

TODO:

determine what to do when the airloop has multiple zones

returns the autosized minimum outdoor air flow rate as an optional double EnergyPlus has a “bug” where if the system is a multizone system, the Minimum Outdoor Air Flow Rate reported in the Component Sizing summary does not include zone multipliers. with different multipliers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/openstudio-standards/hvac_sizing/Siz.ControllerOutdoorAir.rb', line 41

def autosizedMinimumOutdoorAirFlowRate

  oa = self.model.getAutosizedValue(self, 'Minimum Outdoor Air Flow Rate', 'm3/s')

  # Get the airloop connected to this controller
  if airLoopHVACOutdoorAirSystem.empty?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Siz.ControllerOutdoorAir', "#{name} is not connected to an airLoopHVACOutdoorAirSystem, cannot determine autosizedMinimumOutdoorAirFlowRate accuractely.")
    return oa
  end
  oa_sys = airLoopHVACOutdoorAirSystem.get
  if oa_sys.airLoop.empty?
    OpenStudio.logFree(OpenStudio::Warn, 'openstudio.Siz.ControllerOutdoorAir', "#{name}'s airLoopHVACOutdoorAirSystem is not assigned to an AirLoop, cannot determine autosizedMinimumOutdoorAirFlowRate accuractely.")
    return oa
  end
  air_loop = oa_sys.airLoop.get

  # Determine if the system is multizone
  multizone = false
  if air_loop.thermalZones.size > 1
    multizone = true
  end

  # Determine if the system is variable volume
  vav = false
  air_loop.supplyComponents.reverse.each do |comp|
    if comp.to_FanVariableVolume.is_initialized
      vav = true
    elsif comp.to_AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.is_initialized
      fan = comp.to_AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.get.supplyAirFan
      if fan.to_FanVariableVolume.is_initialized
        vav = true
      end
    elsif comp.to_AirLoopHVACUnitarySystem.is_initialized
      fan = comp.to_AirLoopHVACUnitarySystem.get.supplyFan
      if fan.is_initialized
        if fan.get.to_FanVariableVolume.is_initialized
          vav = true
        end
      end
    end
  end
  
  # If it is a multizone VAV system, get the system multiplier
  # to work around the bug in EnergyPlus.
  if multizone && vav
    if oa.is_initialized
      oa_val = oa.get
      
      # Get the system multiplier
      mult = 1

      # Get all the zone multipliers
      zn_mults = []
      air_loop.thermalZones.each do |zone|
        zn_mults << zone.multiplier
      end
   
      # Warn if there are different multipliers
      uniq_mults = zn_mults.uniq
      if uniq_mults.size > 1
        OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.AirLoopHVAC', "For #{air_loop.name}: not all zones on the system have an identical zone multiplier.  Multipliers are: #{uniq_mults.join(', ')}.")
      else
        mult = uniq_mults[0]
      end

      oa_val = oa_val * mult
      oa = OpenStudio::OptionalDouble.new(oa_val)
    end
  end

  return oa
end