Class: Honeybee::VentilationFanAbridged

Inherits:
ModelObject show all
Defined in:
lib/honeybee/ventcool/fan.rb,
lib/to_openstudio/ventcool/fan.rb

Instance Attribute Summary

Attributes inherited from ModelObject

#errors, #openstudio_object, #warnings

Instance Method Summary collapse

Methods inherited from ModelObject

#allowable_types, clean_identifier, clean_name, #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

Instance Method Details

#defaultsObject



37
38
39
# File 'lib/honeybee/ventcool/fan.rb', line 37

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

#find_existing_openstudio_object(openstudio_model) ⇒ Object



39
40
41
42
43
# File 'lib/to_openstudio/ventcool/fan.rb', line 39

def find_existing_openstudio_object(openstudio_model)
  model_zone_vent = openstudio_model.getZoneVentilationDesignFlowRateByName(@hash[:identifier])
  return model_zone_vent.get unless model_zone_vent.empty?
  nil
end

#to_openstudio(openstudio_model, parent) ⇒ Object



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
# File 'lib/to_openstudio/ventcool/fan.rb', line 45

def to_openstudio(openstudio_model, parent)
  # create zone ventilation object and set identifier
  os_zone_vent = OpenStudio::Model::ZoneVentilationDesignFlowRate.new(openstudio_model)
  os_zone_vent.setName(@hash[:identifier] + '..' + parent.name.get)
  unless @hash[:display_name].nil?
    os_zone_vent.setDisplayName(@hash[:display_name])
  end

  # assign flow rate
  os_zone_vent.setDesignFlowRate(@hash[:flow_rate])
  os_zone_vent.setFanPressureRise(@hash[:pressure_rise])
  os_zone_vent.setFanTotalEfficiency(@hash[:efficiency])

  # assign the ventilation type if it exists
  if @hash[:ventilation_type]
    os_zone_vent.setVentilationType(@hash[:ventilation_type])
  else
    os_zone_vent.setVentilationType(defaults[:ventilation_type][:default])
  end

  # set all of the ventilation control properties
  vent_control_hash = @hash[:control]
  if vent_control_hash
    # assign min_indoor_temperature
    if vent_control_hash[:min_indoor_temperature]
      os_zone_vent.setMinimumIndoorTemperature(vent_control_hash[:min_indoor_temperature])
    else
      os_zone_vent.setMinimumIndoorTemperature(
        defaults_control[:min_indoor_temperature][:default])
    end
    # assign max_indoor_temperature
    if vent_control_hash[:max_indoor_temperature]
      os_zone_vent.setMaximumIndoorTemperature(vent_control_hash[:max_indoor_temperature])
    else
      os_zone_vent.setMaximumIndoorTemperature(
        defaults_control[:max_indoor_temperature][:default])
    end
    # assign min_outdoor_temperature
    if vent_control_hash[:min_outdoor_temperature]
      os_zone_vent.setMinimumOutdoorTemperature(vent_control_hash[:min_outdoor_temperature])
    else
      os_zone_vent.setMinimumOutdoorTemperature(
        defaults_control[:min_outdoor_temperature][:default])
    end
    # assign max_outdoor_temperature
    if vent_control_hash[:max_outdoor_temperature]
      os_zone_vent.setMaximumOutdoorTemperature(vent_control_hash[:max_outdoor_temperature])
    else
      os_zone_vent.setMaximumOutdoorTemperature(
        defaults_control[:max_outdoor_temperature][:default])
    end
    # assign delta_temperature
    if vent_control_hash[:delta_temperature]
      os_zone_vent.setDeltaTemperature(vent_control_hash[:delta_temperature])
    else
      os_zone_vent.setDeltaTemperature(
        defaults_control[:delta_temperature][:default])
    end
    # assign schedule if it exists
    if vent_control_hash[:schedule]
      vent_sch = openstudio_model.getScheduleByName(vent_control_hash[:schedule])
      unless vent_sch.empty?
        vent_sch_object = vent_sch.get
        os_zone_vent.setOpeningAreaFractionSchedule(vent_sch_object)
      end
    end
  end

  os_zone_vent
end