lib/to_openstudio/model.rb in honeybee-openstudio-2.9.2 vs lib/to_openstudio/model.rb in honeybee-openstudio-2.10.0
- old
+ new
@@ -84,12 +84,14 @@
# initialize global hashes for various model properties
$gas_gap_hash = Hash.new # hash to track gas gaps in case they are split by shades
$air_boundary_hash = Hash.new # hash to track any air boundary constructions
$window_shade_hash = Hash.new # hash to track any window constructions with shade
+ $programtype_shw_hash = Hash.new # hash to track ServiceHotWater objects
$programtype_setpoint_hash = Hash.new # hash to track Setpoint objects
$interior_afn_srf_hash = Hash.new # track whether an adjacent surface is already in the AFN
+ $shw_for_plant = nil # track whether a hot water plant is needed
# create all of the non-geometric model elements
if log_report # schedules are used by all other objects and come first
puts 'Translating Schedules'
end
@@ -149,10 +151,11 @@
if log_report
puts 'Translating HVAC Systems'
end
create_hvacs
+ create_hot_water_plant
if log_report
puts 'Translating Context Shade Geometry'
end
create_orphaned_shades
@@ -359,18 +362,29 @@
@hash[:rooms].each do |room|
room_object = Room.new(room)
openstudio_room = room_object.to_openstudio(@openstudio_model)
+ # for rooms with hot water objects definied in the ProgramType, make a new WaterUse:Equipment
+ if room[:properties][:energy][:program_type] && !room[:properties][:energy][:service_hot_water]
+ program_type_id = room[:properties][:energy][:program_type]
+ shw_hash = $programtype_shw_hash[program_type_id]
+ unless shw_hash.nil?
+ shw_object = ServiceHotWaterAbridged.new(shw_hash)
+ openstudio_shw = shw_object.to_openstudio(@openstudio_model, openstudio_room)
+ $shw_for_plant = shw_object
+ end
+ end
+
# for rooms with setpoint objects definied in the ProgramType, make a new thermostat
if room[:properties][:energy][:program_type] && !room[:properties][:energy][:setpoint]
thermal_zone = openstudio_room.thermalZone()
unless thermal_zone.empty?
thermal_zone_object = thermal_zone.get
program_type_id = room[:properties][:energy][:program_type]
setpoint_hash = $programtype_setpoint_hash[program_type_id]
- if not setpoint_hash.nil? # program type has no setpoint
+ unless setpoint_hash.nil? # program type has no setpoint
thermostat_object = SetpointThermostat.new(setpoint_hash)
openstudio_thermostat = thermostat_object.to_openstudio(@openstudio_model)
thermal_zone_object.setThermostatSetpointDualSetpoint(openstudio_thermostat)
if setpoint_hash[:humidifying_schedule] or setpoint_hash[:dehumidifying_schedule]
humidistat_object = ZoneControlHumidistat.new(setpoint_hash)
@@ -462,9 +476,16 @@
elsif TemplateHVAC.types.include?(system_type)
template_system = TemplateHVAC.new(hvac)
os_template_system = template_system.to_openstudio(@openstudio_model, hvac['rooms'])
end
end
+ end
+ end
+
+ def create_hot_water_plant
+ # create a hot water plant if there's any service hot water in the model
+ unless $shw_for_plant.nil?
+ $shw_for_plant.add_district_hot_water_plant(@openstudio_model)
end
end
def create_orphaned_shades
if @hash[:orphaned_shades]