-
Notifications
You must be signed in to change notification settings - Fork 392
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
Fix #9331 - Crash if window construction is zero due to bad construction name #9646
Conversation
```shell [ RUN ] EnergyPlusFixture.Wrong_Window_Construction energyplus_tests: /home/julien/Software/Others/EnergyPlus/third_party/ObjexxFCL/src/ObjexxFCL/Array1.hh:861: T& ObjexxFCL::Array1< <template-parameter-1-1> >::operator()(int) [with T = EnergyPlus::Construction::ConstructionProps]: Assertion `contains( i )' failed. ``` backtrace: ```shell frame #5: 0x00005555632f28ca energyplus_tests`EnergyPlus::SurfaceGeometry::CheckWindowShadingControlFrameDivider(state=0x000055556dc601b0, cRoutineName=(_M_len = 19, _M_str = "GetHTSubSurfaceData"), ErrorsFound=0x00007fffffffb8e6, SurfNum=2, FrameField=6) at SurfaceGeometry.cc:5972:106 5969 } // End of check if window has a construction 5970 } 5971 -> 5972 if (state.dataConstruction->Construct(state.dataSurfaceGeometry->SurfaceTmp(SurfNum).Construction).WindowTypeEQL) { 5973 if (state.dataSurfaceGeometry->SurfaceTmp(SurfNum).FrameDivider > 0) { 5974 // Equivalent Layer window does not have frame/divider model 5975 ShowSevereError(state ```
…deemed invalid, skip to the next
src/EnergyPlus/SurfaceGeometry.cc
Outdated
ErrorsFound = true; | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a problem with using a continue when "very" severe errors are found. But I wonder if there are some errors that won't show up until the user fixes the first one found. It may not be necessary to continue on some of these warnings so that as many warnings could be reported the first time through. Which one of these input errors actually causes the crash?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the sentiment here. If we could issue all 3 errors up front on the subsurface, it would be good to let the user know all 3 errors right away. Otherwise they will end up possibly running 3 iterations to solve all the issues. But I also understand the idea of wanting to avoid issues from subsequent checking. I could be swayed either way. Perhaps some extra description of the exact errors we are bypassing by each continue
would help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note: I actually have a stashed commit that went even further and wrapped every GetXXX
call inside an if (!ErrorsFound)
so it'll bail early here:
EnergyPlus/src/EnergyPlus/SurfaceGeometry.cc
Lines 1284 to 1347 in 0c3de81
GetDetShdSurfaceData(state, ErrorsFound, NumSurfs, TotDetachedFixed, TotDetachedBldg); | |
GetRectDetShdSurfaceData(state, ErrorsFound, NumSurfs, TotRectDetachedFixed, TotRectDetachedBldg); | |
GetHTSurfaceData(state, | |
ErrorsFound, | |
NumSurfs, | |
TotHTSurfs, | |
TotDetailedWalls, | |
TotDetailedRoofs, | |
TotDetailedFloors, | |
state.dataSurfaceGeometry->BaseSurfCls, | |
state.dataSurfaceGeometry->BaseSurfIDs, | |
NeedToAddSurfaces); | |
GetRectSurfaces(state, | |
ErrorsFound, | |
NumSurfs, | |
TotRectExtWalls, | |
TotRectIntWalls, | |
TotRectIZWalls, | |
TotRectUGWalls, | |
TotRectRoofs, | |
TotRectCeilings, | |
TotRectIZCeilings, | |
TotRectGCFloors, | |
TotRectIntFloors, | |
TotRectIZFloors, | |
state.dataSurfaceGeometry->BaseSurfIDs, | |
NeedToAddSurfaces); | |
GetHTSubSurfaceData(state, | |
ErrorsFound, | |
NumSurfs, | |
TotHTSubs, | |
state.dataSurfaceGeometry->SubSurfCls, | |
state.dataSurfaceGeometry->SubSurfIDs, | |
AddedSubSurfaces, | |
NeedToAddSubSurfaces); | |
GetRectSubSurfaces(state, | |
ErrorsFound, | |
NumSurfs, | |
TotRectWindows, | |
TotRectDoors, | |
TotRectGlazedDoors, | |
TotRectIZWindows, | |
TotRectIZDoors, | |
TotRectIZGlazedDoors, | |
state.dataSurfaceGeometry->SubSurfIDs, | |
AddedSubSurfaces, | |
NeedToAddSubSurfaces); | |
GetAttShdSurfaceData(state, ErrorsFound, NumSurfs, TotShdSubs); | |
GetSimpleShdSurfaceData(state, ErrorsFound, NumSurfs, TotOverhangs, TotOverhangsProjection, TotFins, TotFinsProjection); | |
GetIntMassSurfaceData(state, ErrorsFound, NumSurfs); | |
state.dataSurface->TotSurfaces = NumSurfs + AddedSubSurfaces + NeedToAddSurfaces + NeedToAddSubSurfaces; | |
if (ErrorsFound) { | |
ShowFatalError(state, std::string{RoutineName} + "Errors discovered, program terminates."); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmarrec I think I will take the offer of just reverting the commit. That will allow the fix to go in without having to worry about this new pattern. I'll revert and test it out locally to make sure, then push it up and get this merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not marking this approved or not yet, I need to think about it a bit more.
src/EnergyPlus/SurfaceGeometry.cc
Outdated
ErrorsFound = true; | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the sentiment here. If we could issue all 3 errors up front on the subsurface, it would be good to let the user know all 3 errors right away. Otherwise they will end up possibly running 3 iterations to solve all the issues. But I also understand the idea of wanting to avoid issues from subsequent checking. I could be swayed either way. Perhaps some extra description of the exact errors we are bypassing by each continue
would help.
" ..... Reference severe error count=1", | ||
" ..... Last severe error=FenestrationSurface:Detailed=\"SURFACE 8 - TRIANGULARWINDOW\", invalid Construction Name=\"WRONG CONSTRUCTION\".", | ||
}); | ||
EXPECT_TRUE(compare_err_stream(error_string, true)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
…face is deemed invalid, skip to the next" This reverts commit dcbda05.
…indow_Construction
Everything happy after reverting that. We can certainly discuss the idea of early exits, but for now this is a nice minimal change plus test. Thanks! |
Not waiting on any CI to run this, merging it in. |
Pull request overview
Pull Request Author
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
Reviewer
This will not be exhaustively relevant to every PR.