Skip to content

Commit

Permalink
10634 Fix of Condenser Operation Issue
Browse files Browse the repository at this point in the history
This commit includes the fix to the problem for both condensers operating even when the operation scheme said that one of them should not be operating.  It fixes this for all of the cooling tower models that were not set up to look at this.  Results now should that the towers are operating when they are supposed to.
  • Loading branch information
RKStrand committed Aug 9, 2024
1 parent eb6665f commit c95600b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 34 deletions.
68 changes: 42 additions & 26 deletions src/EnergyPlus/CondenserLoopTowers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ namespace CondenserLoopTowers {
this->initialize(state);
switch (this->TowerType) {
case DataPlant::PlantEquipmentType::CoolingTower_SingleSpd:
this->calculateSingleSpeedTower(state);
this->calculateSingleSpeedTower(state, CurLoad);
break;
case DataPlant::PlantEquipmentType::CoolingTower_TwoSpd:
this->calculateTwoSpeedTower(state);
this->calculateTwoSpeedTower(state, CurLoad);
break;
case DataPlant::PlantEquipmentType::CoolingTower_VarSpd:
this->calculateVariableSpeedTower(state);
this->calculateVariableSpeedTower(state, CurLoad);
break;
case DataPlant::PlantEquipmentType::CoolingTower_VarSpdMerkel:
this->calculateMerkelVariableSpeedTower(state, CurLoad);
Expand Down Expand Up @@ -4535,7 +4535,7 @@ namespace CondenserLoopTowers {
}
} // namespace CondenserLoopTowers

void CoolingTower::calculateSingleSpeedTower(EnergyPlusData &state)
void CoolingTower::calculateSingleSpeedTower(EnergyPlusData &state, Real64 &MyLoad)
{

// SUBROUTINE INFORMATION:
Expand Down Expand Up @@ -4695,13 +4695,9 @@ namespace CondenserLoopTowers {

// Do not RETURN here if flow rate is less than SmallMassFlow. Check basin heater and then RETURN.

// MassFlowTolerance is a parameter to indicate a no flow condition
if (this->WaterMassFlowRate <= DataBranchAirLoopPlant::MassFlowTolerance) {
// for multiple cells, we assume that it's a common basin
CalcBasinHeaterPower(
state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower);
return;
}
bool returnFlagSet;
this->checkMassFlowAndLoad(state, MyLoad, returnFlagSet);
if (returnFlagSet) return;

bool IncrNumCellFlag = true; // determine if yes or no we increase the number of cells // set value to true to enter in the loop

Expand Down Expand Up @@ -4847,7 +4843,7 @@ namespace CondenserLoopTowers {
this->airFlowRateRatio = (AirFlowRate * this->NumCell) / this->HighSpeedAirFlowRate;
}

void CoolingTower::calculateTwoSpeedTower(EnergyPlusData &state)
void CoolingTower::calculateTwoSpeedTower(EnergyPlusData &state, Real64 &MyLoad)
{

// SUBROUTINE INFORMATION:
Expand Down Expand Up @@ -4974,12 +4970,9 @@ namespace CondenserLoopTowers {
// Do not RETURN here if flow rate is less than SmallMassFlow. Check basin heater and then RETURN.
if (state.dataPlnt->PlantLoop(this->plantLoc.loopNum).LoopSide(this->plantLoc.loopSideNum).FlowLock == DataPlant::FlowLock::Unlocked)
return; // TODO: WTF
// MassFlowTolerance is a parameter to indicate a no flow condition
if (this->WaterMassFlowRate <= DataBranchAirLoopPlant::MassFlowTolerance) {
CalcBasinHeaterPower(
state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower);
return;
}
bool returnFlagSet;
this->checkMassFlowAndLoad(state, MyLoad, returnFlagSet);
if (returnFlagSet) return;

// Added for multi-cell. Determine the number of cells operating
Real64 WaterMassFlowRatePerCellMin = 0.0;
Expand Down Expand Up @@ -5089,7 +5082,7 @@ namespace CondenserLoopTowers {
this->airFlowRateRatio = (AirFlowRate * this->NumCell) / this->HighSpeedAirFlowRate;
}

void CoolingTower::calculateVariableSpeedTower(EnergyPlusData &state)
void CoolingTower::calculateVariableSpeedTower(EnergyPlusData &state, Real64 &MyLoad)
{

// SUBROUTINE INFORMATION:
Expand Down Expand Up @@ -5209,12 +5202,10 @@ namespace CondenserLoopTowers {
// Do not RETURN here if flow rate is less than MassFlowTolerance. Check basin heater and then RETURN.
if (state.dataPlnt->PlantLoop(this->plantLoc.loopNum).LoopSide(this->plantLoc.loopSideNum).FlowLock == DataPlant::FlowLock::Unlocked)
return; // TODO: WTF
// MassFlowTolerance is a parameter to indicate a no flow condition
if (this->WaterMassFlowRate <= DataBranchAirLoopPlant::MassFlowTolerance) {
CalcBasinHeaterPower(
state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower);
return;
}

bool returnFlagSet;
this->checkMassFlowAndLoad(state, MyLoad, returnFlagSet);
if (returnFlagSet) return;

// loop to increment NumCell if we cannot meet the setpoint with the actual number of cells calculated above
bool IncrNumCellFlag = true;
Expand Down Expand Up @@ -5512,9 +5503,10 @@ namespace CondenserLoopTowers {
}

WaterMassFlowRatePerCell = this->WaterMassFlowRate / this->NumCellOn;

// MassFlowTolerance is a parameter to indicate a no flow condition
if (this->WaterMassFlowRate <= DataBranchAirLoopPlant::MassFlowTolerance || (MyLoad > HVAC::SmallLoad)) {
// for multiple cells, we assume that it's a common bassin
// for multiple cells, we assume that it's a common basin
CalcBasinHeaterPower(
state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower);
return;
Expand Down Expand Up @@ -6463,6 +6455,30 @@ namespace CondenserLoopTowers {
}
}

void CoolingTower::checkMassFlowAndLoad(EnergyPlusData &state, Real64 const MyLoad, bool &returnFlagSet)
{
returnFlagSet = false;
// MassFlowTolerance is a parameter to indicate a no flow condition
if (this->WaterMassFlowRate <= DataBranchAirLoopPlant::MassFlowTolerance) {
// for multiple cells, we assume that it's a common basin
CalcBasinHeaterPower(
state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower);
returnFlagSet = true;
}

// Also check to see if the tower is not running (zero MyLoad)
if (std::abs(MyLoad) <= HVAC::SmallLoad) {
// tower doesn't need to do anything
this->OutletWaterTemp = state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp;
this->FanPower = 0.0;
this->airFlowRateRatio = 0.0;
this->Qactual = 0.0;
CalcBasinHeaterPower(
state, this->BasinHeaterPowerFTempDiff, this->BasinHeaterSchedulePtr, this->BasinHeaterSetPointTemp, this->BasinHeaterPower);
returnFlagSet = true;
}
}

} // namespace CondenserLoopTowers

} // namespace EnergyPlus
8 changes: 5 additions & 3 deletions src/EnergyPlus/CondenserLoopTowers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -387,13 +387,13 @@ namespace CondenserLoopTowers {

void SizeVSMerkelTower(EnergyPlusData &state);

void calculateSingleSpeedTower(EnergyPlusData &state);
void calculateSingleSpeedTower(EnergyPlusData &state, Real64 &MyLoad);

void calculateTwoSpeedTower(EnergyPlusData &state);
void calculateTwoSpeedTower(EnergyPlusData &state, Real64 &MyLoad);

void calculateMerkelVariableSpeedTower(EnergyPlusData &state, Real64 &MyLoad);

void calculateVariableSpeedTower(EnergyPlusData &state);
void calculateVariableSpeedTower(EnergyPlusData &state, Real64 &MyLoad);

Real64 calculateSimpleTowerOutletTemp(EnergyPlusData &state, Real64 waterMassFlowRate, Real64 AirFlowRate, Real64 UAdesign);

Expand Down Expand Up @@ -427,6 +427,8 @@ namespace CondenserLoopTowers {

void report(EnergyPlusData &state, bool RunFlag);

void checkMassFlowAndLoad(EnergyPlusData &state, Real64 MyLoad, bool &returnFlagSet);

static CoolingTower *factory(EnergyPlusData &state, std::string_view objectName);
};

Expand Down
12 changes: 7 additions & 5 deletions tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -904,10 +904,11 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedSizing)
SimulationManager::SetupSimulation(*state, ErrorsFound);
CondenserLoopTowers::GetTowerInput(*state);

Real64 MyLoad = 0.0;
state->dataCondenserLoopTowers->towers(1).initialize(*state);
state->dataCondenserLoopTowers->towers(1).SizeTower(*state);
state->dataCondenserLoopTowers->towers(1).initialize(*state);
state->dataCondenserLoopTowers->towers(1).calculateSingleSpeedTower(*state);
state->dataCondenserLoopTowers->towers(1).calculateSingleSpeedTower(*state, MyLoad);
state->dataCondenserLoopTowers->towers(1).update(*state);
state->dataCondenserLoopTowers->towers(1).report(*state, true);

Expand All @@ -927,8 +928,8 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedSizing)
outletNodeIndex = std::distance(state->dataLoopNodes->NodeID.begin(), outletNode);
}
// TODO: FIXME: This is failing. Actual is -10.409381032746095, expected is 30.
EXPECT_GT(state->dataLoopNodes->Node(inletNodeIndex).Temp, 30.0); // inlet node temperature
EXPECT_DOUBLE_EQ(30.0, state->dataLoopNodes->Node(outletNodeIndex).Temp); // outlet node temperature
EXPECT_GT(state->dataLoopNodes->Node(inletNodeIndex).Temp, 30.0); // inlet node temperature
EXPECT_DOUBLE_EQ(state->dataLoopNodes->Node(inletNodeIndex).Temp, state->dataLoopNodes->Node(outletNodeIndex).Temp); // outlet node temperature

// input not needed for sizing (WasAutoSized = false) using NominalCapacity method but this variable should still size
EXPECT_FALSE(state->dataCondenserLoopTowers->towers(1).HighSpeedTowerUAWasAutoSized);
Expand Down Expand Up @@ -3967,7 +3968,8 @@ TEST_F(EnergyPlusFixture, VSCoolingTowers_WaterOutletTempTest)
state->dataPlnt->PlantLoop(VSTower.plantLoc.loopNum).LoopSide(VSTower.plantLoc.loopSideNum).TempSetPoint = 30.0;
VSTower.WaterMassFlowRate = VSTower.DesWaterMassFlowRate * WaterFlowRateRatio;

VSTower.calculateVariableSpeedTower(*state);
Real64 myLoad = 1000.0;
VSTower.calculateVariableSpeedTower(*state, myLoad);
EXPECT_DOUBLE_EQ(30.0, VSTower.OutletWaterTemp);
EXPECT_DOUBLE_EQ(1.0, VSTower.FanCyclingRatio);
Real64 TowerOutletWaterTemp = VSTower.calculateVariableTowerOutletTemp(*state, WaterFlowRateRatio, VSTower.airFlowRateRatio, AirWetBulbTemp);
Expand All @@ -3985,7 +3987,7 @@ TEST_F(EnergyPlusFixture, VSCoolingTowers_WaterOutletTempTest)
VSTower.AirWetBulb = state->dataEnvrn->OutWetBulbTemp;
VSTower.AirHumRat = state->dataEnvrn->OutHumRat;

VSTower.calculateVariableSpeedTower(*state);
VSTower.calculateVariableSpeedTower(*state, myLoad);
EXPECT_DOUBLE_EQ(30.0, VSTower.OutletWaterTemp);
EXPECT_NEAR(0.5424, VSTower.FanCyclingRatio, 0.0001);
// outside air condition is favorable that fan only needs to cycle at min flow to meet the setpoint
Expand Down

4 comments on commit c95600b

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

10634CondenserNotFollowingPlanOpScheme (RKStrand) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3684 of 3695 tests passed, 4 test warnings)

Messages:\n

  • 4 tests had: ESO small diffs.
  • 5 tests had: MTR small diffs.
  • 7 tests had: EIO diffs.
  • 11 tests had: ESO big diffs.
  • 10 tests had: MTR big diffs.
  • 10 tests had: Table big diffs.
  • 10 tests had: Table string diffs.
  • 1 test had: Table small diffs.
  • 1 test had: ERR diffs.

Failures:\n

regression Test Summary

  • Passed: 800
  • Failed: 11

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

10634CondenserNotFollowingPlanOpScheme (RKStrand) - x86_64-MacOS-10.18-clang-15.0.0: OK (3643 of 3654 tests passed, 4 test warnings)

Messages:\n

  • 4 tests had: ESO small diffs.
  • 5 tests had: MTR small diffs.
  • 7 tests had: EIO diffs.
  • 11 tests had: ESO big diffs.
  • 10 tests had: MTR big diffs.
  • 10 tests had: Table big diffs.
  • 10 tests had: Table string diffs.
  • 1 test had: Table small diffs.
  • 1 test had: ERR diffs.

Failures:\n

regression Test Summary

  • Passed: 780
  • Failed: 11

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

10634CondenserNotFollowingPlanOpScheme (RKStrand) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (795 of 795 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

10634CondenserNotFollowingPlanOpScheme (RKStrand) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (2070 of 2070 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.