Skip to content

Commit

Permalink
10634 Addition of Unit Test
Browse files Browse the repository at this point in the history
Unit test was added to exercise the new subroutine that is being used to allow condensers to factor in condenser loop operation schemes.
  • Loading branch information
RKStrand committed Aug 9, 2024
1 parent 8f7c5de commit 712f23f
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

4 comments on commit 712f23f

@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 (3685 of 3696 tests passed, 4 test warnings)

Messages:\n

  • 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.
  • 4 tests had: ESO small diffs.
  • 5 tests had: MTR small 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 (3644 of 3655 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.
  • 1 test had: Table small diffs.
  • 10 tests had: Table big diffs.
  • 10 tests had: Table string 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 (2071 of 2071 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.