-
Notifications
You must be signed in to change notification settings - Fork 457
Fix 10802 - Divide by zero error #11348
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
base: develop
Are you sure you want to change the base?
Fix 10802 - Divide by zero error #11348
Conversation
mitchute
left a comment
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 looks right.
| PartLoadFrac = ReqOutput / FullOutput; | ||
| if (FullOutput != 0) { | ||
| PartLoadFrac = ReqOutput / FullOutput; | ||
| } |
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 is likely a reason (a developer oversight) that FullOutput has not been calculated. Usually FullOutput is set near the beginning of this function when PLR is set to 1 and the system capacity is checked to see if that capacity exceeds the load, otherwise PLR = 1 and more calculations are not needed. See line 13249, 13681 and 13732. One thing is for sure, if this function is iterating with SolveRoot then the system does have a non-zero FullOutput (or maybe the coil is scheduled off? but I would think that would be caught early). To figure out the why you would need to step through this function at the time the error occurred.
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.
@rraustad I believe this catches the issue noted, but I'll hold this open for a little bit in case you want to take another quick look for any other higher level issues.
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 added at line 14133:
if (OutletHumRatLS > DesOutHumRat) {
CycRatio = 1.0;
this->m_CoolingSpeedNum = std::max(1, this->m_CoolingSpeedNum); <-- new line since speedNum was 0
for (int speedNum = this->m_CoolingSpeedNum; speedNum <= this->m_NumOfSpeedCooling; ++speedNum) {
The reason SolveRoot was failing was that a sensible load did not exist and FullOutput was not calculated and remained 0 from initialization (line 12999). There was, however, a latent load when there should NOT have been a latent load given these inputs. Adding the line above did allow SolveRoot to find the correct PLR and no longer fails with SolFla = -2. But there is another logic issue somewhere, I have not found that yet. I guess this change is OK but avoiding this calculation if FullOutput = 0 is not really the correct thing to do (because calling SolveRoot means the system is trying to meet a load and therefore the system should have a non-zero capacity) since if SolveRoot does fail with -2 then PLR will default to 0 and it would be prudent to at least try to find an operating PLR, as faulty as this could be (i.e., trying to find PLR based on PartLoadFrac = ReqOutput / FullOutput).
CoilSystem:Cooling:DX,
GUID11_SYS0SCC-1System,
None, !- Dehumidification Control Type
Yes, !- Run on Sensible Load
No, !- Run on Latent Load
CoilSystem:Cooling:DX,
A10, \field Run on Latent Load
\type choice
\key Yes
\key No
\default No
\note If Yes, unit will run if there is a latent load.
\note even if there is no sensible load.
\note If No, unit will not run only if there is a latent load.
\note Dehumidification controls will be active if specified.
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 more important point is that SolveRoot should never fail with -2. That in itself is a developer error.
|
Ah, there are 2 CoilSystem objects in this file. One uses humidity control and the other does not. So my comment about a logic issue was incorrect. I would still add the new line in this comment so that SolveRoot does not fail with -2. |
|
Added the new line from this comment |
Pull request overview
Description of the purpose of this PR
I was able to recreate this in unit tests for DX coils and variable speed DX coils using values from the original defect file. It looks like PartLoadFrac already defaults to 0 so I just added some divide by zero checks.
Pull Request Author
Reviewer