Class: BuildingSync::BuildingSection
- Inherits:
-
SpatialElement
- Object
- SpatialElement
- BuildingSync::BuildingSection
- Defined in:
- lib/buildingsync/model_articulation/building_section.rb
Overview
BuildingSection class
Instance Attribute Summary collapse
-
#fraction_area ⇒ Object
Returns the value of attribute fraction_area.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#occupancy_classification ⇒ Object
readonly
Returns the value of attribute occupancy_classification.
-
#section_type ⇒ Object
readonly
Returns the value of attribute section_type.
-
#space_types_floor_area ⇒ Object
readonly
Returns the value of attribute space_types_floor_area.
-
#standards_building_type ⇒ Object
readonly
Returns the value of attribute standards_building_type.
-
#typical_occupant_usage_value_hours ⇒ Object
readonly
Returns the value of attribute typical_occupant_usage_value_hours.
-
#typical_occupant_usage_value_weeks ⇒ Object
readonly
Returns the value of attribute typical_occupant_usage_value_weeks.
Attributes inherited from SpatialElement
#space_types, #system_type, #total_floor_area
Instance Method Summary collapse
-
#get_floor_area ⇒ Float
get floor area of this building section.
-
#get_peak_occupancy ⇒ String
get peak occupancy.
-
#initialize(base_xml, building_occupancy_classification, building_total_floor_area, num_stories, ns) ⇒ BuildingSection
constructor
initialize.
-
#prepare_final_xml ⇒ Object
add principal hvac type.
-
#read_building_section_other_detail ⇒ Object
read building section other details.
-
#read_construction_types ⇒ Object
read construction types.
-
#read_xml ⇒ Object
read xml.
-
#set_bldg_and_system_type ⇒ Object
set building and system type.
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
Methods inherited from SpatialElement
#add_user_defined_field_to_xml_file, #create_space_types, #prepare_final_xml_for_spatial_element, #process_bldg_and_system_type, #read_floor_areas, #sets_occupancy_bldg_system_types, #validate_positive_number_excluding_zero, #validate_positive_number_including_zero
Constructor Details
#initialize(base_xml, building_occupancy_classification, building_total_floor_area, num_stories, ns) ⇒ BuildingSection
initialize
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 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 56 def initialize(base_xml, building_occupancy_classification, building_total_floor_area, num_stories, ns) super(base_xml, ns) @base_xml = base_xml @ns = ns help_element_class_type_check(base_xml, 'Section') @door_ids = [] @wall_ids = [] @window_ids = [] @roof_ids = [] @skylight_ids = [] @exterior_floor_ids = [] @foundation_ids = [] # parameter to read and write. @fraction_area = nil @standards_building_type = nil @occupancy_classification_original = nil @typical_occupant_usage_value_hours = nil @typical_occupant_usage_value_weeks = nil @occupant_quantity = nil @principal_hvac_type = nil @num_stories = num_stories @total_floor_area = read_floor_areas(building_total_floor_area) xset_or_create('OccupancyClassification', building_occupancy_classification, false) # code to initialize read_xml end |
Instance Attribute Details
#fraction_area ⇒ Object
Returns the value of attribute fraction_area.
188 189 190 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 188 def fraction_area @fraction_area end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
187 188 189 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 187 def id @id end |
#occupancy_classification ⇒ Object (readonly)
Returns the value of attribute occupancy_classification.
187 188 189 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 187 def occupancy_classification @occupancy_classification end |
#section_type ⇒ Object (readonly)
Returns the value of attribute section_type.
187 188 189 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 187 def section_type @section_type end |
#space_types_floor_area ⇒ Object (readonly)
Returns the value of attribute space_types_floor_area.
187 188 189 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 187 def space_types_floor_area @space_types_floor_area end |
#standards_building_type ⇒ Object (readonly)
Returns the value of attribute standards_building_type.
187 188 189 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 187 def standards_building_type @standards_building_type end |
#typical_occupant_usage_value_hours ⇒ Object (readonly)
Returns the value of attribute typical_occupant_usage_value_hours.
187 188 189 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 187 def typical_occupant_usage_value_hours @typical_occupant_usage_value_hours end |
#typical_occupant_usage_value_weeks ⇒ Object (readonly)
Returns the value of attribute typical_occupant_usage_value_weeks.
187 188 189 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 187 def typical_occupant_usage_value_weeks @typical_occupant_usage_value_weeks end |
Instance Method Details
#get_floor_area ⇒ Float
get floor area of this building section
183 184 185 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 183 def get_floor_area return @total_floor_area end |
#get_peak_occupancy ⇒ String
get peak occupancy
177 178 179 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 177 def get_peak_occupancy return @occupant_quantity end |
#prepare_final_xml ⇒ Object
add principal hvac type
159 160 161 162 163 164 165 166 167 168 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 159 def prepare_final_xml @base_xml.elements["#{@ns}:fraction_area"].text = @fraction_area @base_xml.elements["#{@ns}:OriginalOccupancyClassification"].text = @occupancy_classification_original if !@occupancy_classification_original.nil? @base_xml.elements["#{@ns}:TypicalOccupantUsages/#{@ns}:TypicalOccupantUsage/#{@ns}:TypicalOccupantUsageValue"].text = @typical_occupant_usage_value_hours if !@typical_occupant_usage_value_hours.nil? @base_xml.elements["#{@ns}:TypicalOccupantUsages/#{@ns}:TypicalOccupantUsage/#{@ns}:TypicalOccupantUsageValue"].text = @typical_occupant_usage_value_weeks if !@typical_occupant_usage_value_weeks.nil? @base_xml.elements["#{@ns}:OccupancyLevels/#{@ns}:OccupancyLevel/#{@ns}:OccupantQuantity"].text = @occupant_quantity if !@occupant_quantity.nil? prepare_final_xml_for_spatial_element end |
#read_building_section_other_detail ⇒ Object
read building section other details
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 105 def read_building_section_other_detail if @base_xml.elements["#{@ns}:TypicalOccupantUsages"] @base_xml.elements.each("#{@ns}:TypicalOccupantUsages/#{@ns}:TypicalOccupantUsage") do |occ_usage| if occ_usage.elements["#{@ns}:TypicalOccupantUsageUnits"].text == 'Hours per week' @typical_occupant_usage_value_hours = occ_usage.elements["#{@ns}:TypicalOccupantUsageValue"].text elsif occ_usage.elements["#{@ns}:TypicalOccupantUsageUnits"].text == 'Weeks per year' @typical_occupant_usage_value_weeks = occ_usage.elements["#{@ns}:TypicalOccupantUsageValue"].text end end end if @base_xml.elements["#{@ns}:OccupancyLevels"] @base_xml.elements.each("#{@ns}:OccupancyLevels/#{@ns}:OccupancyLevel") do |occ_level| if occ_level.elements["#{@ns}:OccupantQuantityType"].text == 'Peak total occupants' @occupant_quantity = occ_level.elements["#{@ns}:OccupantQuantity"].text end end end end |
#read_construction_types ⇒ Object
read construction types
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 126 def read_construction_types if @base_xml.elements["#{@ns}:Sides"] @base_xml.elements.each("#{@ns}:Sides/#{@ns}:Side/#{@ns}:DoorID") do |door| @door_ids.push(door.attributes['IDref']) end @base_xml.elements.each("#{@ns}:Sides/#{@ns}:Side/#{@ns}:WallID") do |wall| @wall_ids.push(wall.attributes['IDref']) end @base_xml.elements.each("#{@ns}:Sides/#{@ns}:Side/#{@ns}:WindowID") do |window| @window_ids.push(window.attributes['IDref']) end end if @base_xml.elements["#{@ns}:Roofs"] @base_xml.elements.each("#{@ns}:Roofs/#{@ns}:Roof/#{@ns}:RoofID") do |roof| @roof_ids.push(roof.attributes['IDref']) end @base_xml.elements.each("#{@ns}:Roofs/#{@ns}:Roof/#{@ns}:RoofID/#{@ns}:SkylightIDs/#{@ns}:SkylightID") do |skylight| @skylight_ids.push(skylight.attributes['IDref']) end end if @base_xml.elements["#{@ns}:ExteriorFloors"] @base_xml.elements.each("#{@ns}:ExteriorFloors/#{@ns}:ExteriorFloor/#{@ns}:ExteriorFloorID ") do |floor| @exterior_floor_ids.push(floor.attributes['IDref']) end end if @base_xml.elements["#{@ns}:Foundations"] @base_xml.elements.each("#{@ns}:Foundations/#{@ns}:Foundation/#{@ns}:FoundationID ") do |foundation| @foundation_ids.push(foundation.attributes['IDref']) end end end |
#read_xml ⇒ Object
read xml
91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 91 def read_xml # floor areas # based on the occupancy type set building type, system type and bar division method read_building_section_other_detail read_construction_types if @base_xml.elements["#{@ns}:OccupancyLevels/#{@ns}:OccupancyLevel/#{@ns}:OccupantQuantity"] @occupant_quantity = @base_xml.elements["#{@ns}:OccupancyLevels/#{@ns}:OccupancyLevel/#{@ns}:OccupantQuantity"].text else @occupant_quantity = nil end end |
#set_bldg_and_system_type ⇒ Object
set building and system type
171 172 173 |
# File 'lib/buildingsync/model_articulation/building_section.rb', line 171 def set_bldg_and_system_type super(xget_text('OccupancyClassification'), @total_floor_area, @num_stories, false) end |