Class: Honeybee::WindowConstructionAbridged
- Inherits:
-
ModelObject
- Object
- ModelObject
- Honeybee::WindowConstructionAbridged
- Defined in:
- lib/honeybee/construction/window.rb,
lib/to_openstudio/construction/window.rb,
lib/from_openstudio/construction/window.rb
Instance Attribute Summary
Attributes inherited from ModelObject
#errors, #openstudio_object, #warnings
Class Method Summary collapse
Instance Method Summary collapse
- #defaults ⇒ Object
- #find_existing_openstudio_object(openstudio_model) ⇒ Object
- #to_openstudio(openstudio_model) ⇒ Object
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 56 |
# File 'lib/from_openstudio/construction/window.rb', line 38 def self.from_construction(construction) # create an empty hash hash = {} hash[:type] = 'WindowConstructionAbridged' # 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 hash[:materials] = [] # get construction layers layers = construction.layers layers.each do |layer| name = clean_name(layer.nameString) hash[:materials] << name end hash end |
Instance Method Details
#defaults ⇒ Object
37 38 39 |
# File 'lib/honeybee/construction/window.rb', line 37 def defaults @@schema[:components][:schemas][:WindowConstructionAbridged][:properties] end |
#find_existing_openstudio_object(openstudio_model) ⇒ Object
41 42 43 44 45 |
# File 'lib/honeybee/construction/window.rb', line 41 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 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 |
# File 'lib/to_openstudio/construction/window.rb', line 45 def to_openstudio(openstudio_model) # create construction and set identifier os_construction = OpenStudio::Model::Construction.new(openstudio_model) os_construction.setName(@hash[:identifier]) unless @hash[:display_name].nil? os_construction.setDisplayName(@hash[:display_name]) end # create material vector os_materials = OpenStudio::Model::MaterialVector.new # loop through each layer and add to material vector if $simple_window_cons && @hash[:u_factor] os_simple_glazing = OpenStudio::Model::SimpleGlazing.new(openstudio_model) os_simple_glazing.setName(@hash[:identifier] + '_SimpleGlazSys') os_simple_glazing.setUFactor(@hash[:u_factor]) os_simple_glazing.setSolarHeatGainCoefficient(@hash[:shgc]) os_simple_glazing.setVisibleTransmittance(@hash[:vt]) os_materials << os_simple_glazing else if @hash.key?(:layers) mat_key = :layers else mat_key = :materials end @hash[mat_key].each do |material_identifier| material = openstudio_model.getMaterialByName(material_identifier) unless material.empty? os_material = material.get os_materials << os_material end end end os_construction.setLayers(os_materials) os_construction end |