-
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
CppCheck VentilatedSlab #10838
base: develop
Are you sure you want to change the base?
CppCheck VentilatedSlab #10838
Conversation
src/EnergyPlus/VentilatedSlab.cc
Outdated
@@ -4515,12 +4340,12 @@ namespace VentilatedSlab { | |||
} else { | |||
if ((ventSlab.SysConfg == VentilatedSlabConfig::SlabOnly) || (ventSlab.SysConfg == VentilatedSlabConfig::SeriesSlabs)) { | |||
state.dataLoopNodes->Node(FanOutNode) = state.dataLoopNodes->Node(AirOutletNode); | |||
state.dataHeatBalFanSys->QRadSysSource(SurfNum) = 0.0; | |||
state.dataHeatBalFanSys->QRadSysSource = 0.0; |
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.
Reducing SurfNum showed this dangling use of that local (and below at 4348). I suspect the value of SurfNum here would be the last surface in the surface list from the previous loop (old line 4487). This seems wrong so I changed it (bc it wouldn't compile otherwise) to be what I thought it should be (i.e., all surface radiation = 0). @RKStrand ?
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.
Thanks for sending this my way to take a look at. I see now why this won't compile--not sure how it's been compiling at all before you made this change. This is definitely a bug that needs to be fixed.
The problem is that it is not as simple as getting rid of the (SurfNum). The reason that should not be done is because that array includes the source/sink inside that surface and could be affected by other systems (like low temp radiant). Zeroing them all out would basically shut down every system. What should have happened here is that the QRadSysSource array should be zeroed out only for the surfaces that are associated with this ventilated slab (which, given were these errors are happening in the code, is being turned off for no flow).
So, I think what each of these two problem lines of code need to be replaced with is:
for (RadSurfNum = 1; RadSurfNum <= ventSlab.NumOfSurfaces; ++RadSurfNum) {
SurfNum = ventSlab.SurfacePtr(RadSurfNum);
state.dataHeatBalFanSys->QRadSysSource(SurfNum) = 0.0;
}
That would then zero out the source/sink term for each of the surfaces associated with the ventilated slab without messing with any other surfaces that might be served by a different ventilated slab, radiant system, etc. that could also be setting values in the QRadSysSource array. Does this make sense/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.
That makes perfect sense. I almost did that but incorrectly thought this array was specific to this ventilated slab. I will make the suggested change. BTW, this did compile before this change and zero'd only the last surface in the list. Thanks @RKStrand.
|
Holding off on this one while we evaluate the SurfNum and regressions. |
…Check-VentilatedSlab
|
This Mac CI diffs in VentilatedSlab_SeriesSlabs are very small. I assume this is due to zeroing the radiation for all surfaces now when the slab is off instead of just the last one in the surface list. What is a little disturbing is the large number of warnings in the error file with water temps over 115 C resulting in glycol warnings. |
Pull request overview
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.
Reviewer
This will not be exhaustively relevant to every PR.