Class: Honeybee::EnergyWindowMaterialSimpleGlazSys

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



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

def self.from_material(material)
    # create an empty hash
    hash = {}
    hash[:type] = 'EnergyWindowMaterialSimpleGlazSys'
    # set hash values from OpenStudio Object
    hash[:identifier] = clean_name(material.nameString)
    unless material.displayName.empty?
      hash[:display_name] = (material.displayName.get).force_encoding("UTF-8")
    end
    hash[:u_factor] = material.uFactor
    hash[:shgc] = material.solarHeatGainCoefficient
    # check if boost optional object is empty
    unless material.visibleTransmittance.empty?
      hash[:vt] = material.visibleTransmittance.get
    end

    hash
end

Instance Method Details

#defaultsObject



37
38
39
# File 'lib/honeybee/material/window_simpleglazsys.rb', line 37

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

#find_existing_openstudio_object(openstudio_model) ⇒ Object



39
40
41
42
43
# File 'lib/to_openstudio/material/window_simpleglazsys.rb', line 39

def find_existing_openstudio_object(openstudio_model)
  object = openstudio_model.getSimpleGlazingByName(@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
55
56
57
58
59
60
61
62
# File 'lib/to_openstudio/material/window_simpleglazsys.rb', line 45

def to_openstudio(openstudio_model)
  #  create simple glazing openstudio object
  os_simple_glazing = OpenStudio::Model::SimpleGlazing.new(openstudio_model)
  os_simple_glazing.setName(@hash[:identifier])
  os_simple_glazing.setUFactor(@hash[:u_factor])
  os_simple_glazing.setSolarHeatGainCoefficient(@hash[:shgc])
  unless @hash[:display_name].nil?
    os_simple_glazing.setDisplayName(@hash[:display_name])
  end
  # assign visible transmittance
  if @hash[:vt]
    os_simple_glazing.setVisibleTransmittance(@hash[:vt])
  else
    os_simple_glazing.setVisibleTransmittance(defaults[:vt][:default])
  end

  os_simple_glazing
end