-
Notifications
You must be signed in to change notification settings - Fork 460
Protect WSHP from incorrect or missing curve names #11028
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
Conversation
|
Defect file previously crashed and showed a blank err file. This file now exits gracefully and err file shows cause of crash: |
| EXPECT_NE(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedEntAirWetbulbTemp, DataSizing::AutoSize); | ||
| state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).HeatCapCurve = nullptr; | ||
| state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).HeatPowCurve = nullptr; | ||
| WaterToAirHeatPumpSimple::CheckSimpleWAHPRatedCurvesOutputs(*state, state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).Name); |
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.
Check that function does not crash with null curve pointers.
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.
Excellent.
|
|
||
| } else if (wahp.WAHPType == WatertoAirHP::Heating) { | ||
| if (wahp.RatedEntAirDrybulbTemp != DataSizing::AutoSize) { | ||
| if (wahp.RatedEntAirDrybulbTemp != DataSizing::AutoSize && wahp.HeatCapCurve != nullptr && wahp.HeatPowCurve != nullptr) { |
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.
Issue correction is here on these 3 lines above in function CheckSimpleWAHPRatedCurvesOutputs
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.
Got it. The function will be fine skipping this part, because it doesn't need to check the curves that don't exist.
Myoldmopar
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 great to me, I'm happy to get this tested and merged.
| // Jin, H. 2002. Parameter Estimation Based Models of Water Source Heat Pumps. Phd Thesis. | ||
| // Oklahoma State University. | ||
|
|
||
| using namespace DataLoopNode; |
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.
Getting rid of using...yes.
| using BranchNodeConnections::TestCompSet; | ||
| using GlobalNames::VerifyUniqueCoilName; | ||
| using PlantUtilities::RegisterPlantCompDesignFlow; | ||
| using namespace OutputReportPredefined; |
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.
Getting rid of using...yes.
| int PlantOutletNode; | ||
| Real64 rho; // local fluid density | ||
| Real64 Cp; // local fluid specific heat | ||
| bool errFlag; |
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.
Localized variables...yes.
| RatedAirVolFlowRateDes); | ||
| } else { | ||
| if (simpleWatertoAirHP.RatedAirVolFlowRate > 0.0 && RatedAirVolFlowRateDes > 0.0 && !HardSizeNoDesRun) { | ||
| if (simpleWatertoAirHP.RatedAirVolFlowRate > 0.0 && RatedAirVolFlowRateDes > 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.
I see, this is already inside the !HardSizeNoDesRun if condition, so no need to extra check it.
|
|
||
| } else if (wahp.WAHPType == WatertoAirHP::Heating) { | ||
| if (wahp.RatedEntAirDrybulbTemp != DataSizing::AutoSize) { | ||
| if (wahp.RatedEntAirDrybulbTemp != DataSizing::AutoSize && wahp.HeatCapCurve != nullptr && wahp.HeatPowCurve != nullptr) { |
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.
Got it. The function will be fine skipping this part, because it doesn't need to check the curves that don't exist.
| EXPECT_NE(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedEntAirWetbulbTemp, DataSizing::AutoSize); | ||
| state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).HeatCapCurve = nullptr; | ||
| state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).HeatPowCurve = nullptr; | ||
| WaterToAirHeatPumpSimple::CheckSimpleWAHPRatedCurvesOutputs(*state, state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).Name); |
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.
Excellent.
|
This is good, thanks @rraustad, merging. |
Pull request overview
Description of the purpose of this PR
Incorrect curve name leads to a crash when curves are evaluated in function CheckSimpleWAHPRatedCurvesOutputs.
Pull Request Author
Reviewer