-
Notifications
You must be signed in to change notification settings - Fork 425
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 Site:Precipitation divide-by-zero #8040
Fix Site:Precipitation divide-by-zero #8040
Conversation
…itation annual precip input is zero.
…o catch the Rainfall current rate divide by zero bug.
…nnual rainfall condition.
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.
A couple very quick changes requested, and then a more broad question about the static variables inside the water manager. I realize that probably falls into the scope of a follow-on issue/PR.
src/EnergyPlus/WaterManager.cc
Outdated
if (RainFall.NomAnnualRain > 0.0){ | ||
ScaleFactor = RainFall.DesignAnnualRain / RainFall.NomAnnualRain; | ||
} | ||
else { |
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.
If you could plop the else {
up right after the }
that would be great. This change makes great sense.
@@ -189,6 +189,7 @@ set( test_src | |||
Vector.unit.cc | |||
VentilatedSlab.unit.cc | |||
WaterCoils.unit.cc | |||
WaterManager.unit.cc |
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.
Another new unit test file, this is great. I went to see if there was a clear_state in the water manager, but there isn't -- because the water manager doesn't hold any global state....at least that's how it "appears". There are a number of static variables inside functions inside WaterManager that could cause the simulation state to go haywire. I would like to see those extracted into the global state and a new clear_state method that will call it to reset the water manager. It doesn't necessarily have to be in this PR, but if not, then in a quick follow-up PR. And if you aren't able to accommodate it right now, I'll open a PR and do it.
|
||
WaterManager::GetWaterManagerInput(); | ||
|
||
ScheduleManager::Schedule.allocate(1); |
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'm not sure what this line is doing. The GetWaterManagerInput
function calls GetScheduleIndex
, which allocates and sets up the schedule array. This line is doing nothing I think. Please take it out, it should still work perfectly.
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.
Ah I think you're right. I don't need to allocate a second time here. Ill remove this.
Real64 CurrentRate = DataWater::RainFall.CurrentRate; | ||
EXPECT_NEAR(CurrentRate, ExpectedCurrentRate, 0.000001); | ||
|
||
ScheduleManager::Schedule.deallocate(); |
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.
This deallocate isn't necessary. The schedule manager's state is cleared after each unit test, and the deallocate is happening over there.
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.
Roger that. These will be removed.
EXPECT_NEAR(CurrentRate, 0.0, 0.000001); | ||
|
||
ScheduleManager::Schedule.deallocate(); | ||
} |
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.
Same comments about allocate/deallocate, but these are great unit tests!
Something went awry with the Mac unit test. A hybrid unit test failed. Any thoughts why? I will re-run Mac just to make sure, but that doesn't look to be one of the ones we tend to have issues with. |
I just noticed you had noted my comments but not made the changes yet anyway. No problem at all, I was just going to be moving to final review if CI was all happy and the changes were made. Carry on... |
@Myoldmopar Hey Edwin. Yeah sorry for the delay with pushing things up. The hybrid unit test passes on my Mac so im not quite sure whats going on with the CI there. Nothing we have done here should effect that code. All of the changes you mentioned have been made on my local branch except for the static variables/ clear_state function. I was waiting to get a chance to speak with Neal about what I was proposing to do there, but since that change is less related to this, I will push the other changes up and see if the failed unit tests are a false positive. |
@Myoldmopar Looks like pushing your requested changes caused those failed tests to go away. |
Everything looks great now. Thanks for addressing my comments, and CI is happy. Merging. |
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.