-
Notifications
You must be signed in to change notification settings - Fork 396
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
EnergyPlus Crash Due to Zero Input Value for Variable Speed Coil Total Cooling #10410
Conversation
A divide by zero was leading to an infinite loop in the variable speed coil algorithm (infinite loop was actually in psychrometric routines). This is the solution and unit test.
The new subroutine was too aggressive (in theory) and resulted in some diffs and other failures. This will hopefully get rid of those issues and still solve the problem.
It didn't like a couple of error calls. Fixed now.
Another case of this was fine a little while ago but now it isn't?
Some of the cleanup changes to the code seemed to be causing problems in the unit tests. Also, the previous version did not exclude autosizing cases which caused unit test issues as well. Hopefully this fixes the original issue without breaking other things.
Cleaned up code in input sections that use the new check.
Remaining planned changes to VarSpeedCoil get input routine that were made previously but then backed out because problems were occurring.
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 100% certain that this is the correct fix. My understanding of the variable sped coils is that the various capacities are the different speeds are intended to be scaled by the top-level Gross Rated Total Cooling Capacity At Selected Nominal Speed Level. That's how the I/O Ref describes it:
Based on that I would expect a zero input here to give zero capacity at all speeds. When it's dividing by zero, is it zero/zero there? A warning about zero capacity is still useful.
Also, do you recall which Psych function is going into an infinite loop? Seems that should be protected somehow, if there's a way without slowing down the psych function too much. That could be a separate unit test that throws the same bad values at the psych function?
@@ -3878,6 +3325,23 @@ namespace VariableSpeedCoils { | |||
} | |||
} | |||
|
|||
void checkVarSpeedCoilCoolCap(EnergyPlusData &state, std::string coilName, Real64 const highestSpeedCoolCap, Real64 &totalCoolCap) |
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.
@RKStrand Is this the only substantive change? A walkthrough highlighting the real changes would be helpful.
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.
Yes, that is the only real change--a call to this new routine to sort out the issue as I saw it.
@mjwitte First off, my apologies for a description that was unclear at best and probably confused the issue. So, let me backtrack and correct that... A user had a file that included a variable speed coil. The coil had 10 different speeds. From my analysis, the ten different speed definitions made sense. What did not make a whole lot of sense was that the total cooling capacity was set to zero rather than autosized or set to the same capacity as the maximum speed capacity. When that happened, if I'm remembering correctly, either the top speed capacity got reset or one of the calculations was using the total capacity to calculate the fraction. That's where the divide by zero came in. I'm trying to track that down again now. The fix I proposed simply resetting the total capacity when it was less than or equal to zero but not Autosize to the highest speed capacity. I guess it could be set to autosize as an alternative. The rest of the changes in the routine were cosmetic/modernization. While well intended, I can see how it might mask the point of this fix. So, without the fix, E+ got stuck in an infinite loop (more on that in a minute). If you change the 0 total cooling capacity to autosize or the same as the highest speed capacity, it runs just fine. If the total capacity is zero though, a divide by zero occurs and rather than giving a divide by zero right on the spot, E+ continues to move along until it gets stuck in the variable speed coil simulation in an infinite loop. I said psychrometric routine earlier because when I paused in debugger that's where it is. But that's not really where it gets stuck--the psychrometric routine is just being called by the variable speed coil. So, I don't think there is anything wrong with the psychrometric routine (sorry for making that confusing). It's actually bogged down in a sizing routine that is part of the init. Does that help any? Do you still have concerns about this solution? |
@RKStrand for 1) I think we should allow any component to have 0 capacity or flow to allow the user to eliminate it from the simulation, and 2) if the autosized cooling load = 0 then the coil capacity will also = 0. I see coils sizing to 0 quite often, especially heating coils. |
@RKStrand the desription implies that it was the user input for rated capacity that was set to 0, and only at the highest speed. Whether that is a mistake or intentional, for this corner case, it should be handled. How is another question. Reduce to a 9 spd coil? Set all operating capacities to 0? I think we should avoid changing the users input. |
Either the user wanted a 0 coil capacity or completely missed this input. This coil should have 0 capacity.
If any of these inputs are 0 then the capacity at that speed will also be 0 and is related to this discussion. This input provides a multiplier of total capacity at speed n so no divide by 0 issue. Is there a check of reference speed n capacity > reference speed n-1 capacity?
|
@rraustad @mjwitte So, based on what I am hearing from both of you, there is a desire to allow the user to easily eliminate a coil from the simulation by setting the total capacity to 0 which would override all of the remaining input. In the case of the user input file, the zero overall capacity would eliminate all 10 of the speeds and the coil would never operate. I will back out the current solution that sets the capacity to the capacity of the highest speed and implement a new solution that will do what you have asked. Not sure this will make the cutoff for V24.1, but I don't think that's a big deal at this point if it doesn't make it. |
CI was totally green here. But it looks like it may need a bit more time to wrap things up. I'm going to push this to after release for now, but am open to squeezing it in still if it becomes all ready. @RKStrand thank you for the refactor/cleanup here as well! I would ask that you put the bug fix in a standalone commit that I can inspect/checkout/test, and then any cleanup commits you want to make after, or before, that. I won't do a deep review today, but if this is all ready sometime next week, we may still get it in for 24.1. |
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.