From 712f23f9fc6f6eb39a32cad75f2eb04264bcca5e Mon Sep 17 00:00:00 2001 From: Rick Strand Date: Fri, 9 Aug 2024 15:02:26 -0500 Subject: [PATCH] 10634 Addition of Unit Test Unit test was added to exercise the new subroutine that is being used to allow condensers to factor in condenser loop operation schemes. --- .../unit/CondenserLoopTowers.unit.cc | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc b/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc index 76b9fc1f407..bb6f354a6f6 100644 --- a/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc +++ b/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc @@ -4307,4 +4307,69 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_CalculateVariableTowerOutletTemp) EXPECT_NEAR(tower.WaterTemp - 22.2222, tOutlet, 0.01); } +TEST_F(EnergyPlusFixture, CondenserLoopTowers_checkMassFlowAndLoadTest) +{ + bool flagToReturn; + Real64 myLoad; + Real64 constexpr allowedTolerance = 0.0001; + Real64 expectedPower; + Real64 expectedTemp; + + state->dataCondenserLoopTowers->towers.allocate(1); + auto &tower = state->dataCondenserLoopTowers->towers(1); + state->dataLoopNodes->Node.allocate(1); + tower.WaterInletNodeNum = 1; + + // Test 1: Mass flow rate is low but myLoad is ok--flag should be set to true + flagToReturn = false; + myLoad = 1000.0; + state->dataEnvrn->OutDryBulbTemp = 27.0; + tower.WaterMassFlowRate = 0.0; + tower.BasinHeaterPowerFTempDiff = 1.0; + tower.BasinHeaterSchedulePtr = 0; + tower.BasinHeaterSetPointTemp = 26.0; + tower.BasinHeaterPower = 1.0; + expectedPower = 0.0; + tower.checkMassFlowAndLoad(*state, myLoad, flagToReturn); + EXPECT_TRUE(flagToReturn); + EXPECT_NEAR(expectedPower, tower.BasinHeaterPower, allowedTolerance); + + // Test 2: Mass flow rate is ok but myLoad is zero--flag should be set to true + flagToReturn = false; + myLoad = 0.0; + state->dataEnvrn->OutDryBulbTemp = 27.0; + tower.WaterMassFlowRate = 0.5; + tower.BasinHeaterPowerFTempDiff = 1.0; + tower.BasinHeaterSchedulePtr = 0; + tower.BasinHeaterSetPointTemp = 25.0; + tower.BasinHeaterPower = 2.0; + tower.FanPower = 1.0; + tower.airFlowRateRatio = 1.0; + tower.Qactual = 1.0; + expectedPower = 0.0; + expectedTemp = 23.0; + state->dataLoopNodes->Node(tower.WaterInletNodeNum).Temp = 23.0; + tower.checkMassFlowAndLoad(*state, myLoad, flagToReturn); + EXPECT_TRUE(flagToReturn); + EXPECT_NEAR(expectedPower, tower.BasinHeaterPower, allowedTolerance); + EXPECT_NEAR(expectedTemp, tower.OutletWaterTemp, allowedTolerance); + EXPECT_NEAR(0.0, tower.FanPower, allowedTolerance); + EXPECT_NEAR(0.0, tower.airFlowRateRatio, allowedTolerance); + EXPECT_NEAR(0.0, tower.Qactual, allowedTolerance); + + // Test 3: Mass flow rate and myLoad are both ok--nothing changes, power does not get calculated here + flagToReturn = false; + myLoad = 1000.0; + state->dataEnvrn->OutDryBulbTemp = 27.0; + tower.WaterMassFlowRate = 0.5; + tower.BasinHeaterPowerFTempDiff = 1.0; + tower.BasinHeaterSchedulePtr = 0; + tower.BasinHeaterSetPointTemp = 25.0; + tower.BasinHeaterPower = 3.0; + expectedPower = 3.0; + tower.checkMassFlowAndLoad(*state, myLoad, flagToReturn); + EXPECT_FALSE(flagToReturn); + EXPECT_NEAR(expectedPower, tower.BasinHeaterPower, allowedTolerance); +} + } // namespace EnergyPlus