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

Prevent Kiva exposed perimeter warning #8073

Merged
merged 4 commits into from
Jun 30, 2020
Merged

Conversation

shorowit
Copy link
Contributor

@shorowit shorowit commented Jun 10, 2020

Pull request overview

IDF files using Kiva can potentially generate warnings like this:

   ** Warning ** SurfaceProperty:ExposedFoundationPerimeter: SLAB, Total Exposed Perimeter is greater than the perimeter of SLAB
   **   ~~~   ** SLAB perimeter = 51, SurfaceProperty:ExposedFoundationPerimeter exposed perimeter = 51
   **   ~~~   ** Total Exposed Perimeter will be set equal to SLAB perimeter

In the IDF file provided below, the perimeter of both the SurfaceProperty:ExposedFoundationPerimeter and BuildingSurface:Detailed objects are exactly identical (51.2064 m). Presumably the issue is caused by floating point precision when calculating the perimeter of the BuildingSurface:Detailed object from its vertices. This PR adds tolerance to the warning.

Test file:
in.idf.txt

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

@shorowit shorowit added the Defect Includes code to repair a defect in EnergyPlus label Jun 10, 2020
@shorowit shorowit added this to the EnergyPlus 9.4.0 milestone Jun 10, 2020
@shorowit shorowit requested a review from nealkruis June 10, 2020 21:31
@shorowit shorowit self-assigned this Jun 10, 2020
@nealkruis
Copy link
Member

This looks good, but you might consider using Kiva::isGreaterThan (or something similar in EnergyPlus--@Myoldmopar do you know of anything?) for a consistent approach to handling floating point comparisons.

@Myoldmopar
Copy link
Member

-@Myoldmopar do you know of anything?)

I would at a minimum suggest declaring the applied tolerance as a const float in the function, or some convenient location, and check if the value is within the tolerance both above as well as below. I assume there are a couple functions like that already in EnergyPlus, but I don't know of any off the top of my head. Plant has an integer based one that just checks a range, not exactly what we're looking for here.

@shorowit
Copy link
Contributor Author

Ok, I added a const for the tolerance. Note that we're not trying to ensure the value is 1 (within some tolerance) but rather that it does not exceed 1 (including a tolerance).

@shorowit shorowit requested a review from Myoldmopar June 26, 2020 20:33
@Myoldmopar
Copy link
Member

Change makes sense, I'm not sure why CI had trouble. Do you anticipate appending a unit test to this fix?

@shorowit
Copy link
Contributor Author

I wasn't planning on creating a unit test given it's a minor warning bugfix. There is an IDF in the linked GitHub issue that can be used to demonstrate the fix.

@Myoldmopar
Copy link
Member

This is totally fine. I verified the fix locally. I'm not sure why CI is struggling with this minimal commit. I'm hesitant to merge. I'll just push one more commit merging develop in and we'll see if it stalls again.

@Myoldmopar
Copy link
Member

All good, merging. Thanks @shorowit

@Myoldmopar Myoldmopar merged commit a623449 into develop Jun 30, 2020
@Myoldmopar Myoldmopar deleted the kiva_perimeter_warning branch June 30, 2020 12:59
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Defect Includes code to repair a defect in EnergyPlus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants