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

Produce Convexity Check Warning Only When Appropriate #10621

Merged

Conversation

RKStrand
Copy link
Contributor

Pull request overview

  • Fixes CheckConvexity throws Surface is Non-Convex warnings regardless of ShadowCalculation settings #10299
  • The convexity check is only supposed to throw a warning message when the Polygon Clipping Algorithm is employed with the ConvexWeilerAtherton algorithm for shading. Previously, this was being produced for Pixel Counting and other shading algorithms inappropriately. The code was modified to match the intent of the documentation and the warning messages being produced by the code. The solution required that the get routine for the Shadowing Calculation input be separated from some of the processing that is done and the get routine had to be moved up in the order of simulation. After the fix, the only differences in the results are a change in order of a couple of lines in the EIO file (change in order, not in values in the report). All other output is identical to before the fix as anticipated. Six new unit tests look at various combinations of input to make sure things are being read in and set properly.

NOTE: ENHANCEMENTS MUST FOLLOW A SUBMISSION PROCESS INCLUDING A FEATURE PROPOSAL AND DESIGN DOCUMENT PRIOR TO SUBMITTING CODE

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

RKStrand added 15 commits July 10, 2024 06:30
This commit splits GetShadowingInput into two separate routines and will test to see if the split has been done correctly.  The split is important because the actual getting of the input needs to be moved up in the order of calls to resolve this defect, but some of the processing needs to stay where it is at because it needs zones and surfaces read in.
The previous version of GetShadowingInput obtained the ShadowCalculation input but then also did some processing.  In order to solve #10299, these needed to be separated so that when surfaces are read in that it knows the ShadowCalculation input and thus can produce error messages appropriately.  This commit separates the two parts of the previous routine into two routines which are now called at the appropriate places.  The next step will be to implement the solution and create a unit test.
Fix to the problem.  Testing reveals that the code now does what it is supposed to do.  Also, reversed some changes to an existing unit test as the changes were causing some issues in the test suite.  Hopefully this makes those issues disappear.
Addition of new unit tests and fixes to the one that doesn't work properly for Windows (experimental solution based on surrounding code).  If this works, this is a potential pull request version.
Backed out something that was tried but resulted in more issues.
Correction of enum comparisons to eliminate errors in energyplus_tests
An error message was being skipped because of the movement of the Get part of the old routine.  anyScheduledShadingSurface was not set yet so the error message was never produced.  This change should fix this problem and eliminate the change in the .err file for SolarShadingTestGPU.idf.
A couple of issues were seen in ci results.  This commit is an attempt to fix them.
Last round was closer to getting rid of all of the unit test fails.  Hopefully this gets everything fixed up and ready to go.
A get flag was added early on during work on this defect.  It is not necessary and may be causing some issues with API runs.  Even if that isn't the problem, there is no reason to keep this flag/code--it's unnecessary.
@RKStrand RKStrand added the Defect Includes code to repair a defect in EnergyPlus label Jul 23, 2024
@RKStrand RKStrand added this to the EnergyPlus 24.2 milestone Jul 23, 2024
@RKStrand RKStrand requested review from Myoldmopar and mjwitte July 23, 2024 21:58
@RKStrand RKStrand self-assigned this Jul 23, 2024
Missed clang formatting on a file...
bool DisableSelfShadingBetweenGroup = false;

int shadingGroupsNum = 0; // number of shading groups
Array1D_string zoneName; // array of zone names in user input
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems odd that all of these shading variables are in DataSystemVariables instead of SolarShading. I'm not suggesting you have to move these in this PR, but 'zoneName' needs to be more specific, like shadingGroupZoneListNames.

Also, if you make this a std::vector and push to it when reading the input, then you can use it's size and drop shadingGroupsNum.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I don't know why these are in DataSystemVariables and not SolarShading. I guess I was looking to solve the problem and wasn't too concerned about the location of the variables (thought there must have been some reason--probably not a great assumption).

So, just to clarify and get this to move forward...you would like to see the zoneName changed to shadingGroupZoneListNames. You would also like to see this converted to a vector as part of this work?

Copy link
Contributor

@mjwitte mjwitte Jul 24, 2024

Choose a reason for hiding this comment

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

So, just to clarify and get this to move forward...you would like to see the zoneName changed to shadingGroupZoneListNames.

Yes, please.

You would also like to see this converted to a vector as part of this work?

That's up to you for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Variable name change made in the latest commit. Hopefully the ci comes back with all green as before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, after some back and forth and some weird goings on yesterday, the variable name change has been made and ci is coming back like it should with only the EIO changes (only changes in the info location--values the same). All good?

if (Found != 0) DisableSelfShadingGroups(i) = Found;
}

for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; SurfNum++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is existing code, and it's not a frequently used option, but this could be so much more efficient. Instead of looping through all of the zonegroups for each surface, this could simply go through the zones in each zonelist and loop over the exterior surrfaces in each zone (Zone.vZoneHTSurfaceList). Mostly just noting this here, since this seemingly simple fix has already had a lot of scope creep.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that this would be much more efficient. I'd like to have us make a mental note of this and deal with it at a later date if you are okay with that. I wonder if there are more places where we could be much more efficient and we don't even realize it. If only we all had the time to do that sort of efficiency review in the code...

RKStrand added 5 commits July 24, 2024 15:25
Addressed review request to change the name of a variable to be more descriptive.
Something not quite right about this simply variable name change.  Things went from expected diffs only to "unexpected" diffs.
Trying again to rename a variable.  This seemed to cause a lot of issues yesterday, but was that because of changes to develop that were happening at the same time?
@RKStrand RKStrand requested a review from mjwitte July 25, 2024 15:49
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'm fine with holding off on the efficiency refactor that was brought up by @mjwitte. Let's just try to get this merged if it's ready. I'll test it out.

@Myoldmopar
Copy link
Member

Yeah, it's all testing fine, and CI is all happy. I'll merge this one. Thanks @RKStrand

@Myoldmopar Myoldmopar merged commit 18f5c3f into develop Jul 25, 2024
15 checks passed
@Myoldmopar Myoldmopar deleted the 10299CheckConvexityChangeCheckForShadowCalculations branch July 25, 2024 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

CheckConvexity throws Surface is Non-Convex warnings regardless of ShadowCalculation settings
8 participants