Class: BuildingSync::HVACSystem
- Inherits:
-
BuildingSystem
- Object
- BuildingSystem
- BuildingSync::HVACSystem
- Defined in:
- lib/buildingsync/model_articulation/hvac_system.rb
Overview
HVACSystem class
Instance Attribute Summary collapse
-
#principal_hvac_system_type ⇒ Object
readonly
principal hvac system type.
Instance Method Summary collapse
-
#add_exhaust(model, standard, kitchen_makeup, remove_objects) ⇒ Object
add exhaust.
-
#add_hvac(model, zone_hash, standard, system_type, hvac_delivery_type = 'Forced Air', htg_src = 'NaturalGas', clg_src = 'Electricity', remove_objects = false) ⇒ Boolean
add hvac.
-
#add_setpoints_to_thermostats_if_none(model) ⇒ Boolean
True if ALL thermostats have heating and cooling setpoints.
-
#add_thermostats(model, standard, remove_objects) ⇒ Object
add thermostats.
-
#apply_sizing_and_assumptions(model, output_path, standard, primary_bldg_type, system_type, climate_zone) ⇒ Boolean
apply sizing and assumptions.
-
#create_schedule_ruleset(model, values, name) ⇒ OpenStudio::Model::ScheduleRuleset
A new schedule ruleset with values added to the default day.
- #get_linked_ids ⇒ Object
-
#get_principal_hvac_system_type ⇒ String
get principal hvac system type.
-
#get_system_type_from_zone(zone_hash, zones, system_type) ⇒ String
get system type from zone.
-
#initialize(base_xml, ns = 'auc') ⇒ HVACSystem
constructor
initialize.
-
#map_to_cbecs(principal_hvac_system_type, fallback_system_type) ⇒ String
map principal hvac system type to cbecs system type.
-
#read_xml ⇒ Object
read xml.
-
#set_principal_hvac_system_type(principal_hvac_type) ⇒ Object
adding the principal hvac system type to the hvac systems, overwrite existing values or create new elements if none are present.
Methods included from XmlGetSet
#get_prefix, #xget_attribute_for_element, #xget_element, #xget_id, #xget_idrefs, #xget_linked_premises, #xget_name, #xget_or_create, #xget_plurals_text_value, #xget_text, #xget_text_as_bool, #xget_text_as_date, #xget_text_as_dt, #xget_text_as_float, #xget_text_as_integer, #xset_or_create, #xset_text
Methods included from Helper
#help_calculate_hours, #help_convert, #help_count_number_of_days, #help_element_class_type_check, #help_get_attribute_value, #help_get_default_schedule_set, #help_get_duration, #help_get_end_time, #help_get_end_time_sat, #help_get_end_time_sun, #help_get_end_time_weekday, #help_get_or_create, #help_get_schedule_rule_set_from_schedule, #help_get_start_time, #help_get_start_time_sat, #help_get_start_time_sun, #help_get_start_time_weekday, #help_get_text_value, #help_get_text_value_as_bool, #help_get_text_value_as_date, #help_get_text_value_as_datetime, #help_get_text_value_as_float, #help_get_text_value_as_integer, #help_get_zone_name_list, #help_load_doc, #help_print_all_schedules, #help_print_schedule, #help_write_profile
Constructor Details
#initialize(base_xml, ns = 'auc') ⇒ HVACSystem
initialize
50 51 52 53 54 55 56 57 58 |
# File 'lib/buildingsync/model_articulation/hvac_system.rb', line 50 def initialize(base_xml, ns = 'auc') @base_xml = base_xml @ns = ns help_element_class_type_check(base_xml, 'HVACSystem') # code to initialize read_xml end |
Instance Attribute Details
#principal_hvac_system_type ⇒ Object (readonly)
principal hvac system type
393 394 395 |
# File 'lib/buildingsync/model_articulation/hvac_system.rb', line 393 def principal_hvac_system_type @principal_hvac_system_type end |
Instance Method Details
#add_exhaust(model, standard, kitchen_makeup, remove_objects) ⇒ Object
add exhaust
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/buildingsync/model_articulation/hvac_system.rb', line 83 def add_exhaust(model, standard, kitchen_makeup, remove_objects) # remove exhaust objects if remove_objects model.getFanZoneExhausts.each(&:remove) end zone_exhaust_fans = standard.model_add_exhaust(model, kitchen_makeup) # second argument is strategy for finding makeup zones for exhaust zones zone_exhaust_fans.each do |k, v| max_flow_rate_ip = OpenStudio.convert(k.maximumFlowRate.get, 'm^3/s', 'cfm').get if v.key?(:zone_mixing) zone_mixing = v[:zone_mixing] mixing_source_zone_name = zone_mixing.sourceZone.get.name mixing_design_flow_rate_ip = OpenStudio.convert(zone_mixing.designFlowRate.get, 'm^3/s', 'cfm').get OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.HVACSystem.add_exhaust', "Adding #{OpenStudio.toNeatString(max_flow_rate_ip, 0, true)} (cfm) of exhaust to #{k.thermalZone.get.name}, with #{OpenStudio.toNeatString(mixing_design_flow_rate_ip, 0, true)} (cfm) of makeup air from #{mixing_source_zone_name}") else OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.HVACSystem.add_exhaust', "Adding #{OpenStudio.toNeatString(max_flow_rate_ip, 0, true)} (cfm) of exhaust to #{k.thermalZone.get.name}") end end return true end |
#add_hvac(model, zone_hash, standard, system_type, hvac_delivery_type = 'Forced Air', htg_src = 'NaturalGas', clg_src = 'Electricity', remove_objects = false) ⇒ Boolean
add hvac
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/buildingsync/model_articulation/hvac_system.rb', line 256 def add_hvac(model, zone_hash, standard, system_type, hvac_delivery_type = 'Forced Air', htg_src = 'NaturalGas', clg_src = 'Electricity', remove_objects = false) # remove HVAC objects if remove_objects standard.model_remove_prm_hvac(model) end puts "HVAC System ID: #{xget_id}. System_type derived from standards: #{system_type} and principal hvac system type override is: #{get_principal_hvac_system_type}" temp = get_principal_hvac_system_type if !temp.nil? && !temp.empty? previous_system_type = system_type system_type = map_to_cbecs(get_principal_hvac_system_type, previous_system_type) OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.HVACSystem.add_hvac', "HVAC System ID: #{xget_id}. System type derived from standards: #{previous_system_type}, overriden to #{system_type}") end case system_type when 'Inferred' # Get the hvac delivery type enum hvac_delivery = case hvac_delivery_type when 'Forced Air' 'air' when 'Hydronic' 'hydronic' end # Group the zones by occupancy type. Only split out # non-dominant groups if their total area exceeds the limit. sys_groups = standard.model_group_zones_by_type(model, OpenStudio.convert(20_000, 'ft^2', 'm^2').get) # For each group, infer the HVAC system type. sys_groups.each do |sys_group| # Infer the principal system type # OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.Facility.create_building_system', "template = #{template}, climate_zone = #{climate_zone}, occ_type = #{sys_group['type']}, hvac_delivery = #{hvac_delivery}, htg_src = #{htg_src}, clg_src = #{clg_src}, area_ft2 = #{sys_group['area_ft2']}, num_stories = #{sys_group['stories']}") sys_type, central_htg_fuel, zone_htg_fuel, clg_fuel = standard.model_typical_hvac_system_type(model, climate_zone, sys_group['type'], hvac_delivery, htg_src, clg_src, OpenStudio.convert(sys_group['area_ft2'], 'ft^2', 'm^2').get, sys_group['stories']) # Infer the secondary system type for multizone systems sec_sys_type = case sys_type when 'PVAV Reheat', 'VAV Reheat' 'PSZ-AC' when 'PVAV PFP Boxes', 'VAV PFP Boxes' 'PSZ-HP' else sys_type # same as primary system type end # Group zones by story story_zone_lists = standard.model_group_zones_by_story(model, sys_group['zones']) # On each story, add the primary system to the primary zones # and add the secondary system to any zones that are different. story_zone_lists.each do |story_group| # Differentiate primary and secondary zones, based on # operating hours and internal loads (same as 90.1 PRM) pri_sec_zone_lists = standard.model_differentiate_primary_secondary_thermal_zones(model, story_group) # Add the primary system to the primary zones standard.model_add_hvac_system(model, sys_type, central_htg_fuel, zone_htg_fuel, clg_fuel, pri_sec_zone_lists['primary']) # Add the secondary system to the secondary zones (if any) if !pri_sec_zone_lists['secondary'].empty? standard.model_add_hvac_system(model, sec_sys_type, central_htg_fuel, zone_htg_fuel, clg_fuel, pri_sec_zone_lists['secondary']) end end end else # Group the zones by story story_groups = standard.model_group_zones_by_story(model, model.getThermalZones) # Add the user specified HVAC system for each story. # Single-zone systems will get one per zone. story_groups.each do |zones| new_system_type = get_system_type_from_zone(zone_hash, zones, system_type) puts "setting system: #{new_system_type} for zone names: #{help_get_zone_name_list(zones)}" model.add_cbecs_hvac_system(standard, new_system_type, zones) end end return true end |
#add_setpoints_to_thermostats_if_none(model) ⇒ Boolean
Returns true if ALL thermostats have heating and cooling setpoints.
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/buildingsync/model_articulation/hvac_system.rb', line 146 def add_setpoints_to_thermostats_if_none(model) successful = true # seperate out thermostats that need heating vs. cooling schedules tstats_cooling = [] tstats_heating = [] model.getThermalZones.each do |tz| if tz.thermostatSetpointDualSetpoint.is_initialized tstat = tz.thermostatSetpointDualSetpoint.get tstats_cooling << tstat if !tstat.coolingSetpointTemperatureSchedule.is_initialized tstats_heating << tstat if !tstat.heatingSetpointTemperatureSchedule.is_initialized end end puts "BuildingSync.HVACSystem.add_setpoints_to_thermostats_if_none - (#{tstats_cooling.size}) thermostats needing cooling schedule" puts "BuildingSync.HVACSystem.add_setpoints_to_thermostats_if_none - (#{tstats_heating.size}) thermostats needing heating schedule" htg_setpoints = [ # [Time.new(days, hours, mins seconds), temp_value_celsius] [OpenStudio::Time.new(0, 9, 0, 0), 17], [OpenStudio::Time.new(0, 17, 0, 0), 20], [OpenStudio::Time.new(0, 24, 0, 0), 17] ] clg_setpoints = [ # [Time.new(days, hours, mins seconds), temp_value_celsius] [OpenStudio::Time.new(0, 9, 0, 0), 23], [OpenStudio::Time.new(0, 17, 0, 0), 20], [OpenStudio::Time.new(0, 24, 0, 0), 23] ] heating_sp_schedule = create_schedule_ruleset(model, htg_setpoints, 'Thermostat Heating SP') cooling_sp_schedule = create_schedule_ruleset(model, clg_setpoints, 'Thermostat Cooling SP') tstats_cooling.each do |thermostat| success = thermostat.setCoolingSetpointTemperatureSchedule(cooling_sp_schedule) if success OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.HVACSystem.add_setpoints_to_thermostats_if_none', "Cooling Schedule (#{cooling_sp_schedule.nameString}) added to Thermostat: #{thermostat.nameString}") puts "BuildingSync.HVACSystem.add_setpoints_to_thermostats_if_none - Cooling Schedule (#{cooling_sp_schedule.nameString}) added to Thermostat: #{thermostat.nameString}" else successful = false OpenStudio.logFree(OpenStudio::Warn, 'BuildingSync.HVACSystem.add_setpoints_to_thermostats_if_none', "No Cooling Schedule for Thermostat: #{thermostat.nameString}") puts "BuildingSync.HVACSystem.add_setpoints_to_thermostats_if_none - No Cooling Schedule for Thermostat: #{thermostat.nameString}" end end tstats_heating.each do |thermostat| success = thermostat.setHeatingSetpointTemperatureSchedule(heating_sp_schedule) if success OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.HVACSystem.add_setpoints_to_thermostats_if_none', "Heating Schedule (#{heating_sp_schedule.nameString}) added to Thermostat: #{thermostat.nameString}") puts "BuildingSync.HVACSystem.add_setpoints_to_thermostats_if_none - Heating Schedule (#{heating_sp_schedule.nameString}) added to Thermostat: #{thermostat.nameString}" else successful = false OpenStudio.logFree(OpenStudio::Warn, 'BuildingSync.HVACSystem.add_setpoints_to_thermostats_if_none', "No Heating Schedule for Thermostat: #{thermostat.nameString}") puts "BuildingSync.HVACSystem.add_setpoints_to_thermostats_if_none - No Heating Schedule for Thermostat: #{thermostat.nameString}" end end return successful end |
#add_thermostats(model, standard, remove_objects) ⇒ Object
add thermostats
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/buildingsync/model_articulation/hvac_system.rb', line 108 def add_thermostats(model, standard, remove_objects) # remove thermostats if remove_objects model.getThermostatSetpointDualSetpoints.each(&:remove) end model.getSpaceTypes.each do |space_type| # create thermostat schedules # apply internal load schedules # the last bool test it to make thermostat schedules. They are added to the model but not assigned standard.space_type_apply_internal_load_schedules(space_type, false, false, false, false, false, false, true) # identify thermal thermostat and apply to zones (apply_internal_load_schedules names ) model.getThermostatSetpointDualSetpoints.each do |thermostat| next if !thermostat.name.to_s.include?(space_type.name.to_s) if !thermostat.coolingSetpointTemperatureSchedule.is_initialized OpenStudio.logFree(OpenStudio::Warn, 'BuildingSync.HVACSystem.add_thermostats', "#{thermostat.name} has no cooling setpoint.") end if !thermostat.heatingSetpointTemperatureSchedule.is_initialized OpenStudio.logFree(OpenStudio::Warn, 'BuildingSync.HVACSystem.add_thermostats', "#{thermostat.name} has no heating setpoint.") end OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.HVACSystem.add_thermostats', "Assigning #{thermostat.name} to thermal zones with #{space_type.name} assigned.") puts "BuildingSync.HVACSystem.add_thermostats - Assigning #{thermostat.name} to thermal zones with #{space_type.name} assigned." space_type.spaces.each do |space| next if !space.thermalZone.is_initialized space.thermalZone.get.setThermostatSetpointDualSetpoint(thermostat) end end end puts "ThermalZones: #{model.getThermalZones.size}" puts "ThermostatDSPs: #{model.getThermostatSetpointDualSetpoints.size}" add_setpoints_to_thermostats_if_none(model) return true end |
#apply_sizing_and_assumptions(model, output_path, standard, primary_bldg_type, system_type, climate_zone) ⇒ Boolean
apply sizing and assumptions
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
# File 'lib/buildingsync/model_articulation/hvac_system.rb', line 365 def apply_sizing_and_assumptions(model, output_path, standard, primary_bldg_type, system_type, climate_zone) case system_type when 'Ideal Air Loads' else # Set the heating and cooling sizing parameters standard.model_apply_prm_sizing_parameters(model) # Perform a sizing run if standard.model_run_sizing_run(model, "#{output_path}/SR") == false return false end # If there are any multizone systems, reset damper positions # to achieve a 60% ventilation effectiveness minimum for the system # following the ventilation rate procedure from 62.1 standard.model_apply_multizone_vav_outdoor_air_sizing(model) # Apply the prototype HVAC assumptions standard.model_apply_prototype_hvac_assumptions(model, primary_bldg_type, climate_zone) # Apply the HVAC efficiency standard standard.model_apply_hvac_efficiency_standard(model, climate_zone) end return true end |
#create_schedule_ruleset(model, values, name) ⇒ OpenStudio::Model::ScheduleRuleset
Returns a new schedule ruleset with values added to the default day.
208 209 210 211 212 213 214 215 216 |
# File 'lib/buildingsync/model_articulation/hvac_system.rb', line 208 def create_schedule_ruleset(model, values, name) ruleset = OpenStudio::Model::ScheduleRuleset.new(model) ruleset.setName(name) dd = ruleset.defaultDaySchedule values.each do |v| dd.addValue(v[0], v[1]) end return ruleset end |
#get_linked_ids ⇒ Object
63 |
# File 'lib/buildingsync/model_articulation/hvac_system.rb', line 63 def get_linked_ids; end |
#get_principal_hvac_system_type ⇒ String
get principal hvac system type
67 68 69 |
# File 'lib/buildingsync/model_articulation/hvac_system.rb', line 67 def get_principal_hvac_system_type return xget_text('PrincipalHVACSystemType') end |
#get_system_type_from_zone(zone_hash, zones, system_type) ⇒ String
get system type from zone
345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/buildingsync/model_articulation/hvac_system.rb', line 345 def get_system_type_from_zone(zone_hash, zones, system_type) zone_hash&.each do |id, zone_list| zone_name_list = help_get_zone_name_list(zone_list) zones.each do |zone| if zone_name_list.include? zone.name.get return map_to_cbecs(get_principal_hvac_system_type, system_type) end end end return system_type end |
#map_to_cbecs(principal_hvac_system_type, fallback_system_type) ⇒ String
map principal hvac system type to cbecs system type
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/buildingsync/model_articulation/hvac_system.rb', line 222 def map_to_cbecs(principal_hvac_system_type, fallback_system_type) case principal_hvac_system_type when 'Packaged Terminal Air Conditioner' return 'PTAC with hot water heat' when 'Packaged Terminal Heat Pump' return 'PTHP' when 'Packaged Rooftop Air Conditioner' return 'PSZ-AC with gas coil heat' when 'Packaged Rooftop Heat Pump' return 'PSZ-HP' when 'Packaged Rooftop VAV with Hot Water Reheat' return 'PVAV with reheat' when 'Packaged Rooftop VAV with Electric Reheat' return 'PVAV with PFP boxes' when 'VAV with Hot Water Reheat' return 'VAV with reheat' when 'VAV with Electric Reheat' return 'VAV with PFP boxes' else OpenStudio.logFree(OpenStudio::Error, 'BuildingSync.HVACSystem.map_to_cbecs', "HVACSystem ID: #{xget_id}: No mapping for #{principal_hvac_system_type} to CBECS. Using the system type from standards: #{fallback_system_type}") return fallback_system_type end end |
#read_xml ⇒ Object
read xml
61 |
# File 'lib/buildingsync/model_articulation/hvac_system.rb', line 61 def read_xml; end |
#set_principal_hvac_system_type(principal_hvac_type) ⇒ Object
adding the principal hvac system type to the hvac systems, overwrite existing values or create new elements if none are present
74 75 76 |
# File 'lib/buildingsync/model_articulation/hvac_system.rb', line 74 def set_principal_hvac_system_type(principal_hvac_type) xset_or_create('PrincipalHVACSystemType', principal_hvac_type) end |