Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix ASHRAE simple method for vertical surfaces #7890

Merged

Conversation

ajscimone
Copy link
Contributor

@ajscimone ajscimone commented Mar 27, 2020

Pull request overview

  • Fixes Fix ASHRAE Simple Convection Coefficient Initialization #7889
  • This pull request fixes the initialization of HConvIn, the convection coefficient, for ASHRAE Simple algorithm calculations. Prior to this pull request, the HConvIn returned from the ConvectionCoefficients namespace is a NaN for surfaced tilted above 67.5 degrees. This essentially covers the "vertical surface" cases fed into the ASHRAE Simple algorithm. After this pull request, HConvIn is set correctly for all cases, and unit tests have been added to ensure that surfaces which don't already have an HConvIn set are assigned a convection coefficient correctly, and that the CalcASHRAESimpleIntConvCoeff function returns the correct coefficient for each case defined by the algorithm.

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies

Reviewer

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

@nealkruis nealkruis added Defect Includes code to repair a defect in EnergyPlus NotIDDChange Code does not impact IDD (can be merged after IO freeze) labels Mar 27, 2020
@nealkruis nealkruis added this to the EnergyPlus 9.4.0 milestone Mar 27, 2020
@nealkruis nealkruis changed the title Fix ashrae simple method hconvin dependence Fix ASHRAE simple method for vertical surfaces Mar 30, 2020
@ajscimone ajscimone marked this pull request as ready for review April 28, 2020 23:13
@nealkruis nealkruis requested a review from Myoldmopar April 30, 2020 20:13
@mitchute
Copy link
Collaborator

@ajscimone feel free to pull in develop again here. There's one minor merge conflict that isn't really a conflict.

I merged in develop and ran tests locally, but I can't push to your fork. I'll work on reviewing it once CI takes another pass here.

@ajscimone
Copy link
Contributor Author

@mitchute I re-merged develop and saw the white space merge conflict you were referring to. Everything should be fixed and up to date now, just waiting for the CI.

Copy link
Member

@Myoldmopar Myoldmopar left a comment

Choose a reason for hiding this comment

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

I left a couple minor comments, but overall this is good to go. I'm building locally with very latest develop to verify the fix and this will be able to drop in.

return 3.076;
}
else {
Real64 DeltaTempCosTilt = (Tamb - Tsurf)*cosTilt;
Copy link
Member

Choose a reason for hiding this comment

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

A little whitespace around that asteriscus would've been nice but not a big deal.

// | Tilted Surface | Negative | -0.3827 to -0.9239 (157.5 to 157.5 degrees) | Positive | Enhanced | 3.870 |
// | Tilted Surface | Negative | 0.3827 to 0.9239 (22.5 to 67.5 degrees) | Negative | Reduced | 2.281 |
// | Tilted Surface | Positive | -0.3827 to -0.9239 (157.5 to 157.5 degrees) | Negative | Reduced | 2.281 |
// +---------------------+-----------+---------------------------------------------+------------------+-----------------+-------------+
Copy link
Member

Choose a reason for hiding this comment

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

In a function like this with a bunch of code paths, this is a great addition to help a developer understand what should be happening, and also the limitations of the function.

ConvectionCoefficient = DataHeatBalance::HConvIn(1);

EXPECT_EQ(ConvectionCoefficient, ExpectedCoefficient);
}
Copy link
Member

Choose a reason for hiding this comment

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

Great set of unit tests. Kind of a shame that you missed one code path in all the possible configurations (line 3874 here), but again, not going to hold this up for that, this is good work.

return CalcASHRAESimpleIntConvCoeff(Tsurf, Tamb, cosTilt);
};
}
else {
Copy link
Member

Choose a reason for hiding this comment

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

This else style is not the preferred form. } else { is preferred.

@@ -49,7 +49,6 @@
#include <algorithm>
#include <cassert>
#include <cmath>
#include <limits>
Copy link
Member

Choose a reason for hiding this comment

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

Removing includes 👍

@Myoldmopar
Copy link
Member

CI is generally really happy. I'm not worried about the Windows bot, it looks to be due to the branch being behind develop. I'm running it locally to verify the build and fix.

@Myoldmopar
Copy link
Member

No defect file, but built and ran unit test suite locally. Good to go. Merging.

@Myoldmopar Myoldmopar merged commit 78eb9b6 into NREL:develop May 17, 2020
@ajscimone ajscimone deleted the fix-ashrae-simple-method-hconvin-dependence branch May 19, 2020 23:27
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Defect Includes code to repair a defect in EnergyPlus NotIDDChange Code does not impact IDD (can be merged after IO freeze)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix ASHRAE Simple Convection Coefficient Initialization
9 participants