Class: Honeybee::IdealAirSystemAbridged

Inherits:
ModelObject show all
Defined in:
lib/honeybee/hvac/ideal_air.rb,
lib/to_openstudio/hvac/ideal_air.rb,
lib/from_openstudio/hvac/ideal_air.rb

Instance Attribute Summary

Attributes inherited from ModelObject

#errors, #openstudio_object, #warnings

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ModelObject

#allowable_types, clean_identifier, clean_name, #find_existing_openstudio_object, #initialize, #method_missing, read_from_disk, truncate

Constructor Details

This class inherits a constructor from Honeybee::ModelObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Honeybee::ModelObject

Class Method Details

.from_hvac(hvac) ⇒ Object



38
39
40
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
# File 'lib/from_openstudio/hvac/ideal_air.rb', line 38

def self.from_hvac(hvac)
    # create an empty hash
    hash = {}
    hash[:type] = 'IdealAirSystemAbridged'
    hash[:identifier] = clean_name(hvac.nameString)
    unless hvac.displayName.empty?
        hash[:display_name] = (hvac.displayName.get).force_encoding("UTF-8")
    end
    hash[:economizer_type] = hvac.outdoorAirEconomizerType
    if hvac.demandControlledVentilationType.downcase == 'none'
        hash[:demand_controlled_ventilation] = false
    else
        hash[:demand_controlled_ventilation] = true
    end
    hash[:sensible_heat_recovery] = hvac.sensibleHeatRecoveryEffectiveness
    hash[:latent_heat_recovery] = hvac.latentHeatRecoveryEffectiveness
    hash[:heating_air_temperature] = hvac.maximumHeatingSupplyAirTemperature
    hash[:cooling_air_temperature] = hvac.minimumCoolingSupplyAirTemperature
    unless hvac.isHeatingLimitDefaulted
        if hvac.heatingLimit == 'NoLimit'
            hash[:heating_limit] = {type: 'NoLimit'}
        elsif hvac.heatingLimit == 'LimitCapacity'
            if hvac.isMaximumSensibleHeatingCapacityAutosized
                hash[:heating_limit] = {type: 'Autosize'}
            end
            unless hvac.maximumSensibleHeatingCapacity.empty?
                hash[:heating_limit] = hvac.maximumSensibleHeatingCapacity
            end
        end
    end
    unless hvac.isCoolingLimitDefaulted
        if hvac.coolingLimit == 'NoLimit'
            hash[:cooling_limit] = {type: 'NoLimit'}
        elsif hvac.coolingLimit == 'LimitCapacity'
            if hvac.isMaximumTotalCoolingCapacityAutosized
                hash[:cooling_limit] = {type: 'Autosize'}
            end
            unless hvac.maximumTotalCoolingCapacity.empty?
                hash[:cooling_limit] = hvac.maximumTotalCoolingCapacity
            end
        end
    end
    unless hvac.heatingAvailabilitySchedule.empty?
        schedule = hvac.heatingAvailabilitySchedule.get
        hash[:heating_availability] = schedule.nameString
    end
    unless hvac.coolingAvailabilitySchedule.empty?
        schedule = hvac.coolingAvailabilitySchedule.get
        hash[:cooling_availability] = schedule.nameString
    end
    
    hash
end

Instance Method Details

#defaultsObject



37
38
39
# File 'lib/honeybee/hvac/ideal_air.rb', line 37

def defaults
  @@schema[:components][:schemas][:IdealAirSystemAbridged][:properties]
end

#to_openstudio(openstudio_model) ⇒ Object



39
40
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/to_openstudio/hvac/ideal_air.rb', line 39

