-
Notifications
You must be signed in to change notification settings - Fork 398
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
Fix #10817 - Avoid crash in FluidCooler/EvaporativeFluidCooler when Water flow rate autosized and no Sizing:Plant #10855
base: develop
Are you sure you want to change the base?
Changes from all commits
316d5ae
a003e07
61c4c5d
93c4e0b
dee7e5b
6932358
9e8586b
b02725a
23fa180
a179c0d
4aaa7c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1338,14 +1338,10 @@ namespace EvaporativeFluidCoolers { | |
Real64 constexpr Acc(0.0001); // Accuracy of result | ||
std::string const CalledFrom("SizeEvapFluidCooler"); | ||
|
||
int SolFla; // Flag of solver | ||
Real64 UA; // Calculated UA value [W/C] | ||
Real64 OutWaterTempAtUA0; // Water outlet temperature at UA0 | ||
Real64 OutWaterTempAtUA1; // Water outlet temperature at UA1 | ||
Real64 DesignEnteringAirWetBulb; // Intermediate variable to check that design exit | ||
// temperature specified in the plant:sizing object | ||
// is higher than the design entering air wet-bulb temp | ||
// when autosize feature is used | ||
int SolFla; // Flag of solver | ||
Real64 UA; // Calculated UA value [W/C] | ||
Real64 OutWaterTempAtUA0; // Water outlet temperature at UA0 | ||
Real64 OutWaterTempAtUA1; // Water outlet temperature at UA1 | ||
|
||
Real64 DesEvapFluidCoolerLoad = 0.0; // Design evaporative fluid cooler load [W] | ||
Real64 tmpDesignWaterFlowRate = this->DesignWaterFlowRate; | ||
|
@@ -1356,6 +1352,33 @@ namespace EvaporativeFluidCoolers { | |
|
||
if (this->DesignWaterFlowRateWasAutoSized && this->PerformanceInputMethod_Num != PIM::StandardDesignCapacity) { | ||
if (PltSizCondNum > 0) { | ||
|
||
// Check when the user specified Condenser/Evaporative Fluid Cooler water design setpoint | ||
// temperature is less than design inlet air wet bulb temperature | ||
Real64 DesignEnteringAirWetBulb = 0; | ||
if (this->PerformanceInputMethod_Num == PIM::UFactor) { | ||
DesignEnteringAirWetBulb = 25.6; | ||
} else { | ||
DesignEnteringAirWetBulb = this->DesignEnteringAirWetBulbTemp; | ||
} | ||
if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= DesignEnteringAirWetBulb) { | ||
ShowSevereError(state, format("Error when autosizing the UA value for Evaporative Fluid Cooler = {}.", this->Name)); | ||
ShowContinueError(state, | ||
format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air wet-bulb temperature " | ||
"({:.2R} C) when autosizing the Evaporative Fluid Cooler UA.", | ||
state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, | ||
DesignEnteringAirWetBulb)); | ||
ShowContinueError( | ||
state, | ||
"It is recommended that the Design Loop Exit Temperature = Design Entering Air Wet-bulb Temp plus the Evaporative " | ||
"Fluid Cooler design approach temperature (e.g., 4 C)."); | ||
ShowContinueError( | ||
state, | ||
"If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design Setpoint must be " | ||
"> Design Entering Air Wet-bulb Temp if autosizing the Evaporative Fluid Cooler."); | ||
ShowFatalError(state, "Review and revise design input values as appropriate."); | ||
} | ||
|
||
if (state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { | ||
tmpDesignWaterFlowRate = state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate * this->SizFac; | ||
if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->DesignWaterFlowRate = tmpDesignWaterFlowRate; | ||
|
@@ -1380,28 +1403,6 @@ namespace EvaporativeFluidCoolers { | |
ShowFatalError(state, "Autosizing of evaporative fluid cooler condenser flow rate requires a loop Sizing:Plant object."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Throw when PltSizCondNum is not > 0 is here. |
||
} | ||
} | ||
// Check when the user specified Condenser/Evaporative Fluid Cooler water design setpoint | ||
// temperature is less than design inlet air wet bulb temperature | ||
if (this->PerformanceInputMethod_Num == PIM::UFactor) { | ||
DesignEnteringAirWetBulb = 25.6; | ||
} else { | ||
DesignEnteringAirWetBulb = this->DesignEnteringAirWetBulbTemp; | ||
} | ||
if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= DesignEnteringAirWetBulb) { | ||
ShowSevereError(state, format("Error when autosizing the UA value for Evaporative Fluid Cooler = {}.", this->Name)); | ||
ShowContinueError(state, | ||
format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air wet-bulb temperature " | ||
"({:.2R} C) when autosizing the Evaporative Fluid Cooler UA.", | ||
state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, | ||
DesignEnteringAirWetBulb)); | ||
ShowContinueError(state, | ||
"It is recommended that the Design Loop Exit Temperature = Design Entering Air Wet-bulb Temp plus the Evaporative " | ||
"Fluid Cooler design approach temperature (e.g., 4 C)."); | ||
ShowContinueError(state, | ||
"If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design Setpoint must be " | ||
"> Design Entering Air Wet-bulb Temp if autosizing the Evaporative Fluid Cooler."); | ||
ShowFatalError(state, "Review and revise design input values as appropriate."); | ||
} | ||
} | ||
|
||
if (this->PerformanceInputMethod_Num == PIM::UFactor && !this->HighSpeedEvapFluidCoolerUAWasAutoSized) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -954,8 +954,31 @@ void FluidCoolerspecs::size(EnergyPlusData &state) | |
// Find the appropriate Plant Sizing object | ||
int PltSizCondNum = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).PlantSizNum; | ||
|
||
// This is to trap when the user specified Condenser/Fluid Cooler water design setpoint temperature is less than design inlet air dry bulb | ||
// temperature | ||
auto ensureSizingPlantExitTempIsNotLessThanDesignEnteringAirTemp = [this, &state, PltSizCondNum]() { | ||
if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= this->DesignEnteringAirTemp && state.dataPlnt->PlantFirstSizesOkayToFinalize) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it's necessary to delay until PlantFirstSizesOkayToFinalize is true, but I didn't want to change the existing behavior |
||
ShowSevereError(state, format("Error when autosizing the UA value for fluid cooler = {}.", this->Name)); | ||
ShowContinueError(state, | ||
format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air dry-bulb temperature " | ||
"({:.2R} C) when autosizing the fluid cooler UA.", | ||
state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, | ||
this->DesignEnteringAirTemp)); | ||
ShowContinueError(state, | ||
"It is recommended that the Design Loop Exit Temperature = design inlet air dry-bulb temp plus the Fluid Cooler " | ||
"design approach temperature (e.g., 4 C)."); | ||
ShowContinueError(state, | ||
"If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design Setpoint must be " | ||
"> design inlet air dry-bulb temp if autosizing the Fluid Cooler."); | ||
ShowFatalError(state, "Review and revise design input values as appropriate."); | ||
} | ||
}; | ||
|
||
if (this->DesignWaterFlowRateWasAutoSized) { | ||
if (PltSizCondNum > 0) { | ||
|
||
ensureSizingPlantExitTempIsNotLessThanDesignEnteringAirTemp(); | ||
|
||
if (state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { | ||
tmpDesignWaterFlowRate = state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate; | ||
if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->DesignWaterFlowRate = tmpDesignWaterFlowRate; | ||
|
@@ -986,23 +1009,6 @@ void FluidCoolerspecs::size(EnergyPlusData &state) | |
ShowFatalError(state, "Autosizing of fluid cooler condenser flow rate requires a loop Sizing:Plant object."); | ||
} | ||
} | ||
// This conditional statement is to trap when the user specified Condenser/Fluid Cooler water design setpoint | ||
// temperature is less than design inlet air dry bulb temperature | ||
if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= this->DesignEnteringAirTemp && state.dataPlnt->PlantFirstSizesOkayToFinalize) { | ||
ShowSevereError(state, format("Error when autosizing the UA value for fluid cooler = {}.", this->Name)); | ||
ShowContinueError(state, | ||
format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air dry-bulb temperature " | ||
"({:.2R} C) when autosizing the fluid cooler UA.", | ||
state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, | ||
this->DesignEnteringAirTemp)); | ||
ShowContinueError(state, | ||
"It is recommended that the Design Loop Exit Temperature = design inlet air dry-bulb temp plus the Fluid Cooler " | ||
"design approach temperature (e.g., 4 C)."); | ||
ShowContinueError(state, | ||
"If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design Setpoint must be " | ||
"> design inlet air dry-bulb temp if autosizing the Fluid Cooler."); | ||
ShowFatalError(state, "Review and revise design input values as appropriate."); | ||
} | ||
} | ||
|
||
PlantUtilities::RegisterPlantCompDesignFlow(state, this->WaterInletNodeNum, tmpDesignWaterFlowRate); | ||
|
@@ -1037,24 +1043,9 @@ void FluidCoolerspecs::size(EnergyPlusData &state) | |
if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->HighSpeedFanPower = tmpHighSpeedFanPower; | ||
} else if (PltSizCondNum > 0) { | ||
if (state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { | ||
// This conditional statement is to trap when the user specified Condenser/Fluid Cooler water design setpoint | ||
// temperature is less than design inlet air dry bulb temperature | ||
if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= this->DesignEnteringAirTemp && | ||
state.dataPlnt->PlantFirstSizesOkayToFinalize) { | ||
ShowSevereError(state, format("Error when autosizing the UA value for fluid cooler = {}.", this->Name)); | ||
ShowContinueError(state, | ||
format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air dry-bulb " | ||
"temperature ({:.2R} C) when autosizing the fluid cooler UA.", | ||
state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, | ||
this->DesignEnteringAirTemp)); | ||
ShowContinueError(state, | ||
"It is recommended that the Design Loop Exit Temperature = design inlet air dry-bulb temp plus the " | ||
"Fluid Cooler design approach temperature (e.g., 4 C)."); | ||
ShowContinueError(state, | ||
"If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design " | ||
"Setpoint must be > design inlet air dry-bulb temp if autosizing the Fluid Cooler."); | ||
ShowFatalError(state, "Review and revise design input values as appropriate."); | ||
} | ||
|
||
ensureSizingPlantExitTempIsNotLessThanDesignEnteringAirTemp(); | ||
|
||
rho = FluidProperties::GetDensityGlycol(state, | ||
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, | ||
Constant::InitConvTemp, | ||
|
@@ -1126,24 +1117,9 @@ void FluidCoolerspecs::size(EnergyPlusData &state) | |
if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->HighSpeedAirFlowRate = tmpHighSpeedAirFlowRate; | ||
} else if (PltSizCondNum > 0) { | ||
if (state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { | ||
// This conditional statement is to trap when the user specified Condenser/Fluid Cooler water design setpoint | ||
// temperature is less than design inlet air dry bulb temperature | ||
if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= this->DesignEnteringAirTemp && | ||
state.dataPlnt->PlantFirstSizesOkayToFinalize) { | ||
ShowSevereError(state, format("Error when autosizing the UA value for fluid cooler = {}.", this->Name)); | ||
ShowContinueError(state, | ||
format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air dry-bulb " | ||
"temperature ({:.2R} C) when autosizing the fluid cooler UA.", | ||
state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, | ||
this->DesignEnteringAirTemp)); | ||
ShowContinueError(state, | ||
"It is recommended that the Design Loop Exit Temperature = design inlet air dry-bulb temp plus the " | ||
"Fluid Cooler design approach temperature (e.g., 4 C)."); | ||
ShowContinueError(state, | ||
"If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design " | ||
"Setpoint must be > design inlet air dry-bulb temp if autosizing the Fluid Cooler."); | ||
ShowFatalError(state, "Review and revise design input values as appropriate."); | ||
} | ||
|
||
ensureSizingPlantExitTempIsNotLessThanDesignEnteringAirTemp(); | ||
|
||
rho = FluidProperties::GetDensityGlycol(state, | ||
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, | ||
Constant::InitConvTemp, | ||
|
@@ -1208,24 +1184,9 @@ void FluidCoolerspecs::size(EnergyPlusData &state) | |
if (this->HighSpeedFluidCoolerUAWasAutoSized && state.dataPlnt->PlantFirstSizesOkayToFinalize) { | ||
if (PltSizCondNum > 0) { | ||
if (state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { | ||
// This conditional statement is to trap when the user specified Condenser/Fluid Cooler water design setpoint | ||
// temperature is less than design inlet air dry bulb temperature | ||
if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= this->DesignEnteringAirTemp && | ||
state.dataPlnt->PlantFirstSizesOkayToFinalize) { | ||
ShowSevereError(state, format("Error when autosizing the UA value for fluid cooler = {}.", this->Name)); | ||
ShowContinueError(state, | ||
format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air dry-bulb " | ||
"temperature ({:.2R} C) when autosizing the fluid cooler UA.", | ||
state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, | ||
this->DesignEnteringAirTemp)); | ||
ShowContinueError(state, | ||
"It is recommended that the Design Loop Exit Temperature = design inlet air dry-bulb temp plus the Fluid " | ||
"Cooler design approach temperature (e.g., 4 C)."); | ||
ShowContinueError(state, | ||
"If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design Setpoint " | ||
"must be > design inlet air dry-bulb temp if autosizing the Fluid Cooler."); | ||
ShowFatalError(state, "Review and revise design input values as appropriate."); | ||
} | ||
|
||
ensureSizingPlantExitTempIsNotLessThanDesignEnteringAirTemp(); | ||
|
||
rho = FluidProperties::GetDensityGlycol(state, | ||
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, | ||
Constant::InitConvTemp, | ||
|
@@ -1611,6 +1572,24 @@ void FluidCoolerspecs::size(EnergyPlusData &state) | |
ErrorsFound = false; | ||
|
||
if (state.dataPlnt->PlantFinalSizesOkayToReport) { | ||
|
||
if (this->DesignLeavingWaterTemp <= HVAC::SmallTempDiff) { | ||
this->WaterTemp = this->DesignEnteringWaterTemp; // design inlet water temperature | ||
this->AirTemp = this->DesignEnteringAirTemp; // design inlet air dry-bulb temp | ||
this->AirWetBulb = this->DesignEnteringAirWetBulbTemp; // design inlet air wet-bulb temp | ||
this->AirPress = state.dataEnvrn->StdBaroPress; | ||
this->AirHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, this->AirTemp, this->AirWetBulb, this->AirPress); | ||
Real64 OutletTemp = 0; | ||
rho = FluidProperties::GetDensityGlycol(state, | ||
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, | ||
Constant::InitConvTemp, | ||
state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, | ||
CalledFrom); | ||
CalcFluidCoolerOutlet( | ||
state, this->indexInArray, rho * this->DesignWaterFlowRate, this->HighSpeedAirFlowRate, this->HighSpeedFluidCoolerUA, OutletTemp); | ||
this->DesignLeavingWaterTemp = OutletTemp; | ||
} | ||
|
||
// create predefined report | ||
OutputReportPredefined::PreDefTableEntry( | ||
state, state.dataOutRptPredefined->pdchMechType, this->Name, DataPlant::PlantEquipTypeNames[static_cast<int>(this->FluidCoolerType)]); | ||
|
@@ -1642,7 +1621,8 @@ void FluidCoolerspecs::size(EnergyPlusData &state) | |
state, state.dataOutRptPredefined->pdchCTFCDesFanPwr, this->Name, this->HighSpeedFanPower); // equivalent to Design Fan Power? | ||
OutputReportPredefined::PreDefTableEntry( | ||
state, state.dataOutRptPredefined->pdchCTFCDesInletAirWBT, this->Name, this->DesignEnteringAirWetBulbTemp); | ||
OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCTFCDesWaterFlowRate, this->Name, this->DesignWaterFlowRate); | ||
OutputReportPredefined::PreDefTableEntry( | ||
state, state.dataOutRptPredefined->pdchCTFCDesWaterFlowRate, this->Name, this->DesignWaterFlowRate, 6); | ||
OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCTFCLevWaterSPTemp, this->Name, this->DesignLeavingWaterTemp); | ||
} | ||
|
||
|
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.
Fix is to basically ensure the check is done INSIDE the
if(PltSizCondNum > 0)
If PltSizCondNum is not > 0, it'll throw anyways