From db1332a26146f4dc32b5662563f2d0f63e0ff26c Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 26 Jul 2024 17:58:39 -0400 Subject: [PATCH] Final unit test --- src/EnergyPlus/PlantLoopHeatPumpEIR.cc | 2 +- .../unit/ChillerReformulatedEIR.unit.cc | 8 +- .../unit/PlantLoopHeatPumpEIR.unit.cc | 97 +++++++++++++------ 3 files changed, 75 insertions(+), 32 deletions(-) diff --git a/src/EnergyPlus/PlantLoopHeatPumpEIR.cc b/src/EnergyPlus/PlantLoopHeatPumpEIR.cc index 7653b894f7f..28eb853c787 100644 --- a/src/EnergyPlus/PlantLoopHeatPumpEIR.cc +++ b/src/EnergyPlus/PlantLoopHeatPumpEIR.cc @@ -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())); diff --git a/tst/EnergyPlus/unit/ChillerReformulatedEIR.unit.cc b/tst/EnergyPlus/unit/ChillerReformulatedEIR.unit.cc index 7d2b0d78e7c..f3c9696983f 100644 --- a/tst/EnergyPlus/unit/ChillerReformulatedEIR.unit.cc +++ b/tst/EnergyPlus/unit/ChillerReformulatedEIR.unit.cc @@ -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); diff --git a/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc b/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc index fdfc8d22939..af666c54e32 100644 --- a/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc +++ b/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc @@ -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; @@ -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; 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)