lib/from_openstudio/geometry/room.rb in honeybee-openstudio-2.31.2 vs lib/from_openstudio/geometry/room.rb in honeybee-openstudio-2.31.4

- old
+ new

@@ -83,11 +83,12 @@ end unless space.spaceType.empty? space_type = space.spaceType.get hash[:program_type] = space_type.nameString end - # TODO: These are loads assigned to the space directly. How should duplicates created in programtype, if any, be handled? + # TODO: These are only loads assigned to the space directly. + # Duplicates and other definitions created in programtype should be summed unless space.people.empty? space.people.each do |people| people_def = people.peopleDefinition # Only translate if people per floor area is specified # Check if schedule exists and is of the correct type @@ -98,10 +99,11 @@ break end end end end + unless space.lights.empty? space.lights.each do |light| light_def = light.lightsDefinition # Only translate if watts per floor area is specified # Check if schedule exists and is of the correct type @@ -112,10 +114,11 @@ break end end end end + unless space.electricEquipment.empty? space.electricEquipment.each do |electric_eq| electric_eq_def = electric_eq.electricEquipmentDefinition # Only translate if watts per floor area is specified # Check if schedule exists and is of the correct type @@ -126,10 +129,11 @@ break end end end end + unless space.gasEquipment.empty? space.gasEquipment.each do |gas_eq| gas_eq_def = gas_eq.gasEquipmentDefinition # Only translate if watts per floor area is specified # Check if schedule exists and is of the correct type @@ -140,22 +144,11 @@ break end end end end - unless space.otherEquipment.empty? - hash[:process_loads] = [] - space.otherEquipment.each do |other_eq| - other_eq_def = other_eq.otherEquipmentDefinition - if !other_eq_def.designLevel.empty? && !other_eq.schedule.empty? - sch = other_eq.schedule.get - if sch.to_ScheduleRuleset.is_initialized or sch.to_ScheduleFixedInterval.is_initialized - hash[:process_loads] << Honeybee::ProcessAbridged.from_load(other_eq) - end - end - end - end + unless space.spaceInfiltrationDesignFlowRates.empty? space.spaceInfiltrationDesignFlowRates.each do |infiltration| # Only translate if flow per exterior area is specified # Check if schedule exists and is of the correct type if !infiltration.flowperExteriorSurfaceArea.empty? && !infiltration.schedule.empty? @@ -165,20 +158,44 @@ break end end end end + + unless space.waterUseEquipment.empty? + space.waterUseEquipment.each do |shw_equipment| + # Check if schedule exists and is of the correct type + unless shw_equipment.flowRateFractionSchedule.empty? + sch = shw_equipment.flowRateFractionSchedule.get + if sch.to_ScheduleRuleset.is_initialized or sch.to_ScheduleFixedInterval.is_initialized + floor_area = space.floorArea # Get floor area + hash[:service_hot_water] = Honeybee::ServiceHotWaterAbridged.from_load(shw_equipment, floor_area) + end + end + end + end + unless space.designSpecificationOutdoorAir.empty? hash[:ventilation] = Honeybee::VentilationAbridged.from_load(space.designSpecificationOutdoorAir.get) end + + unless space.otherEquipment.empty? + hash[:process_loads] = [] + space.otherEquipment.each do |other_eq| + other_eq_def = other_eq.otherEquipmentDefinition + if !other_eq_def.designLevel.empty? && !other_eq.schedule.empty? + sch = other_eq.schedule.get + if sch.to_ScheduleRuleset.is_initialized or sch.to_ScheduleFixedInterval.is_initialized + hash[:process_loads] << Honeybee::ProcessAbridged.from_load(other_eq) + end + end + end + end + unless space.daylightingControls.empty? hash[:daylighting_control] = Honeybee::DaylightingControl.from_load(space.daylightingControls[0]) end - unless space.waterUseEquipment.empty? - # Get floor area - floor_area = space.floorArea - hash[:service_hot_water] = Honeybee::ServiceHotWaterAbridged.from_load(space.waterUseEquipment[0], floor_area) - end + thermal_zone = space.thermalZone unless thermal_zone.empty? thermal_zone = space.thermalZone.get unless thermal_zone.thermostatSetpointDualSetpoint.empty? hash[:setpoint] = {}