Class: BuildingSync::LocationElement

Inherits:
SpatialElement show all
Defined in:
lib/buildingsync/model_articulation/location_element.rb

Overview

base class for objects that will configure workflows based on building sync files

Direct Known Subclasses

Building, Site

Instance Attribute Summary

Attributes inherited from SpatialElement

#space_types, #standards_building_type, #system_type, #total_floor_area

Instance Method Summary collapse

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, #set_bldg_and_system_type, #sets_occupancy_bldg_system_types, #validate_positive_number_excluding_zero, #validate_positive_number_including_zero

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) ⇒ LocationElement

initialize LocationElement class

Parameters:

  • base_xml (REXML::Element)

    an element corresponding to a locational element either an auc:Site or auc:Building

  • ns (String)

    namespace, likely ‘auc’



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/buildingsync/model_articulation/location_element.rb', line 47

def initialize(base_xml, ns)
  super(base_xml, ns)
  @base_xml = base_xml
  @ns = ns

  @climate_zone = nil
  @climate_zone_ashrae = nil
  @climate_zone_ca_t24 = nil
  @city_name = nil
  @state_name = nil

  read_location_values
end

Instance Method Details

#determine_climate_zone(standard_to_be_used = nil) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/buildingsync/model_articulation/location_element.rb', line 70

def determine_climate_zone(standard_to_be_used = nil)
  if standard_to_be_used == ASHRAE90_1
    if !@climate_zone_ashrae.nil?
      @climate_zone = @climate_zone_ashrae
    elsif @climate_zone.nil? && !@climate_zone_ca_t24.nil?
      @climate_zone = @climate_zone_ca_t24
      OpenStudio.logFree(OpenStudio::Warn, 'BuildingSync.LocationElement.determine_climate_zone', "Element ID: #{xget_id} - Standard to use is #{standard_to_be_used} but ASHRAE Climate Zone is nil. Using CA T24: #{@climate_zone}")
    end
  elsif standard_to_be_used == CA_TITLE24
    if !@climate_zone_ca_t24.nil?
      @climate_zone = @climate_zone_ca_t24
    elsif @climate_zone.nil? && !@climate_zone_ashrae.nil?
      @climate_zone = @climate_zone_ashrae
      OpenStudio.logFree(OpenStudio::Warn, 'BuildingSync.LocationElement.determine_climate_zone', "Element ID: #{xget_id} - Standard to use is #{standard_to_be_used} but CA T24 Climate Zone is nil. Using ASHRAE: #{@climate_zone}")
    end
  end
end

#get_climate_zoneString

get climate zone

Parameters:

  • standard_to_be_used (String)

Returns:

  • (String)


91
92
93
# File 'lib/buildingsync/model_articulation/location_element.rb', line 91

def get_climate_zone
  return @climate_zone
end

#read_city_and_state_nameObject

read city and state name



116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/buildingsync/model_articulation/location_element.rb', line 116

def read_city_and_state_name
  if @base_xml.elements["#{@ns}:Address/#{@ns}:City"]
    @city_name = @base_xml.elements["#{@ns}:Address/#{@ns}:City"].text
  else
    @city_name = nil
  end
  if @base_xml.elements["#{@ns}:Address/#{@ns}:State"]
    @state_name = @base_xml.elements["#{@ns}:Address/#{@ns}:State"].text
  else
    @state_name = nil
  end
end

#read_climate_zoneObject

read climate zone



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/buildingsync/model_articulation/location_element.rb', line 96

def read_climate_zone
  if @base_xml.elements["#{@ns}:ClimateZoneType/#{@ns}:ASHRAE"]
    @climate_zone_ashrae = @base_xml.elements["#{@ns}:ClimateZoneType/#{@ns}:ASHRAE/#{@ns}:ClimateZone"].text
    OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.LocationElement.read_climate_zone', "Element ID: #{xget_id} - ASHRAE Climate Zone: #{@climate_zone_ashrae}")
  else
    @climate_zone_ashrae = nil
  end
  if @base_xml.elements["#{@ns}:ClimateZoneType/#{@ns}:CaliforniaTitle24"]
    @climate_zone_ca_t24 = @base_xml.elements["#{@ns}:ClimateZoneType/#{@ns}:CaliforniaTitle24/#{@ns}:ClimateZone"].text
    OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.LocationElement.read_climate_zone', "Element ID: #{xget_id} - Title24 Climate Zone: #{@climate_zone_ca_t24}")
  else
    @climate_zone_ca_t24 = nil
  end

  if @climate_zone_ashrae.nil? && @climate_zone_ca_t24.nil?
    OpenStudio.logFree(OpenStudio::Warn, 'BuildingSync.LocationElement.read_climate_zone', "Element ID: #{xget_id} - Title24 Climate Zone and ASHRAE Climate Zone not found")
  end
end

#read_location_valuesObject

read location values



62
63
64
65
66
67
68
# File 'lib/buildingsync/model_articulation/location_element.rb', line 62

def read_location_values
  # read in the ASHRAE climate zone
  read_climate_zone

  # read city and state name
  read_city_and_state_name
end