Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix create typical and create bar issues #1746

Merged
merged 8 commits into from
May 17, 2024
2 changes: 1 addition & 1 deletion lib/openstudio-standards/create_typical/create_typical.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 8 additions & 8 deletions lib/openstudio-standards/geometry/create_bar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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|
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5173,16 +5173,18 @@ def model_add_low_temp_radiant(model,
space.surfaces.each do |surface|
if radiant_type == 'floor'
if surface.surfaceType == 'Floor'
if surface.outsideBoundaryCondition == 'Ground'
if surface.outsideBoundaryCondition.include? 'Ground'
surface.setConstruction(radiant_ground_slab_construction)
elsif surface.outsideBoundaryCondition == 'Outdoors'
surface.setConstruction(radiant_exterior_slab_construction)
else # interior floor
surface.setConstruction(radiant_interior_floor_slab_construction)

# also assign construciton to adjacent surface
adjacent_surface = surface.adjacentSurface.get
adjacent_surface.setConstruction(rev_radiant_interior_floor_slab_construction)
# also assign construction to adjacent surface
if surface.adjacentSurface.is_initialized
adjacent_surface = surface.adjacentSurface.get
adjacent_surface.setConstruction(rev_radiant_interior_floor_slab_construction)
end
end
end
elsif radiant_type == 'ceiling'
Expand All @@ -5192,9 +5194,11 @@ def model_add_low_temp_radiant(model,
else # interior ceiling
surface.setConstruction(radiant_interior_ceiling_slab_construction)

# also assign construciton to adjacent surface
adjacent_surface = surface.adjacentSurface.get
adjacent_surface.setConstruction(rev_radiant_interior_ceiling_slab_construction)
# also assign construction to adjacent surface
if surface.adjacentSurface.is_initialized
adjacent_surface = surface.adjacentSurface.get
adjacent_surface.setConstruction(rev_radiant_interior_ceiling_slab_construction)
end
end
end
end
Expand Down
29 changes: 29 additions & 0 deletions test/modules/create_typical/test_create_typical.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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