-
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
Correction of Mass Flow Rate Calculation for Pools Served by Low Heater Capacity #10551
Merged
Myoldmopar
merged 5 commits into
develop
from
10317PoolNotTurningOnWithLowCapacityHeatSource
Jun 12, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
272e310
Fix for #10317 error
RKStrand e6ac27a
Additional modifications for 10317
RKStrand 7b75d61
Merge branch 'develop' into 10317PoolNotTurningOnWithLowCapacityHeatS…
RKStrand 87f138a
Tweaks to 10317 Solution and unit test
RKStrand 3ba97f6
Merge branch 'develop' into 10317PoolNotTurningOnWithLowCapacityHeatS…
RKStrand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -920,23 +920,14 @@ void SwimmingPoolData::calculate(EnergyPlusData &state) | |
FluidProperties::GetSpecificHeatGlycol(state, "WATER", this->PoolWaterTemp, this->GlycolIndex, RoutineName); // specific heat of pool water | ||
|
||
Real64 TH22 = state.dataHeatBalSurf->SurfInsideTempHist(2)( | ||
SurfNum); // inside surface temperature at the previous time step equals the old pool water temperature | ||
Real64 TInSurf = | ||
this->CurSetPtTemp; // Setpoint temperature for pool which is also the goal temperature and also the inside surface face temperature | ||
Real64 Tmuw = this->CurMakeupWaterTemp; // Inlet makeup water temperature | ||
SurfNum); // inside surface temperature at the previous time step equals the old pool water temperature | ||
Real64 Tmuw = this->CurMakeupWaterTemp; // Inlet makeup water temperature | ||
Real64 TLoopInletTemp = state.dataLoopNodes->Node(this->WaterInletNode).Temp; // Inlet water temperature from the plant loop | ||
this->WaterInletTemp = TLoopInletTemp; | ||
|
||
// Now calculate the requested mass flow rate from the plant loop to achieve the proper pool temperature | ||
// old equation using surface heat balance form: MassFlowRate = CpDeltaTi * ( CondTerms + ConvTerm + SWtotal + LWtotal + PeopleGain + | ||
// PoolMassTerm + MUWTerm + EvapEnergyLossPerArea ); | ||
Real64 MassFlowRate = (this->WaterMass / (state.dataHVACGlobal->TimeStepSysSec)) * | ||
((TInSurf - TH22) / (TLoopInletTemp - TInSurf)); // Target mass flow rate to achieve the proper setpoint temperature | ||
if (MassFlowRate > this->WaterMassFlowRateMax) { | ||
MassFlowRate = this->WaterMassFlowRateMax; | ||
} else if (MassFlowRate < 0.0) { | ||
MassFlowRate = 0.0; | ||
} | ||
Real64 MassFlowRate; | ||
this->calcMassFlowRate(state, MassFlowRate, TH22, TLoopInletTemp); | ||
|
||
PlantUtilities::SetComponentFlowRate(state, MassFlowRate, this->WaterInletNode, this->WaterOutletNode, this->HWplantLoc); | ||
this->WaterMassFlowRate = MassFlowRate; | ||
|
||
|
@@ -953,6 +944,26 @@ void SwimmingPoolData::calculate(EnergyPlusData &state) | |
state.dataHeatBalFanSys->SumLatentPool(ZoneNum) += EvapRate * Psychrometrics::PsyHfgAirFnWTdb(thisZoneHB.airHumRat, thisZoneHB.MAT); | ||
} | ||
|
||
void SwimmingPoolData::calcMassFlowRate(EnergyPlusData &state, Real64 &massFlowRate, Real64 TH22, Real64 TLoopInletTemp) | ||
{ | ||
// Calculate the mass flow rate to achieve the proper setpoint temperature | ||
if (TLoopInletTemp != this->CurSetPtTemp) { | ||
massFlowRate = this->WaterMass / state.dataHVACGlobal->TimeStepSysSec * (this->CurSetPtTemp - TH22) / (TLoopInletTemp - this->CurSetPtTemp); | ||
} else { // avoid the divide by zero, reset later if necessary | ||
massFlowRate = 0.0; | ||
} | ||
if (massFlowRate > this->WaterMassFlowRateMax) { | ||
massFlowRate = this->WaterMassFlowRateMax; | ||
} else if (massFlowRate <= 0.0) { | ||
// trap case where loop temperature is lower than the setpoint but could still do heating Defect 10317 | ||
if (TLoopInletTemp > TH22 && TLoopInletTemp <= this->CurSetPtTemp) { | ||
massFlowRate = this->WaterMassFlowRateMax; | ||
} else { | ||
massFlowRate = 0.0; | ||
} | ||
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. Looks good to me. |
||
} | ||
} | ||
|
||
void SwimmingPoolData::calcSwimmingPoolEvap(EnergyPlusData &state, | ||
Real64 &EvapRate, // evaporation rate of pool | ||
int const SurfNum, // surface index | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -541,3 +541,81 @@ TEST_F(EnergyPlusFixture, SwimmingPool_reportTest) | |
EXPECT_NEAR(expectedMakeUpWaterVolFlowRate, myPool.MakeUpWaterVolFlowRate, closeEnough); | ||
EXPECT_NEAR(expectedMakeUpWaterVol, myPool.MakeUpWaterVol, closeEnough); | ||
} | ||
|
||
TEST_F(EnergyPlusFixture, SwimmingPool_calcMassFlowRateTest) | ||
{ | ||
// Test routine added as a solution to Defect #10317 | ||
Real64 constexpr closeEnough = 0.00001; | ||
Real64 tPoolWater; | ||
Real64 tInletWaterLoop; | ||
Real64 calculatedFlowRate; | ||
Real64 expectedAnswer; | ||
SwimmingPoolData testPool; | ||
|
||
state->dataHVACGlobal->TimeStepSysSec = 60.0; | ||
|
||
// Test 1: Normal pass through the routine, no limits violated | ||
testPool.CurSetPtTemp = 27.0; | ||
testPool.WaterMass = 1000.0; | ||
testPool.WaterMassFlowRateMax = 20.0; | ||
tPoolWater = 25.0; | ||
tInletWaterLoop = 30.0; | ||
expectedAnswer = 11.111111; | ||
testPool.calcMassFlowRate(*state, calculatedFlowRate, tPoolWater, tInletWaterLoop); | ||
EXPECT_NEAR(calculatedFlowRate, expectedAnswer, closeEnough); | ||
|
||
// Test 2: Flow rate larger than max--limit to max | ||
calculatedFlowRate = 0.0; // reset | ||
testPool.CurSetPtTemp = 27.0; | ||
testPool.WaterMass = 1000.0; | ||
testPool.WaterMassFlowRateMax = 10.0; | ||
tPoolWater = 25.0; | ||
tInletWaterLoop = 30.0; | ||
expectedAnswer = 10.0; | ||
testPool.calcMassFlowRate(*state, calculatedFlowRate, tPoolWater, tInletWaterLoop); | ||
EXPECT_NEAR(calculatedFlowRate, expectedAnswer, closeEnough); | ||
|
||
// Test 3: Current setpoint is lower than the pool temperature--flow rate set to zero | ||
calculatedFlowRate = -9999.9; // reset | ||
testPool.CurSetPtTemp = 27.0; | ||
testPool.WaterMass = 1000.0; | ||
testPool.WaterMassFlowRateMax = 10.0; | ||
tPoolWater = 32.0; | ||
tInletWaterLoop = 30.0; | ||
expectedAnswer = 0.0; | ||
testPool.calcMassFlowRate(*state, calculatedFlowRate, tPoolWater, tInletWaterLoop); | ||
EXPECT_NEAR(calculatedFlowRate, expectedAnswer, closeEnough); | ||
|
||
// Test 4: Current setpoint and inlet temperature are equal--flow rate set to max when pool water temperature is lower | ||
calculatedFlowRate = -9999.9; // reset | ||
testPool.CurSetPtTemp = 27.0; | ||
testPool.WaterMass = 1000.0; | ||
testPool.WaterMassFlowRateMax = 20.0; | ||
tPoolWater = 25.0; | ||
tInletWaterLoop = 27.0; | ||
expectedAnswer = 20.0; | ||
testPool.calcMassFlowRate(*state, calculatedFlowRate, tPoolWater, tInletWaterLoop); | ||
EXPECT_NEAR(calculatedFlowRate, expectedAnswer, closeEnough); | ||
|
||
// Test 5: Current setpoint and inlet temperature are equal--flow rate set to zero when pool water temperature is higher | ||
calculatedFlowRate = -9999.9; // reset | ||
testPool.CurSetPtTemp = 27.0; | ||
testPool.WaterMass = 1000.0; | ||
testPool.WaterMassFlowRateMax = 20.0; | ||
tPoolWater = 32.0; | ||
tInletWaterLoop = 27.0; | ||
expectedAnswer = 0.0; | ||
testPool.calcMassFlowRate(*state, calculatedFlowRate, tPoolWater, tInletWaterLoop); | ||
EXPECT_NEAR(calculatedFlowRate, expectedAnswer, closeEnough); | ||
|
||
// Test 6: Water temp is below the setpoint but higher than the pool temp--flow rate set to max (this was the cause of the defect) | ||
calculatedFlowRate = -9999.9; // reset | ||
testPool.CurSetPtTemp = 27.0; | ||
testPool.WaterMass = 1000.0; | ||
testPool.WaterMassFlowRateMax = 17.0; | ||
tPoolWater = 25.0; | ||
tInletWaterLoop = 26.0; | ||
expectedAnswer = 17.0; | ||
testPool.calcMassFlowRate(*state, calculatedFlowRate, tPoolWater, tInletWaterLoop); | ||
EXPECT_NEAR(calculatedFlowRate, expectedAnswer, closeEnough); | ||
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. Great testing! That little function is getting exercised well in all these different conditions. 💯 |
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 just have a few nit pick comments.
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.
@rraustad Here are answers to your questions:
@Myoldmopar Based on comments by @rraustad, do you want me to do any additional commits?
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 my comments were more for closure on this branch. I don't really "need" to see these changes, they were just food for thought.
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.
Perfect on all accounts. They are valid comments, but I agree we don't need more commits here. Thanks to you both, I think this is ready.
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.
Ready - "was ready when I merged it"