Skip to content

Commit

Permalink
Merge pull request #1473 from NREL/fix/issue516
Browse files Browse the repository at this point in the history
improve logging for missing standards space type
  • Loading branch information
mdahlhausen authored Mar 25, 2023
2 parents bd52ad2 + ac094c4 commit 8e83499
Show file tree
Hide file tree
Showing 4 changed files with 80,845 additions and 22 deletions.
43 changes: 25 additions & 18 deletions lib/openstudio-standards/standards/Standards.Space.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1002,24 +1002,31 @@ def space_add_daylighting_controls(space, remove_existing_controls, draw_dayligh
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Space', "Space #{space_type} is an unknown space type, assuming #{daylight_stpt_lux} Lux daylight setpoint")
else
space_type = space_type.get
standards_building_type = if space_type.standardsBuildingType.is_initialized
space_type.standardsBuildingType.get
end
standards_space_type = if space_type.standardsSpaceType.is_initialized
space_type.standardsSpaceType.get
end

# use the building type (standards_building_type) and space type (standards_space_type)
# as well as template to locate the space type data
search_criteria = {
'template' => template,
'building_type' => standards_building_type,
'space_type' => standards_space_type
}

data = model_find_object(standards_data['space_types'], search_criteria)
if data.nil?
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Space', "No data available for #{space_type.name}: #{standards_space_type} of #{standards_building_type} at #{template}, assuming a #{daylight_stpt_lux} Lux daylight setpoint!")
standards_building_type = nil
standards_space_type = nil
data = nil
if space_type.standardsBuildingType.is_initialized
standards_building_type = space_type.standardsBuildingType.get
end
if space_type.standardsSpaceType.is_initialized
standards_space_type = space_type.standardsSpaceType.get
end

unless standards_building_type.nil? || standards_space_type.nil?
# use the building type (standards_building_type) and space type (standards_space_type)
# as well as template to locate the space type data
search_criteria = {
'template' => template,
'building_type' => standards_building_type,
'space_type' => standards_space_type
}
data = model_find_object(standards_data['space_types'], search_criteria)
end

if standards_building_type.nil? || standards_space_type.nil?
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Space', "Unable to determine standards building type and standards space type for space '#{space.name}' with space type '#{space_type.name}'. Assign a standards building type and standards space type to the space type object. Defaulting to a #{daylight_stpt_lux} Lux daylight setpoint.")
elsif data.nil?
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Space', "Unable to find target illuminance setpoint data for space type '#{space_type.name}' with #{template} space type '#{standards_space_type}' in building type '#{standards_building_type}'. Defaulting to a #{daylight_stpt_lux} Lux daylight setpoint.")
else
# Read the illuminance setpoint value
# If 'na', daylighting is not appropriate for this space type for some reason
Expand Down
1 change: 1 addition & 0 deletions test/circleci_tests.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
os_stds_methods/test_add_hvac_systems.rb
os_stds_methods/test_service_water_heating.rb
os_stds_methods/test_daylighting_controls.rb
os_stds_methods/test_misc.rb

90_1_prm/test_create_performance_rating_method_baseline_building.rb
Expand Down
Loading

0 comments on commit 8e83499

Please sign in to comment.