Class: Honeybee::AirBoundaryConstructionAbridged

Inherits:
ModelObject
  • Object
show all
Defined in:
lib/honeybee/construction/air.rb,
lib/to_openstudio/construction/air.rb,
lib/from_openstudio/construction/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, #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_construction(construction) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/from_openstudio/construction/air.rb', line 38

def self.from_construction(construction)
    # create an empty hash
    hash = {}
    hash[:type] = 'AirBoundaryConstructionAbridged'
    # set hash values from OpenStudio Object
    hash[:identifier] = clean_name(construction.nameString)
    unless construction.displayName.empty?
      hash[:display_name] = (construction.displayName.get).force_encoding("UTF-8")
    end
    # check if boost optional object is empty
    unless construction.simpleMixingSchedule.empty?
      schedule = construction.simpleMixingSchedule.get
      hash[:air_mixing_schedule] = clean_name(schedule.nameString)
    end
    #TODO: Add air_mixing_per_area

    hash
end

Instance Method Details

#defaultsObject



37
38
39
# File 'lib/honeybee/construction/air.rb', line 37

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

#find_existing_openstudio_object(openstudio_model) ⇒ Object



39
40
41
42
43
# File 'lib/to_openstudio/construction/air.rb', line 39

def find_existing_openstudio_object(openstudio_model)
  object = openstudio_model.getConstructionByName(@hash[:identifier])
  return object.get if object.is_initialized
  nil
end

#to_openstudio(openstudio_model) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'lib/to_openstudio/construction/air.rb', line 45

def to_openstudio(openstudio_model)
  os_construction = OpenStudio::Model::ConstructionAirBoundary.new(openstudio_model)
  os_construction.setName(@hash[:identifier])
  os_construction.setAirExchangeMethod('None')
  unless @hash[:display_name].nil?
    os_construction.setDisplayName(@hash[:display_name])
  end

  os_construction
end