Class: Honeybee::EnergyWindowMaterialGas
- Inherits:
-
ModelObject
- Object
- ModelObject
- Honeybee::EnergyWindowMaterialGas
- Defined in:
- lib/honeybee/material/window_gas.rb,
lib/to_openstudio/material/window_gas.rb,
lib/from_openstudio/material/window_gas.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_material(material) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/from_openstudio/material/window_gas.rb', line 38 def self.from_material(material) # create an empty hash hash = {} hash[:type] = 'EnergyWindowMaterialGas' # 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[:thickness] = material.thickness hash[:gas_type] = material.gasType hash end |
Instance Method Details
#defaults ⇒ Object
37 38 39 |
# File 'lib/honeybee/material/window_gas.rb', line 37 def defaults @@schema[:components][:schemas][:EnergyWindowMaterialGas][:properties] end |
#find_existing_openstudio_object(openstudio_model) ⇒ Object
39 40 41 42 43 |
# File 'lib/to_openstudio/material/window_gas.rb', line 39 def find_existing_openstudio_object(openstudio_model) object = openstudio_model.getGasByName(@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 |
# File 'lib/to_openstudio/material/window_gas.rb', line 45 def to_openstudio(openstudio_model) # create window gas OpenStudio object os_window_gas = OpenStudio::Model::Gas.new(openstudio_model) os_window_gas.setName(@hash[:identifier]) unless @hash[:display_name].nil? os_window_gas.setDisplayName(@hash[:display_name]) end # assign thickness if @hash[:thickness] os_window_gas.setThickness(@hash[:thickness]) else os_window_gas.setThickness(defaults[:thickness][:default]) end # assign gas type if @hash[:gas_type] os_window_gas.setGasType(@hash[:gas_type]) else os_window_gas.setGasType(defaults[:gas_type][:default]) end os_window_gas end |