Class: Honeybee::InfiltrationAbridged
- Inherits:
-
ModelObject
- Object
- ModelObject
- Honeybee::InfiltrationAbridged
- Defined in:
- lib/honeybee/load/infiltration.rb,
lib/to_openstudio/load/infiltration.rb,
lib/from_openstudio/load/infiltration.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_load(load) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/from_openstudio/load/infiltration.rb', line 38 def self.from_load(load) # create an empty hash hash = {} hash[:type] = 'InfiltrationAbridged' # set hash values from OpenStudio Object hash[:identifier] = clean_name(load.nameString) unless load.displayName.empty? hash[:display_name] = (load.displayName.get).force_encoding("UTF-8") end hash[:flow_per_exterior_area] = load.flowperExteriorSurfaceArea.get unless load.schedule.empty? schedule = load.schedule.get hash[:schedule] = schedule.nameString end hash[:constant_coefficient] = load.constantTermCoefficient hash[:temperature_coefficient] = load.temperatureTermCoefficient hash[:velocity_coefficient] = load.velocityTermCoefficient hash end |
Instance Method Details
#defaults ⇒ Object
37 38 39 |
# File 'lib/honeybee/load/infiltration.rb', line 37 def defaults @@schema[:components][:schemas][:InfiltrationAbridged][:properties] end |
#find_existing_openstudio_object(openstudio_model) ⇒ Object
39 40 41 42 43 |
# File 'lib/to_openstudio/load/infiltration.rb', line 39 def find_existing_openstudio_object(openstudio_model) model_infiltration = openstudio_model.getSpaceInfiltrationDesignFlowRateByName(@hash[:identifier]) return model_infiltration.get unless model_infiltration.empty? 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 80 81 82 83 84 85 |
# File 'lib/to_openstudio/load/infiltration.rb', line 45 def to_openstudio(openstudio_model) # create infiltration OpenStudio object and set identifier os_infilt = OpenStudio::Model::SpaceInfiltrationDesignFlowRate.new(openstudio_model) os_infilt.setName(@hash[:identifier]) unless @hash[:display_name].nil? os_infilt.setDisplayName(@hash[:display_name]) end # assign flow per surface os_infilt.setFlowperExteriorSurfaceArea(@hash[:flow_per_exterior_area]) # assign schedule infiltration_schedule = openstudio_model.getScheduleByName(@hash[:schedule]) unless infiltration_schedule.empty? infiltration_schedule_object = infiltration_schedule.get os_infilt.setSchedule(infiltration_schedule_object) end # assign constant coefficient if it exists if @hash[:constant_coefficient] os_infilt.setConstantTermCoefficient(@hash[:constant_coefficient]) else os_infilt.setConstantTermCoefficient(defaults[:constant_coefficient][:default]) end # assign temperature coefficient if @hash[:temperature_coefficient] os_infilt.setTemperatureTermCoefficient(@hash[:temperature_coefficient]) else os_infilt.setTemperatureTermCoefficient(defaults[:temperature_coefficient][:default]) end # assign velocity coefficient if @hash[:velocity_coefficient] os_infilt.setVelocityTermCoefficient(@hash[:velocity_coefficient]) else os_infilt.setVelocityTermCoefficient(defaults[:velocity_coefficient][:default]) end os_infilt end |