Class: Honeybee::GasEquipmentAbridged
- Inherits:
-
ModelObject
- Object
- ModelObject
- Honeybee::GasEquipmentAbridged
- Defined in:
- lib/honeybee/load/gas_equipment.rb,
lib/to_openstudio/load/gas_equipment.rb,
lib/from_openstudio/load/gas_equipment.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/gas_equipment.rb', line 38 def self.from_load(load) # create an empty hash hash = {} hash[:type] = 'GasEquipmentAbridged' # set hash values from OpenStudio Object hash[:identifier] = clean_name(load.nameString) unless load.schedule.empty? schedule = load.schedule.get hash[:schedule] = schedule.nameString end load_def = load.gasEquipmentDefinition unless load_def.wattsperSpaceFloorArea.empty? hash[:watts_per_area] = load_def.wattsperSpaceFloorArea.get end hash[:radiant_fraction] = load_def.fractionRadiant.to_f hash[:latent_fraction] = load_def.fractionLatent.to_f hash[:lost_fraction] = load_def.fractionLost.to_f hash end |
Instance Method Details
#defaults ⇒ Object
37 38 39 |
# File 'lib/honeybee/load/gas_equipment.rb', line 37 def defaults @@schema[:components][:schemas][:GasEquipmentAbridged][:properties] end |
#find_existing_openstudio_object(openstudio_model) ⇒ Object
38 39 40 41 42 |
# File 'lib/to_openstudio/load/gas_equipment.rb', line 38 def find_existing_openstudio_object(openstudio_model) model_gas_equipment = openstudio_model.getGasEquipmentByName(@hash[:identifier]) return model_gas_equipment.get unless model_gas_equipment.empty? nil end |
#to_openstudio(openstudio_model) ⇒ Object
44 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 86 87 88 89 90 |
# File 'lib/to_openstudio/load/gas_equipment.rb', line 44 def to_openstudio(openstudio_model) # create gas equipment and set identifier os_gas_equip_def = OpenStudio::Model::GasEquipmentDefinition.new(openstudio_model) os_gas_equip = OpenStudio::Model::GasEquipment.new(os_gas_equip_def) os_gas_equip_def.setName(@hash[:identifier]) unless @hash[:display_name].nil? os_gas_equip_def.setDisplayName(@hash[:display_name]) end os_gas_equip.setName(@hash[:identifier]) # assign watts per space floor area os_gas_equip_def.setWattsperSpaceFloorArea(@hash[:watts_per_area]) # assign schedule gas_equipment_schedule = openstudio_model.getScheduleByName(@hash[:schedule]) unless gas_equipment_schedule.empty? gas_equipment_schedule_object = gas_equipment_schedule.get os_gas_equip.setSchedule(gas_equipment_schedule_object) end # ensure that it's always reported under electric equipment os_gas_equip.setEndUseSubcategory('Gas Equipment') # assign radiant fraction if it exists if @hash[:radiant_fraction] os_gas_equip_def.setFractionRadiant(@hash[:radiant_fraction]) else os_gas_equip_def.setFractionRadiant(defaults[:radiant_fraction][:default]) end # assign latent fraction if it exists if @hash[:latent_fraction] os_gas_equip_def.setFractionLatent(@hash[:latent_fraction]) else os_gas_equip_def.setFractionLatent(defaults[:latent_fraction][:default]) end # assign lost fraction if it exists if @hash[:lost_fraction] os_gas_equip_def.setFractionLost(@hash[:lost_fraction]) else os_gas_equip_def.setFractionLost(defaults[:lost_fraction][:default]) end os_gas_equip end |