Skip to content

Commit

Permalink
Final unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
rraustad committed Jul 26, 2024
1 parent 837b7a5 commit db1332a
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/EnergyPlus/PlantLoopHeatPumpEIR.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1811,7 +1811,7 @@ void EIRPlantLoopHeatPump::processInputForEIRPLHP(EnergyPlusData &state)
}
// fields only in cooling object
if (thisPLHP.EIRHPType == DataPlant::PlantEquipmentType::HeatPumpEIRCooling) {
auto const thermosiphonTempCurveName = fields.find("thermosiphon_temperature_difference_curve_name");
auto const thermosiphonTempCurveName = fields.find("thermosiphon_capacity_fraction_curve_name");
if (thermosiphonTempCurveName != fields.end()) {
thisPLHP.thermosiphonTempCurveIndex =
Curve::GetCurveIndex(state, Util::makeUPPER(thermosiphonTempCurveName.value().get<std::string>()));
Expand Down
8 changes: 4 additions & 4 deletions tst/EnergyPlus/unit/ChillerReformulatedEIR.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,16 +239,16 @@ TEST_F(EnergyPlusFixture, ChillerElectricReformulatedEIR_WaterCooledChillerVaria
thisChiller.initialize(*state, RunFlag, MyLoad);
thisChiller.calculate(*state, MyLoad, RunFlag, FalsiCondOutTemp);
EXPECT_GT(thisChiller.ChillerPartLoadRatio, 0.7); // load is large
EXPECT_EQ(thisChiller.thermosiphonStatus, 0); // thermosiphon is off
EXPECT_GT(thisChiller.Power, 20000.0); // power is non-zero
EXPECT_EQ(thisChiller.thermosiphonStatus, 0); // thermosiphon is off
EXPECT_GT(thisChiller.Power, 20000.0); // power is non-zero

state->dataLoopNodes->Node(thisChiller.CondInletNodeNum).Temp = 5.0; // condenser inlet temp < evap outlet temp

thisChiller.initialize(*state, RunFlag, MyLoad);
thisChiller.calculate(*state, MyLoad, RunFlag, FalsiCondOutTemp);
EXPECT_GT(thisChiller.ChillerPartLoadRatio, 0.7); // load is large
EXPECT_EQ(thisChiller.thermosiphonStatus, 0); // thermosiphon is off
EXPECT_GT(thisChiller.Power, 20000.0); // power is non-zero
EXPECT_EQ(thisChiller.thermosiphonStatus, 0); // thermosiphon is off
EXPECT_GT(thisChiller.Power, 20000.0); // power is non-zero

MyLoad /= 15.0; // reduce load such that thermosiphon can meet load
thisChiller.initialize(*state, RunFlag, MyLoad);
Expand Down
97 changes: 70 additions & 27 deletions tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3392,31 +3392,45 @@ TEST_F(EnergyPlusFixture, HeatingMetering)

TEST_F(EnergyPlusFixture, TestOperatingFlowRates_FullyAutosized_AirSource)
{
std::string const idf_objects = delimited_string({"HeatPump:PlantLoop:EIR:Cooling,",
" hp cooling side,",
" node 1,",
" node 2,",
" AirSource,",
" node 3,",
" node 4,",
" ,",
" ,",
" ,",
" Autosize,",
" Autosize,",
" ,",
" Autosize,",
" 3.14,",
" ,",
" dummyCurve,",
" dummyCurve,",
" dummyCurve;",
"Curve:Linear,",
" dummyCurve,",
" 1,",
" 0,",
" 1,",
" 1;"});
std::string const idf_objects =
delimited_string({"HeatPump:PlantLoop:EIR:Cooling,",
" hp cooling side,",
" node 1,",
" node 2,",
" AirSource,",
" node 3,",
" node 4,",
" ,",
" ,",
" ,",
" Autosize,",
" Autosize,",
" ,",
" Autosize,",
" 3.14,",
" ,",
" dummyCurve,",
" dummyCurve,",
" dummyCurve,",
" ,",
" ,",
" ,",
" ,",
" ,",
" ,",
" ,",
" ,",
" ,",
" ,",
" ThermoCapFracCurve;",

"Curve:Linear, ThermoCapFracCurve, 0.0, 0.06, 0.0, 10.0, 0.0, 1.0, Dimensionless, Dimensionless;",
"Curve:Linear,",
" dummyCurve,",
" 1,",
" 0,",
" 1,",
" 1;"});
ASSERT_TRUE(process_idf(idf_objects));

bool firstHVACIteration = true;
Expand Down Expand Up @@ -3465,13 +3479,42 @@ TEST_F(EnergyPlusFixture, TestOperatingFlowRates_FullyAutosized_AirSource)

// call with run flag ON, flow locked at nonzero both
state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).FlowLock = DataPlant::FlowLock::Locked;
state->dataLoopNodes->Node(thisCoolingPLHP->loadSideNodes.inlet).MassFlowRate = 0.14;
state->dataLoopNodes->Node(thisCoolingPLHP->loadSideNodes.inlet).MassFlowRate = 1.0;

This comment has been minimized.

Copy link
@rraustad

rraustad Jul 26, 2024

Author Contributor

Updated to avoid -24 C evap outlet temp.

thisCoolingPLHP->running = true;
thisCoolingPLHP->sizeLoadSide(*state);
thisCoolingPLHP->sizeSrcSideASHP(*state);
thisCoolingPLHP->setOperatingFlowRatesASHP(*state, firstHVACIteration);
EXPECT_NEAR(0.14, thisCoolingPLHP->loadSideMassFlowRate, 0.001);
EXPECT_NEAR(1.0, thisCoolingPLHP->loadSideMassFlowRate, 0.001);
EXPECT_TRUE(thisCoolingPLHP->running);

// test thermosiphon model
state->dataLoopNodes->Node(thisCoolingPLHP->loadSideNodes.inlet).Temp = 10.0;
state->dataLoopNodes->Node(thisCoolingPLHP->loadSideNodes.outlet).Temp = 6.0;
state->dataLoopNodes->Node(thisCoolingPLHP->loadSideNodes.outlet).TempSetPoint = 6.0;
state->dataLoopNodes->Node(thisCoolingPLHP->sourceSideNodes.inlet).Temp = 12.0; // condenser inlet temp > evap outlet temp
state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint;
state->dataPlnt->PlantLoop(1).TempSetPointNodeNum = thisCoolingPLHP->loadSideNodes.outlet;
Real64 CurLoad = -20000.0;
bool RunFlag = true;
EnergyPlus::PlantLocation calledFromLocation = PlantLocation(1, DataPlant::LoopSideLocation::Supply, 1, 1);

thisCoolingPLHP->simulate(*state, calledFromLocation, firstHVACIteration, CurLoad, RunFlag);
EXPECT_GT(thisCoolingPLHP->partLoadRatio, 0.4); // load is large
EXPECT_EQ(thisCoolingPLHP->thermosiphonStatus, 0); // thermosiphon is off
EXPECT_GT(thisCoolingPLHP->powerUsage, 6300.0); // power is non-zero

state->dataLoopNodes->Node(thisCoolingPLHP->sourceSideNodes.inlet).Temp = 5.0; // condenser inlet temp < evap outlet temp

thisCoolingPLHP->simulate(*state, calledFromLocation, firstHVACIteration, CurLoad, RunFlag);
EXPECT_GT(thisCoolingPLHP->partLoadRatio, 0.4); // load is large
EXPECT_EQ(thisCoolingPLHP->thermosiphonStatus, 0); // thermosiphon is off
EXPECT_GT(thisCoolingPLHP->powerUsage, 6300.0); // power is non-zero

CurLoad /= 20.0; // reduce load such that thermosiphon can meet load
thisCoolingPLHP->simulate(*state, calledFromLocation, firstHVACIteration, CurLoad, RunFlag);
EXPECT_GT(thisCoolingPLHP->partLoadRatio, 0.02); // load is small
EXPECT_EQ(thisCoolingPLHP->thermosiphonStatus, 1); // thermosiphon is on
EXPECT_EQ(thisCoolingPLHP->powerUsage, 0.0); // power is zero
}

TEST_F(EnergyPlusFixture, Test_Curve_Negative_Energy)
Expand Down

5 comments on commit db1332a

@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.

NFP-Refrigerant-Migration-Decarbonization (rraustad) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3589 of 3697 tests passed, 175 test warnings)

Messages:\n

  • 283 tests had: AUD diffs.
  • 279 tests had: RDD diffs.
  • 131 tests had: Table small diffs.
  • 108 tests had: Table big diffs.
  • 1 test had: ESO small diffs.
  • 1 test had: MTR small diffs.
  • 1 test had: MTD diffs.
  • 1 test had: EIO diffs.
  • 1 test had: ERR diffs.

Failures:\n

regression Test Summary

  • Passed: 704
  • Failed: 108

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

NFP-Refrigerant-Migration-Decarbonization (rraustad) - Win64-Windows-10-VisualStudio-16: OK (2863 of 2863 tests passed, 0 test warnings)

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.

NFP-Refrigerant-Migration-Decarbonization (rraustad) - x86_64-MacOS-10.18-clang-15.0.0: OK (3548 of 3656 tests passed, 175 test warnings)

Messages:\n

  • 283 tests had: AUD diffs.
  • 279 tests had: RDD diffs.
  • 131 tests had: Table small diffs.
  • 108 tests had: Table big diffs.
  • 1 test had: ESO small diffs.
  • 1 test had: MTR small diffs.
  • 1 test had: MTD diffs.
  • 1 test had: EIO diffs.
  • 1 test had: ERR diffs.

Failures:\n

regression Test Summary

  • Passed: 684
  • Failed: 108

Build Badge Test 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.

NFP-Refrigerant-Migration-Decarbonization (rraustad) - 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

@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.

NFP-Refrigerant-Migration-Decarbonization (rraustad) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (796 of 796 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.