Class: BuildingSync::ServiceHotWaterSystem

Inherits:
BuildingSystem show all
Defined in:
lib/buildingsync/model_articulation/service_hot_water_system.rb

Overview

ServiceHotWaterSystem class to add a SHW system to the model

Instance Method Summary collapse

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

#initializeServiceHotWaterSystem

initialize



43
44
45
# File 'lib/buildingsync/model_articulation/service_hot_water_system.rb', line 43

def initialize
  # code to initialize
end

Instance Method Details

#add(model, standard, remove_objects) ⇒ Boolean

add

Parameters:

  • model (OpenStudio::Model)
  • standard (Standard)
  • remove_objects (Boolean)

Returns:

  • (Boolean)


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/buildingsync/model_articulation/service_hot_water_system.rb', line 52

def add(model, standard, remove_objects)
  # remove water use equipment and water use connections
  if remove_objects
    # TODO: - remove plant loops used for service water heating
    model.getWaterUseEquipments.each(&:remove)
    model.getWaterUseConnectionss.each(&:remove)
  end

  typical_swh = standard.model_add_typical_swh(model)
  mid_rise_swh_loops = []
  strip_mall_swh_loops = []
  typical_swh.each do |loop|
    if loop.name.get.include?('MidriseApartment')
      mid_rise_swh_loops << loop
    elsif loop.name.get.include?('RetailStripmall')
      strip_mall_swh_loops << loop
    else
      water_use_connections = []
      loop.demandComponents.each do |component|
        next if !component.to_WaterUseConnections.is_initialized

        water_use_connections << component
      end
      OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.Facility.create_building_system', "Adding #{loop.name} to the building. It has #{water_use_connections.size} water use connections.")
    end
  end
  if !mid_rise_swh_loops.empty?
    OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.Facility.create_building_system', "Adding #{mid_rise_swh_loops.size} MidriseApartment service water heating loops.")
  end
  if !strip_mall_swh_loops.empty?
    OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.Facility.create_building_system', "Adding #{strip_mall_swh_loops.size} RetailStripmall service water heating loops.")
  end
  return true
end