Skip to content
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

Cooling Panel UA Calculation Bug for Large Capacity/Low Water Flow Rate #6181

Merged
merged 10 commits into from Aug 19, 2017

Conversation

RKStrand
Copy link
Contributor

Pull request overview

This pull request includes changes to fix the defect User file with large ZoneHVAC:CoolingPanel:RadiantConvective:Water crashes in UA calculation (Issue #6098). In the defect input file, the user had entered a large unit capacity but used a fairly small flow rate. The result was that the panel would have a better than 100% efficiency for heat transfer and led to a hard crash of EnergyPlus. The fix traps this and lets the user know how to correct the situation. In addition to a new unit test, the I/O Reference was modified to clarify the relationship between different input parameters and also their intent.

Work Checklist

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

Review Checklist

This will not be exhaustively relevant to every PR.

  • Code style (parentheses padding, variable names)
  • Functional code review (it has to work!)
  • If defect, results of running current develop vs this branch should exhibit the fix
  • CI status: all green or justified
  • Performance: CI Linux results include performance check -- verify this
  • Unit Test(s)
  • C++ checks:
    • Argument types
    • If any virtual classes, ensure virtual destructor included, other things
  • IDD changes:
    • Verify naming conventions and styles, memos and notes and defaults
    • Open windows IDF Editor with modified IDD to check for errors
    • If transition, add rules to spreadsheet
    • If transition, add transition source
    • If transition, update idfs
  • If new idf included, locally check the err file and other outputs
  • Documentation changes in place
  • Changed docs build successfully
  • ExpandObjects changes?
  • If output changes, including tabular output structure, add to output rules file for interfaces

This commit corrects the bug by checking for the condition that caused
the crash and gracefully exiting out with a severe/fatal error and
helpful hints as to how to fix the problem.  The commit also contains
corrections to the documentation to better describe the input fields
and how to avoid the problem that was discovered in the code.
Addition of a unit test for this bug fix to verify that the fix is
working properly and the bad cases will produce an error message rather
than crash the program.
@RKStrand RKStrand requested a review from mjwitte June 21, 2017 01:20
@jasondegraw jasondegraw self-assigned this Jun 29, 2017
@jasondegraw jasondegraw added the Defect Includes code to repair a defect in EnergyPlus label Jun 29, 2017
@jasondegraw jasondegraw added this to the EnergyPlus 8.8.0 milestone Jun 29, 2017
Copy link
Member

@jasondegraw jasondegraw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple small things that I picked on, but other than that it looks good.

@@ -571,15 +571,15 @@ \subsubsection{Inputs}\label{inputs-3-028-1}

\paragraph{Field: Rated Water Mass Flow Rate}\label{field-rated-water-mass-flow-rate}

This field is the rated standard water flow rate in kg/s that was used to obtain the rated capacity under rated conditions. This value along with the other rated conditions is used to calculate the overall heat transfer coefficient (U-Value) that will be used to characterize the heat transfer between the water being circulated through the panel and the air in the space. The default value is 0.063kg/s (1 gpm). If it is blank or zero, the default value is assumed.
This field is the rated standard water flow rate in kg/s that was used to obtain the design cooling capacity under rated temperature conditions. This value along with the rated space and water inlet temperatures as well as the cooling capacity (whether autosized or entered by the user) to calculate the overall heat transfer coefficient (U-Value) that will be used to characterize the heat transfer between the water being circulated through the panel and the air in the space. Users should note that if this value is too low in comparison to the cooling design capacity that the program will produce an error message and the user must adjust one of these two parameters or the rated temperature values. The default value is 0.063kg/s (1 gpm). If it is blank or zero, the default value is assumed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that perhaps the second sentence here needs a "is used" someplace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasondegraw I agree...I thought I had commented on this earlier and it is not showing up here now. Anyway, yes, I will correct this as soon as possible.

void
SizeCoolingPanelUA(
int const CoolingPanelNum,
bool & SizeUAError
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we change this function so rather than returning the error status via the reference it returns true on success and false on failure? It's a more "C++" way of doing this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasondegraw Any objections to lumping this comment together with some other C++ modifications that have been requested? That is already the subject for Followup for new cooling panel ZoneHVAC:CoolingPanel:RadiantConvective:Water (GitHub Issue #5823).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RKStrand That sounds good to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RKStrand I think maybe I was unclear on what I was suggesting here, sorry if that was the case. What I was suggesting here was to change the function signature to bool SizeCoolingPanelUA(int const CoolingPanelNum) rather than use a reference.

Fixed issues noted in review
Missed a flag assignment that should have been flipped with the switch
from an Error flag to a Success flag.  Really won’t make any difference
but this keeps it in line with the design of the original fix.
@RKStrand
Copy link
Contributor Author

@jasondegraw @mjwitte Ok, I decided (after putting additional language in the other defect description) to just go ahead and fix this now. So, the documentation was altered to fix the missing words and the code was updated as Jason requested. So, hopefully this is ready to go. Let me know if there is anything else that needs to be fixed/adjusted. Thanks!

@RKStrand
Copy link
Contributor Author

@jasondegraw @mjwitte Ok, all of the review comments have been included and this is ready for final review. I did end up correcting the documentation and making the OO change in the flag that Jason requested. Thanks for your help with this!

@RKStrand
Copy link
Contributor Author

RKStrand commented Aug 1, 2017 via email

@jasondegraw
Copy link
Member

@RKStrand Yes, that is what I am suggesting. It is typical in C++ code to see functions that can "fail" return a boolean status. That doesn't mean the function is doing more than one thing, though. It's just reporting the result of the function call in a better way.

@RKStrand
Copy link
Contributor Author

RKStrand commented Aug 1, 2017

@jasondegraw OK, so even though the "function" is doing other calculations that will be stored in the data structure for the cooling panel, I can (should) define this as a bool function. I will go ahead and do that and let you know when that is finished. Hopefully it won't be too long.

Another series of changes to address review comments from Jason.
Hopefully this corrects the issue that he noted.
@RKStrand
Copy link
Contributor Author

RKStrand commented Aug 1, 2017

@jasondegraw I have committed some additional changes that should work and address the issue (I hope). It seems to be working so if all the checks pass and you are happy with this, please complete the review and merge. Thanks!

SizeCoolingPanelUA(
int const CoolingPanelNum
)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spacing severely messed up here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was messed up. Fixed now.


}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a tab here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also deleted the extra tab here and a couple other places in this new routine.

Real64 MDot;
Real64 MDotXCp;
Real64 Qrated;
Real64 Tinletr;
Real64 Tzoner;
Real64 RatCapToTheoMax; // Ratio of unit capacity to theoretical maximum output based on rated parameters

SizeCoolingPanelUA = true;
Cp = 4120.0; // Just an approximation, don't need to get an exact number
Copy link
Contributor

@rraustad rraustad Aug 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we need an exact number if a few lines below we test for RatCapToTheoMax < 1.0 ?? What if RatCapToTheoMax is 1.0001 because we weren't accurate on Cp?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rraustad Well, I see your point that perhaps this needs a bit of tolerance in here. This is mostly to trap the clearly illogical. I will outline something in response to your next comment.

Cp = 4120.0; // Just an approximation, don't need to get an exact number
MDot = CoolingPanel( CoolingPanelNum ).RatedWaterFlowRate;
MDotXCp = Cp * MDot;
Qrated = CoolingPanel( CoolingPanelNum ).ScaledCoolingCapacity;
Tinletr = CoolingPanel( CoolingPanelNum ).RatedWaterTemp;
Tzoner = CoolingPanel( CoolingPanelNum ).RatedZoneAirTemp;
RatCapToTheoMax = std::abs(Qrated) / ( MDotXCp * std::abs( Tinletr - Tzoner ) );
if (RatCapToTheoMax >= 1.0 ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't RatCapToTheoMax = 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rraustad Two reasons. First because physically you can't get more heat transfer out of the fluid than physically possible. Having a ratio of higher than 1 means that the exit temperature of the water leaving the panel would be warmer than the room temperature, violating the 2nd Law. Second because in the code following this it would take the log of a zero or negative number which would cause a crash. Basically the user is setting up a cooling panel that is better than a perfect heat transfer device using rated input that does not make sense. Admittedly, with a fixed Cp number this could result if the user is "flying to close to the sun". I will adjust the code to be a little more gracious but also to limit the RatCaptoTheoMax number to something that will still allow a calculation. So, it will only trap things when there is really a problem with the input.

ShowContinueError( "Check the rated input for temperatures, flow, and capacity for this unit." );
ShowContinueError( "The ratio of the capacity to the rated theoretical maximum must be less than unity." );
ShowContinueError( "The most likely cause for this is probably either the capacity (whether autosized or hardwired) being too high or the rated flow being too low." );
SizeCoolingPanelUA = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the water temp < zone temp? Just saying there could be more information here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rraustad I'll add some more text to the error message to help the user more. By the way, right after this, there is an error check regarding the temperatures but I will add something to the error message you highlighted to discuss temperatures as well.


\paragraph{Field: Cooling Design Capacity Method}\label{field-cooling-design-capacity-method-2}

Enter the method used to determine the heating design capacity for scalable sizing. Input allowed is either \emph{CoolingDesignCapacity}, \emph{CapacityPerFloorArea}, and \emph{FractionOfAutosizedCoolingCapacity}. If this input field is left blank or zero, then autosizing is assumed. \emph{CoolingDesignCapacity} means the user specifies the magnitude of maximum or nominal cooling capacity or the program calculates the maximum or nominal design cooling capacity if autosize is specified. \emph{CapacityPerFloorArea} means the program calculates the design cooling capacity from the user specified cooling capacity per floor area and floor area of the zone served by the cooling panel unit. \emph{FractionOfAutosizedCoolingCapacity} means the program calculates the design cooling capacity from user specified fraction and the auto-sized design cooling capacity. The default method is \emph{CoolingDesignCapacity}.

\paragraph{Field: Cooling Design Capacity}\label{field-cooling-design-capacity-2}

This field is for the cooling panel unit nominal cooling capacity in watts. This field can be autosized by EnergyPlus. When the Cooling Design Capacity Method is \emph{CoolingDesignCapacity}~ and this input is is blank, autosizing is assumed. Design day sizing run must be specified.
This field is for the cooling panel unit nominal cooling capacity in watts at the rated flow rate of water through the unit (see Rated Water Mass Flow Rate field above). This field can be autosized by EnergyPlus. When the Cooling Design Capacity Method is \emph{CoolingDesignCapacity}~ and this input is is blank, autosizing is assumed. Design day sizing run must be specified.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if another commit is required, this text could be corrected. "is is"

... and this input is is blank, autosizing is assumed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rraustad I see it and will correct it. Need to make another commit to add things to the code per your other comments so this will get in.

Clarified error messages and added additional logic to trap other
potential problems in the UA calculation.  Also modified docs (was
actually a problem in several places where “is is” mistake was made—all
were corrected in this file.
@RKStrand
Copy link
Contributor Author

@rraustad Ok, I have another commit that improves based on what you suggested and also fixes the "is is" doc problem (which actually showed up in several places--I did a Find and fixed them all in this file). I also merged with develop and the test suite is running. Hopefully this takes care of things and this is now ready to officially merge. Thanks for reviewing this!

@jasondegraw jasondegraw removed their assignment Aug 17, 2017
@jasondegraw
Copy link
Member

@Myoldmopar @mjwitte I believe that @RKStrand has addressed all of the comments and this is ready to merge. I'm going to assign you instead of me because this PR has no input changes and can drop in whenever you think is best.

@rraustad
Copy link
Contributor

Diff's are either DELight, get_bucket - head_bucket, or invalid string position. This looks OK.

@rraustad rraustad merged commit 27bea93 into develop Aug 19, 2017
@rraustad rraustad deleted the 147520311-CoolingPanelUACalcBug branch August 19, 2017 02:31
@rraustad
Copy link
Contributor

Reviewed, merged, and closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Defect Includes code to repair a defect in EnergyPlus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants