lib/openstudio-standards/geometry/create_bar.rb in openstudio-standards-0.5.0 vs lib/openstudio-standards/geometry/create_bar.rb in openstudio-standards-0.6.0.rc1
- old
+ new
@@ -1,9 +1,10 @@
-# Methods to create geometry
module OpenstudioStandards
+ # This Module provides methods to create, modify, and get information about model geometry
module Geometry
# @!group CreateBar
+ # Methods to create bar geometry
# Building Form Defaults from Table 4.2 in Achieving the 30% Goal: Energy and Cost Savings Analysis of ASHRAE Standard 90.1-2010
# aspect ratio for NA replaced with floor area to perimeter ratio from prototype model
# currently no reason to split apart doe and deer inputs here
#
@@ -325,13 +326,13 @@
envelope_data_hash[:stories][story][:story_exterior_surface_area] = story_multiplied_exterior_surface_area
envelope_data_hash[:stories][story][:story_multiplied_exterior_wall_area] = story_multiplied_exterior_wall_area
envelope_data_hash[:stories][story][:story_multiplied_exterior_roof_area] = story_multiplied_exterior_roof_area
# get perimeter and adiabatic walls that appear to be party walls
- perimeter_and_party_walls = OpenstudioStandards::Geometry.story_get_exterior_wall_perimeter(story,
- multiplier_adjustment: story_min_multiplier,
- bounding_box: bounding_box)
+ perimeter_and_party_walls = OpenstudioStandards::Geometry.building_story_get_exterior_wall_perimeter(story,
+ multiplier_adjustment: story_min_multiplier,
+ bounding_box: bounding_box)
envelope_data_hash[:stories][story][:story_perimeter] = perimeter_and_party_walls[:perimeter]
envelope_data_hash[:stories][story][:story_party_walls] = []
east = false
south = false
west = false
@@ -492,11 +493,11 @@
flat_hash[:multiplier] = v[:story_min_multiplier]
end
compare_hash = {}
if !stories_flat.empty?
- stories_flat.last.each { |k, v| compare_hash[k] = flat_hash[k] if flat_hash[k] != v }
+ stories_flat.last.each { |s, m| compare_hash[s] = flat_hash[s] if flat_hash[s] != m }
end
if (bar_hash[:story_multiplier_method] != 'None' && stories_flat.last == flat_hash) || (bar_hash[:story_multiplier_method] != 'None' && compare_hash.size == 1 && compare_hash.include?(:multiplier))
stories_flat.last[:multiplier] += v[:story_min_multiplier]
else
stories_flat << flat_hash
@@ -1184,47 +1185,46 @@
else
match_error = false
end
# @todo should be able to remove this fix after OpenStudio intersection issue is fixed. At that time turn the above message into an error with return false after it
- if match_error
+ return true unless match_error
- # identify z value of top and bottom story
- bottom_story = nil
- top_story = nil
- new_spaces.each do |space|
- story = space.buildingStory.get
- nom_z = story.nominalZCoordinate.get
- if bottom_story.nil?
- bottom_story = nom_z
- elsif bottom_story > nom_z
- bottom_story = nom_z
- end
- if top_story.nil?
- top_story = nom_z
- elsif top_story < nom_z
- top_story = nom_z
- end
+ # identify z value of top and bottom story
+ bottom_story = nil
+ top_story = nil
+ new_spaces.each do |space|
+ story = space.buildingStory.get
+ nom_z = story.nominalZCoordinate.get
+ if bottom_story.nil?
+ bottom_story = nom_z
+ elsif bottom_story > nom_z
+ bottom_story = nom_z
end
+ if top_story.nil?
+ top_story = nom_z
+ elsif top_story < nom_z
+ top_story = nom_z
+ end
+ end
- # change boundary condition and intersection as needed.
- new_spaces.each do |space|
- if space.buildingStory.get.nominalZCoordinate.get > bottom_story
- # change floors
- space.surfaces.each do |surface|
- next if !(surface.surfaceType == 'Floor' && surface.outsideBoundaryCondition == 'Ground')
+ # change boundary condition and intersection as needed.
+ new_spaces.each do |space|
+ if space.buildingStory.get.nominalZCoordinate.get > bottom_story
+ # change floors
+ space.surfaces.each do |surface|
+ next if !(surface.surfaceType == 'Floor' && surface.outsideBoundaryCondition == 'Ground')
- surface.setOutsideBoundaryCondition('Adiabatic')
- end
+ surface.setOutsideBoundaryCondition('Adiabatic')
end
- if space.buildingStory.get.nominalZCoordinate.get < top_story
- # change ceilings
- space.surfaces.each do |surface|
- next if !(surface.surfaceType == 'RoofCeiling' && surface.outsideBoundaryCondition == 'Outdoors')
+ end
+ if space.buildingStory.get.nominalZCoordinate.get < top_story
+ # change ceilings
+ space.surfaces.each do |surface|
+ next if !(surface.surfaceType == 'RoofCeiling' && surface.outsideBoundaryCondition == 'Outdoors')
- surface.setOutsideBoundaryCondition('Adiabatic')
- end
+ surface.setOutsideBoundaryCondition('Adiabatic')
end
end
end
end
@@ -1343,11 +1343,11 @@
# creating space types for requested building types
building_type_hash.each do |building_type, building_type_hash|
OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Geometry.Create', "Creating Space Types for #{building_type}.")
# mapping building_type name is needed for a few methods
- temp_standard = Standard.build('90.1-2013')
+ temp_standard = Standard.build(args[:template])
building_type = temp_standard.model_get_lookup_name(building_type)
# create space_type_map from array
sum_of_ratios = 0.0
building_type_hash[:space_types] = building_type_hash[:space_types].sort_by { |k, v| v[:ratio] }.to_h
@@ -1919,10 +1919,10 @@
wall_ew_ip = OpenStudio.convert(wall_ew, 'm^2', 'ft^2').get
OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Geometry.Create', "wall_area_ip: #{wall_ns_ip + wall_ew_ip} ft^2")
OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Geometry.Create', "ns_wall_area_ip: #{wall_ns_ip} ft^2")
OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Geometry.Create', "ew_wall_area_ip: #{wall_ew_ip} ft^2")
# for now using perimeter of ground floor and average story area (building area / num_stories)
- OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Geometry.Create', "floor_area_to_perim_ratio: #{model.getBuilding.floorArea / (OpenstudioStandards::Geometry.model_get_perimeter_length(model) * num_stories)}")
+ OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Geometry.Create', "floor_area_to_perim_ratio: #{model.getBuilding.floorArea / (OpenstudioStandards::Geometry.model_get_perimeter(model) * num_stories)}")
OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Geometry.Create', "bar_width: #{OpenStudio.convert(bars['primary'][:width], 'm', 'ft').get} ft")
if args[:party_wall_fraction] > 0 || args[:party_wall_stories_north] > 0 || args[:party_wall_stories_south] > 0 || args[:party_wall_stories_east] > 0 || args[:party_wall_stories_west] > 0
OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Geometry.Create', 'Target facade area by orientation not validated when party walls are applied')
elsif args[:num_stories_above_grade] != args[:num_stories_above_grade].ceil