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

improve logging for missing standards space type #1473

Merged
merged 2 commits into from
Mar 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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