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

Simple glazing cleanup #1640

Merged
merged 12 commits into from
Jan 11, 2024
Merged

Simple glazing cleanup #1640

merged 12 commits into from
Jan 11, 2024

Conversation

lymereJ
Copy link
Collaborator

@lymereJ lymereJ commented Nov 16, 2023

Pull request overview

This PR aims to remove all simple glazing material definitions from the data files and instead use the name of the material to create the corresponding object.

Pull Request Author

  • Method changes or additions
  • Data changes or additions
  • Resolved rubocop syntax errors for new code (ran bundle exec rake rubocop)
  • All new and existing tests passes

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a code review on GitHub
  • All related changes have been implemented: method additions, changes, tests
  • Check rubocop errors
  • Check yard doc errors
  • If fixing a defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If a new feature, test the new feature and try creative ways to break it
  • CI status: all green or justified

@lymereJ
Copy link
Collaborator Author

lymereJ commented Dec 1, 2023

The performance test diffs comes from the fact that previously some of the simple glazing material did not specify a visible transmittance (VT) value. When not specified EnergyPlus does not assume a "default" value, it assumes that "the visible properties are the same as the solar properties". Assuming some degree of default VT seems appropriate. The changes in the pull request use a default VT of 0.81 when no VT is used. Performance test results and regression models will be updated.

@lymereJ lymereJ marked this pull request as ready for review December 1, 2023 19:45
data = model_find_object(standards_data['materials'], 'name' => material_name)
unless data
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Cannot find data for material: #{material_name}, will not be created.")
return OpenStudio::Model::OptionalMaterial.new(model)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address todo.

Comment on lines 3176 to 3178
u_factor = 1.23
shgc = 0.61
vt = 0.81
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assume default properties if not specified in the material name.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a warning message if use the default value instead of from the object name

@lymereJ lymereJ requested a review from mdahlhausen December 4, 2023 06:44
end
end
else
data = model_find_object(standards_data['materials'], 'name' => material_name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need code here to assign u, vt, and shgc variables, e.g. u_factor = data['u_factor'], otherwise this will fail below

Copy link
Collaborator Author

@lymereJ lymereJ Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is related to your first comment, I was not expecting that we would allow a straight look-up in the database, but I guess that seems reasonable.

OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Cannot find data for material: #{material_name}, will not be created.")
return false
# @todo change to return empty optional material
if material_name.include?('Simple Glazing')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest checking for the data first, and then assign by name, instead of leading with the construction name.

shgc = 0.61
vt = 0.81
material_name.split.each_with_index do |item, i|
if item == 'U'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think setting object properties based on the name is risky, because you are relying on the user to have a specific naming convention. Fine if we have complete control over names, but I don't think we can enforce that in all instances where this method may be called.

Consider a test case with a material named "SimpleGlazing change from U 0.4 to U 0.3. What would this method do?

It might be unreasonable to do a full accounting for all kinds of names, but I'm worried as is isn't robust enough. Thoughts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I brought up that point by email, I thought it wasn't too robust but you seem to be in favor of it. Now the way I see it is that we're setting up the naming convention to use so perhaps if we flag obvious errors it might be okay? For example if the name doesn't contain or includes a typo in Simple Glazing it just won't be found in the database so an error will be returned, we could add a warning when a property has not been found in the name (either because of a typo or actually missing) and let the user know that we're using a default value in place, and also when the same property is specified twice in the name (as per your example). Happy to discuss that further.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. yeah you did bring that up in October and I forgot.

I'm ok doing name first, but then keeping the database option in case someone wants to deviate from it. If we do name first, we need a bit more error checking. If we do the data first, that risks slowing down code for the majority of users, but perhaps captures likely instances where the name differs. I'm unsure of which to choose. I guess name first with good error checking?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good to me, I'll push some changes this week to address this. Thanks!

Copy link
Collaborator

@mdahlhausen mdahlhausen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments above

@lymereJ lymereJ requested a review from mdahlhausen January 9, 2024 06:50
@mdahlhausen mdahlhausen merged commit c1fbb2f into master Jan 11, 2024
1 of 2 checks passed
@mdahlhausen mdahlhausen deleted the simp_glaz_mod branch January 11, 2024 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants