Protect WSHP from incorrect or missing curve names#11028
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.
Check that function does not crash with null curve pointers.
|
|
||
| } 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.
Issue correction is here on these 3 lines above in function CheckSimpleWAHPRatedCurvesOutputs
There was a problem hiding this comment.
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.
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; |
| using BranchNodeConnections::TestCompSet; | ||
| using GlobalNames::VerifyUniqueCoilName; | ||
| using PlantUtilities::RegisterPlantCompDesignFlow; | ||
| using namespace OutputReportPredefined; |
| int PlantOutletNode; | ||
| Real64 rho; // local fluid density | ||
| Real64 Cp; // local fluid specific heat | ||
| bool errFlag; |
| 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.
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.
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); |
|
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