lib/openstudio-standards/standards/Standards.Model.rb in openstudio-standards-0.2.15 vs lib/openstudio-standards/standards/Standards.Model.rb in openstudio-standards-0.2.16.rc1
- old
+ new
@@ -2522,18 +2522,34 @@
def model_find_and_add_construction(model, climate_zone_set, intended_surface_type, standards_construction_type, building_category)
# Get the construction properties,
# which specifies properties by construction category by climate zone set.
# AKA the info in Tables 5.5-1-5.5-8
- props = model_find_object(standards_data['construction_properties'],
- 'template' => template,
- 'climate_zone_set' => climate_zone_set,
- 'intended_surface_type' => intended_surface_type,
- 'standards_construction_type' => standards_construction_type,
- 'building_category' => building_category)
+ wwr = model_get_percent_of_surface_range(model, intended_surface_type)
+ search_criteria = { 'template' => template,
+ 'climate_zone_set' => climate_zone_set,
+ 'intended_surface_type' => intended_surface_type,
+ 'standards_construction_type' => standards_construction_type,
+ 'building_category' => building_category }
+
+ if !wwr['minimum_percent_of_surface'].nil? && !wwr['maximum_percent_of_surface'].nil?
+ search_criteria['minimum_percent_of_surface'] = wwr['minimum_percent_of_surface']
+ search_criteria['maximum_percent_of_surface'] = wwr['maximum_percent_of_surface']
+ end
+
+ # First search
+ props = model_find_object(standards_data['construction_properties'], search_criteria)
+
if !props
+ # Second search: In case need to use climate zone (e.g: 3) instead of sub-climate zone (e.g: 3A) for search
+ climate_zone = climate_zone_set[0..-2]
+ search_criteria['climate_zone_set'] = climate_zone
+ props = model_find_object(standards_data['construction_properties'], search_criteria)
+ end
+
+ if !props
OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.Model', "Could not find construction properties for: #{template}-#{climate_zone_set}-#{intended_surface_type}-#{standards_construction_type}-#{building_category}.")
# Return an empty construction
construction = OpenStudio::Model::Construction.new(model)
construction.setName('Could not find construction properties set to Adiabatic ')
almost_adiabatic = OpenStudio::Model::MasslessOpaqueMaterial.new(model, 'Smooth', 500)
@@ -3600,10 +3616,16 @@
}
# switch to use this but update test in standards and measures to load this outside of the method
construction_properties = model_find_object(standards_data['construction_properties'], search_criteria)
+ if !construction_properties
+ # Search again use climate zone (e.g. 3) instead of sub-climate zone (3A)
+ search_criteria['climate_zone_set'] = climate_zone_set[0..-2]
+ construction_properties = model_find_object(standards_data['construction_properties'], search_criteria)
+ end
+
return construction_properties
end
# Returns standards data for selected construction set
#
@@ -4288,11 +4310,11 @@
#
# @param model [OpenStudio::Model::Model] OpenStudio model object
# @param possible_climate_zone_sets [Array] climate zone sets
# @return [String] climate zone ses
def model_get_climate_zone_set_from_list(model, possible_climate_zone_sets)
- climate_zone_set = possible_climate_zone_sets.min
+ climate_zone_set = possible_climate_zone_sets.max
return climate_zone_set
end
# This method ensures that all spaces with spacetypes defined contain at least a standardSpaceType appropriate for the template.
# So, if any space with a space type defined does not have a Stnadard spacetype, or is undefined, an error will stop
@@ -5775,9 +5797,18 @@
props.setFeature('param_day_tag', 'medium_operation') # not min max or typical
end
end
return parametric_inputs
+ end
+
+ # Determine the surface range of a baseline model.
+ # The method calculates the window to wall ratio (assuming all spaces are conditioned)
+ # and select the range based on the calculated window to wall ratio
+ # @param model [OpenStudio::Model::Model] OpenStudio model object
+ # @param intended_surface_type [String] surface type
+ def model_get_percent_of_surface_range(model, intended_surface_type)
+ return { 'minimum_percent_of_surface' => nil, 'maximum_percent_of_surface' => nil }
end
# Default SAT reset type
#
# @param air_loop_hvac [OpenStudio::Model::AirLoopHVAC] air loop