From 358a72d1d8c900a4819caeac2c2f2391e3ed0b33 Mon Sep 17 00:00:00 2001 From: Eric Ringold Date: Wed, 15 May 2024 13:14:23 -0600 Subject: [PATCH 1/6] replicate comstock test w/ undef var wkdy_op_hrs_start at create_typical.rb:147 --- .../create_typical/test_create_typical.rb | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/modules/create_typical/test_create_typical.rb b/test/modules/create_typical/test_create_typical.rb index c95ae46c7..bacd237e9 100644 --- a/test/modules/create_typical/test_create_typical.rb +++ b/test/modules/create_typical/test_create_typical.rb @@ -93,4 +93,33 @@ def test_create_typical_building_from_model_with_hvac_mapping assert(ptacs.length==4) assert(psz_ac.length==1) end + + def test_create_typical_ese_op_hrs_overnight + # load model and set up weather file + template = 'DEER Pre-1975' + climate_zone = 'CEC T24-CEC3' + std = Standard.build(template) + model = std.safe_load_model("#{File.dirname(__FILE__)}/../../../data/geometry/DEER_ESe.osm") + OpenstudioStandards::Weather.model_set_building_location(model, climate_zone: climate_zone) + + # set output directory + output_dir = "#{__dir__}/output" + FileUtils.mkdir output_dir unless Dir.exist? output_dir + + # apply create typical + starting_size = model.getModelObjects.size + result = @create.create_typical_building_from_model(model, + template, + climate_zone: climate_zone, + modify_wkdy_op_hrs: true, + wkdy_op_hrs_start_time: 12.50, + wkdy_op_hrs_duration: 13.0, + modify_wknd_op_hrs: true, + wknd_op_hrs_start_time: 8.00, + wknd_op_hrs_duration: 6.00, + sizing_run_directory: output_dir) + ending_size = model.getModelObjects.size + assert(result) + assert(starting_size < ending_size) + end end From f4e4a17d5457b664a1127619aab45c25f2d963fd Mon Sep 17 00:00:00 2001 From: Eric Ringold Date: Wed, 15 May 2024 13:17:52 -0600 Subject: [PATCH 2/6] fix undefined variable --- lib/openstudio-standards/create_typical/create_typical.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/openstudio-standards/create_typical/create_typical.rb b/lib/openstudio-standards/create_typical/create_typical.rb index 37efcb635..505102b22 100644 --- a/lib/openstudio-standards/create_typical/create_typical.rb +++ b/lib/openstudio-standards/create_typical/create_typical.rb @@ -144,7 +144,7 @@ def self.create_typical_building_from_model(model, # check that weekday start time plus duration does not exceed 24 hrs if (wkdy_op_hrs_start_time_hr + wkdy_op_hrs_duration_hr + (wkdy_op_hrs_start_time_min + wkdy_op_hrs_duration_min) / 60.0) > 24.0 - OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CreateTypical', "Weekday start time of #{wkdy_op_hrs_start} plus duration of #{wkdy_op_hrs_duration} is more than 24 hrs, hours of operation overlap midnight.") + OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.CreateTypical', "Weekday start time of #{wkdy_op_hrs_start_time} plus duration of #{wkdy_op_hrs_duration} is more than 24 hrs, hours of operation overlap midnight.") end end From 2d8ee2fdef491218123af1be13194582686acd45 Mon Sep 17 00:00:00 2001 From: Matthew Dahlhausen Date: Thu, 16 May 2024 12:43:27 -0600 Subject: [PATCH 3/6] update sort method name --- lib/openstudio-standards/geometry/create_bar.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/openstudio-standards/geometry/create_bar.rb b/lib/openstudio-standards/geometry/create_bar.rb index 7e84b6931..ddecb934a 100644 --- a/lib/openstudio-standards/geometry/create_bar.rb +++ b/lib/openstudio-standards/geometry/create_bar.rb @@ -190,7 +190,7 @@ def self.model_envelope_data(model) building_overhang_area_w = 0.0 # loop through stories based on mine z height of surfaces. - sorted_stories = sort_building_stories_and_get_min_multiplier(model).sort_by { |k, v| v } + sorted_stories = OpenstudioStandards::Geometry.model_sort_building_stories_and_get_min_multiplier(model).sort_by { |k, v| v } sorted_stories.each do |story, story_min_z| story_min_multiplier = nil story_footprint = nil From 05796b9aaadc7b3ebb72aeb995737f434c846c6c Mon Sep 17 00:00:00 2001 From: Matthew Dahlhausen Date: Thu, 16 May 2024 12:48:23 -0600 Subject: [PATCH 4/6] streamline surface method --- .../prototypes/common/objects/Prototype.hvac_systems.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb b/lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb index 8e920816f..38f3a1f8c 100644 --- a/lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb +++ b/lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb @@ -5181,8 +5181,7 @@ def model_add_low_temp_radiant(model, surface.setConstruction(radiant_interior_floor_slab_construction) # also assign construction to adjacent surface - adjacent_surface = surface.adjacentSurface - if adjacent_surface.is_initialized + if surface.adjacentSurface.is_initialized adjacent_surface = surface.adjacentSurface.get adjacent_surface.setConstruction(rev_radiant_interior_floor_slab_construction) end @@ -5196,8 +5195,7 @@ def model_add_low_temp_radiant(model, surface.setConstruction(radiant_interior_ceiling_slab_construction) # also assign construction to adjacent surface - adjacent_surface = surface.adjacentSurface - if adjacent_surface.is_initialized + if surface.adjacentSurface.is_initialized adjacent_surface = surface.adjacentSurface.get adjacent_surface.setConstruction(rev_radiant_interior_ceiling_slab_construction) end From 91ea625134ebeeb841e6ca4017d63ebe2380e06c Mon Sep 17 00:00:00 2001 From: David Goldwasser Date: Thu, 16 May 2024 14:26:42 -0600 Subject: [PATCH 5/6] Fix to model_envelope_data method --- lib/openstudio-standards/geometry/create_bar.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/openstudio-standards/geometry/create_bar.rb b/lib/openstudio-standards/geometry/create_bar.rb index ddecb934a..864d27510 100644 --- a/lib/openstudio-standards/geometry/create_bar.rb +++ b/lib/openstudio-standards/geometry/create_bar.rb @@ -365,10 +365,10 @@ def self.model_envelope_data(model) end end - envelope_data_hash[:building_overhang_proj_factor_n] = building_overhang_area_n / ext_surfaces_hash['northWindow'] - envelope_data_hash[:building_overhang_proj_factor_s] = building_overhang_area_s / ext_surfaces_hash['southWindow'] - envelope_data_hash[:building_overhang_proj_factor_e] = building_overhang_area_e / ext_surfaces_hash['eastWindow'] - envelope_data_hash[:building_overhang_proj_factor_w] = building_overhang_area_w / ext_surfaces_hash['westWindow'] + envelope_data_hash[:building_overhang_proj_factor_n] = building_overhang_area_n / ext_surfaces_hash['north_window'] + envelope_data_hash[:building_overhang_proj_factor_s] = building_overhang_area_s / ext_surfaces_hash['south_window'] + envelope_data_hash[:building_overhang_proj_factor_e] = building_overhang_area_e / ext_surfaces_hash['east_window'] + envelope_data_hash[:building_overhang_proj_factor_w] = building_overhang_area_w / ext_surfaces_hash['west_window'] # warn for spaces that are not on a story (in future could infer stories for these) model.getSpaces.sort.each do |space| From b0579a4b3fe925d3fc8840e5b958549567597151 Mon Sep 17 00:00:00 2001 From: David Goldwasser Date: Thu, 16 May 2024 14:47:26 -0600 Subject: [PATCH 6/6] envelope_data_hash has separate values for above and below grade stories Without this infinity was coming out for footprint area and then length and width --- lib/openstudio-standards/geometry/create_bar.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/openstudio-standards/geometry/create_bar.rb b/lib/openstudio-standards/geometry/create_bar.rb index 864d27510..70e1f9532 100644 --- a/lib/openstudio-standards/geometry/create_bar.rb +++ b/lib/openstudio-standards/geometry/create_bar.rb @@ -390,7 +390,7 @@ def self.bar_reduced_bounding_box(envelope_data_hash) bounding_length = envelope_data_hash[:building_max_xyz][0] - envelope_data_hash[:building_min_xyz][0] bounding_width = envelope_data_hash[:building_max_xyz][1] - envelope_data_hash[:building_min_xyz][1] bounding_area = bounding_length * bounding_width - footprint_area = envelope_data_hash[:building_floor_area] / envelope_data_hash[:effective_num_stories].to_f + footprint_area = envelope_data_hash[:building_floor_area] / (envelope_data_hash[:effective_num_stories_above_grade]. + envelope_data_hash[:effective_num_stories_below_grade].to_f) area_multiplier = footprint_area / bounding_area edge_multiplier = Math.sqrt(area_multiplier) bar[:length] = bounding_length * edge_multiplier @@ -408,7 +408,7 @@ def self.bar_reduced_width(envelope_data_hash) bounding_length = envelope_data_hash[:building_max_xyz][0] - envelope_data_hash[:building_min_xyz][0] bounding_width = envelope_data_hash[:building_max_xyz][1] - envelope_data_hash[:building_min_xyz][1] - footprint_area = envelope_data_hash[:building_floor_area] / envelope_data_hash[:effective_num_stories].to_f + footprint_area = envelope_data_hash[:building_floor_area] / (envelope_data_hash[:effective_num_stories_above_grade]. + envelope_data_hash[:effective_num_stories_below_grade].to_f) if bounding_length >= bounding_width bar[:length] = bounding_length @@ -430,7 +430,7 @@ def self.bar_stretched(envelope_data_hash) bounding_length = envelope_data_hash[:building_max_xyz][0] - envelope_data_hash[:building_min_xyz][0] bounding_width = envelope_data_hash[:building_max_xyz][1] - envelope_data_hash[:building_min_xyz][1] - a = envelope_data_hash[:building_floor_area] / envelope_data_hash[:effective_num_stories].to_f + a = envelope_data_hash[:building_floor_area] / (envelope_data_hash[:effective_num_stories_above_grade]. + envelope_data_hash[:effective_num_stories_below_grade].to_f) p = envelope_data_hash[:building_perimeter] if bounding_length >= bounding_width