def to_openstudio(openstudio_model)
  # create the ideal air system and set the identifier
  os_ideal_air = OpenStudio::Model::ZoneHVACIdealLoadsAirSystem.new(openstudio_model)
  os_ideal_air.setName(@hash[:identifier])
  unless @hash[:display_name].nil?
    os_ideal_air.setDisplayName(@hash[:display_name])
  end
  # use no dehumidification unless there's a humidistat
  os_ideal_air.setDehumidificationControlType('None')

  # assign the economizer type
  if @hash[:economizer_type]
    os_ideal_air.setOutdoorAirEconomizerType(@hash[:economizer_type])
  else
    os_ideal_air.setOutdoorAirEconomizerType(
      defaults[:economizer_type][:default])
  end

  # set the sensible heat recovery
  if @hash[:sensible_heat_recovery] != 0
    os_ideal_air.setSensibleHeatRecoveryEffectiveness(@hash[:sensible_heat_recovery])
    os_ideal_air.setHeatRecoveryType('Sensible')
  else
    os_ideal_air.setSensibleHeatRecoveryEffectiveness(
      defaults[:sensible_heat_recovery][:default])
  end

  # set the latent heat recovery
  if @hash[:latent_heat_recovery] != 0
    os_ideal_air.setLatentHeatRecoveryEffectiveness(@hash[:latent_heat_recovery])
    os_ideal_air.setHeatRecoveryType('Enthalpy')
  else
    os_ideal_air.setLatentHeatRecoveryEffectiveness(
      defaults[:latent_heat_recovery][:default])
  end

  # assign the demand controlled ventilation
  if @hash[:demand_controlled_ventilation]
    os_ideal_air.setDemandControlledVentilationType('OccupancySchedule')
  else
    os_ideal_air.setDemandControlledVentilationType('None')
  end

  # set the maximum heating supply air temperature
  if @hash[:heating_air_temperature]
    os_ideal_air.setMaximumHeatingSupplyAirTemperature(@hash[:heating_air_temperature])
  else
    os_ideal_air.setMaximumHeatingSupplyAirTemperature(
      defaults[:heating_air_temperature][:default])
  end

  # set the maximum cooling supply air temperature
  if @hash[:cooling_air_temperature]
    os_ideal_air.setMinimumCoolingSupplyAirTemperature(@hash[:cooling_air_temperature])
  else
    os_ideal_air.setMinimumCoolingSupplyAirTemperature(
      defaults[:cooling_air_temperature][:default])
  end

  # assign limits to the system's heating capacity
  if @hash[:heating_limit] == {:type => 'NoLimit'}
    os_ideal_air.setHeatingLimit('NoLimit')
  else
    os_ideal_air.setHeatingLimit('LimitCapacity')
    if @hash[:heating_limit].is_a? Numeric
      os_ideal_air.setMaximumSensibleHeatingCapacity(@hash[:heating_limit])
    else
      os_ideal_air.autosizeMaximumSensibleHeatingCapacity()
    end
  end

  # assign limits to the system's cooling capacity
  if @hash[:cooling_limit] == {:type => 'NoLimit'}
    os_ideal_air.setCoolingLimit('NoLimit')
  else
    os_ideal_air.setCoolingLimit('LimitFlowRateAndCapacity')
    if @hash[:cooling_limit].is_a? Numeric
      os_ideal_air.setMaximumTotalCoolingCapacity(@hash[:cooling_limit])
      os_ideal_air.autosizeMaximumCoolingAirFlowRate()
    else
      os_ideal_air.autosizeMaximumTotalCoolingCapacity()
      os_ideal_air.autosizeMaximumCoolingAirFlowRate()
    end
  end

  # assign heating availability schedules
  if @hash[:heating_availability]
    schedule = openstudio_model.getScheduleByName(@hash[:heating_availability])
    unless schedule.empty?
      os_schedule = schedule.get
      os_ideal_air.setHeatingAvailabilitySchedule(os_schedule)
    end
  end

  # assign cooling availability schedules
  if @hash[:cooling_availability]
    schedule = openstudio_model.getScheduleByName(@hash[:cooling_availability])
    unless schedule.empty?
      os_schedule = schedule.get
      os_ideal_air.setCoolingAvailabilitySchedule(os_schedule)
    end
  end

  os_ideal_air
end