From 316d5ae797459d553c8ec7e3299070e4309a72ab Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 13 Dec 2024 10:25:45 +0100 Subject: [PATCH 01/11] Highlight an issue in an existing test --- tst/EnergyPlus/unit/FluidCoolers.unit.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/tst/EnergyPlus/unit/FluidCoolers.unit.cc b/tst/EnergyPlus/unit/FluidCoolers.unit.cc index 63fcf45c3e8..3b611de0b3d 100644 --- a/tst/EnergyPlus/unit/FluidCoolers.unit.cc +++ b/tst/EnergyPlus/unit/FluidCoolers.unit.cc @@ -360,6 +360,7 @@ TEST_F(EnergyPlusFixture, SizeFunctionTestWhenPlantSizingIndexIsZero) state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).plantLoc.loopNum = 1; state->dataPlnt->PlantLoop(FluidCoolerNum).PlantSizNum = 0; + EXPECT_EQ("DRY COOLER", thisFluidCooler.Name); EXPECT_FALSE(thisFluidCooler.HighSpeedFanPowerWasAutoSized); EXPECT_FALSE(thisFluidCooler.HighSpeedAirFlowRateWasAutoSized); EXPECT_FALSE(thisFluidCooler.HighSpeedFluidCoolerUAWasAutoSized); From a003e0701d25debbedc1c4948fdd6f01aded6839 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 13 Dec 2024 10:26:42 +0100 Subject: [PATCH 02/11] Fix problem in existing test: the allocate after GetInput was resetting it to an empty (invalid / default initialized) FluidCooler! --- tst/EnergyPlus/unit/FluidCoolers.unit.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/tst/EnergyPlus/unit/FluidCoolers.unit.cc b/tst/EnergyPlus/unit/FluidCoolers.unit.cc index 3b611de0b3d..a479ad29ea4 100644 --- a/tst/EnergyPlus/unit/FluidCoolers.unit.cc +++ b/tst/EnergyPlus/unit/FluidCoolers.unit.cc @@ -356,7 +356,6 @@ TEST_F(EnergyPlusFixture, SizeFunctionTestWhenPlantSizingIndexIsZero) auto &thisFluidCooler = state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum); state->dataPlnt->PlantLoop.allocate(FluidCoolerNum); - state->dataFluidCoolers->SimpleFluidCooler.allocate(FluidCoolerNum); state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum).plantLoc.loopNum = 1; state->dataPlnt->PlantLoop(FluidCoolerNum).PlantSizNum = 0; From 61c4c5d4dc6c6691c0a72c3f52819cca4e74e77e Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 13 Dec 2024 10:43:22 +0100 Subject: [PATCH 03/11] Rename test for clarity --- tst/EnergyPlus/unit/FluidCoolers.unit.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tst/EnergyPlus/unit/FluidCoolers.unit.cc b/tst/EnergyPlus/unit/FluidCoolers.unit.cc index a479ad29ea4..ffe1b056dcf 100644 --- a/tst/EnergyPlus/unit/FluidCoolers.unit.cc +++ b/tst/EnergyPlus/unit/FluidCoolers.unit.cc @@ -329,7 +329,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedFluidCoolerInput_Test5) EXPECT_EQ(thisFluidCooler.HighSpeedFluidCoolerUA, 0.0); } -TEST_F(EnergyPlusFixture, SizeFunctionTestWhenPlantSizingIndexIsZero) +TEST_F(EnergyPlusFixture, FluidCooler_SizeWhenPlantSizingIndexIsZero) { int FluidCoolerNum(1); From 93c4e0bac3fc0eb078cc09115b9c360db87fc99f Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 13 Dec 2024 10:52:39 +0100 Subject: [PATCH 04/11] Unrelated, but place the fluid coolers on the SUPPLY side of the plant loop This makes no difference in test results, but it was bothering me that they were on the demand side as it's not logical --- .../unit/EvaporativeFluidCoolers.unit.cc | 68 +++++++++---------- tst/EnergyPlus/unit/FluidCoolers.unit.cc | 28 ++++---- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc b/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc index 1238b47808c..1e3acb308b3 100644 --- a/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc +++ b/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc @@ -93,7 +93,7 @@ TEST_F(EnergyPlusFixture, EvapFluidCoolerSpecs_getDesignCapacitiesTest) thisEFC.WaterOutletNodeNum = 2; thisEFC.OutdoorAirInletNodeNum = 0; thisEFC.plantLoc.loopNum = 1; - thisEFC.plantLoc.loopSideNum = DataPlant::LoopSideLocation::Demand; + thisEFC.plantLoc.loopSideNum = DataPlant::LoopSideLocation::Supply; thisEFC.plantLoc.branchNum = 1; thisEFC.plantLoc.compNum = 1; PlantLocation pl; @@ -110,12 +110,12 @@ TEST_F(EnergyPlusFixture, EvapFluidCoolerSpecs_getDesignCapacitiesTest) state->dataLoopNodes->Node(1).MassFlowRateMax = 0.05; state->dataLoopNodes->Node(1).MassFlowRateMaxAvail = 0.05; state->dataPlnt->PlantLoop.allocate(1); - state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).FlowLock = DataPlant::FlowLock::Locked; - state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch.allocate(1); - state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1); - state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).MyLoad = 1.0; - state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).ON = false; - state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).CurOpSchemeType = DataPlant::OpScheme::Invalid; + state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).FlowLock = DataPlant::FlowLock::Locked; + state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch.allocate(1); + state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).Comp.allocate(1); + state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).MyLoad = 1.0; + state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).ON = false; + state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).CurOpSchemeType = DataPlant::OpScheme::Invalid; thisEFC.DesignWaterFlowRateWasAutoSized = false; thisEFC.LowSpeedAirFlowRateWasAutoSized = false; thisEFC.HighSpeedEvapFluidCoolerUAWasAutoSized = false; @@ -140,7 +140,7 @@ TEST_F(EnergyPlusFixture, EvapFluidCoolerSpecs_getDesignCapacitiesTest) ExpectedMinLoad = 0.0; // Call the routine to be tested and see if the fix is correct - PlantLocation loc = PlantLocation(1, DataPlant::LoopSideLocation::Demand, 1, 1); + PlantLocation loc = PlantLocation(1, DataPlant::LoopSideLocation::Supply, 1, 1); thisEFC.onInitLoopEquip(*state, loc); thisEFC.getDesignCapacities(*state, pl, MaxLoad, MinLoad, OptLoad); EXPECT_NEAR(MaxLoad, ExpectedMaxLoad, 0.01); @@ -173,10 +173,10 @@ TEST_F(EnergyPlusFixture, ExerciseSingleSpeedEvapFluidCooler) EvapFluidCoolerSpecs *ptr = EvapFluidCoolerSpecs::factory(*state, DataPlant::PlantEquipmentType::EvapFluidCooler_SingleSpd, "BIG EVAPORATIVEFLUIDCOOLER"); - PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Demand, 1, 1}; + PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Supply, 1, 1}; state->dataPlnt->PlantLoop.allocate(1); - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch.allocate(1); - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1); + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch.allocate(1); + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp.allocate(1); Real64 max, opt, min = 0.0; ptr->getDesignCapacities(*state, pl, max, min, opt); @@ -185,17 +185,17 @@ TEST_F(EnergyPlusFixture, ExerciseSingleSpeedEvapFluidCooler) EXPECT_NEAR(opt, 1000.0, 1.0); state->dataPlnt->TotNumLoops = 1; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).TotalBranches = 1; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).TotalBranches = 1; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).TempSetPoint = 2.0; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).MyLoad = 1000; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).ON = true; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = ptr->WaterInletNodeNum; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumOut = ptr->WaterOutletNodeNum; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).TempSetPoint = 2.0; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).MyLoad = 1000; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).ON = true; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).NodeNumIn = ptr->WaterInletNodeNum; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).NodeNumOut = ptr->WaterOutletNodeNum; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::EvapFluidCooler_SingleSpd; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = ptr->Name; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).Name = ptr->Name; state->dataPlnt->PlantLoop(1).MaxVolFlowRate = 3; state->dataPlnt->PlantLoop(1).MaxMassFlowRate = 3; state->dataSize->CurLoopNum = 1; @@ -209,7 +209,7 @@ TEST_F(EnergyPlusFixture, ExerciseSingleSpeedEvapFluidCooler) bool firstHVAC = true; Real64 curLoad = 0.0; ptr->plantLoc.loopNum = 1; - ptr->plantLoc.loopSideNum = EnergyPlus::DataPlant::LoopSideLocation::Demand; + ptr->plantLoc.loopSideNum = EnergyPlus::DataPlant::LoopSideLocation::Supply; ptr->plantLoc.branchNum = 1; ptr->plantLoc.compNum = 1; ptr->DesWaterMassFlowRate = 3.141; @@ -257,10 +257,10 @@ TEST_F(EnergyPlusFixture, ExerciseTwoSpeedEvapFluidCooler) EvapFluidCoolerSpecs *ptr = EvapFluidCoolerSpecs::factory(*state, DataPlant::PlantEquipmentType::EvapFluidCooler_TwoSpd, "CENTRAL TOWER"); - PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Demand, 1, 1}; + PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Supply, 1, 1}; state->dataPlnt->PlantLoop.allocate(1); - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch.allocate(1); - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1); + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch.allocate(1); + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp.allocate(1); Real64 max, opt, min = 0.0; ptr->getDesignCapacities(*state, pl, max, min, opt); @@ -269,17 +269,17 @@ TEST_F(EnergyPlusFixture, ExerciseTwoSpeedEvapFluidCooler) EXPECT_NEAR(opt, 1000.0, 1.0); state->dataPlnt->TotNumLoops = 1; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).TotalBranches = 1; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).TotalComponents = 1; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).TotalBranches = 1; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).TotalComponents = 1; state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).TempSetPoint = 2.0; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).MyLoad = 1000; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).ON = true; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumIn = ptr->WaterInletNodeNum; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).NodeNumOut = ptr->WaterOutletNodeNum; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Type = + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).TempSetPoint = 2.0; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).MyLoad = 1000; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).ON = true; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).NodeNumIn = ptr->WaterInletNodeNum; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).NodeNumOut = ptr->WaterOutletNodeNum; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).Type = DataPlant::PlantEquipmentType::EvapFluidCooler_TwoSpd; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name = ptr->Name; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).Name = ptr->Name; state->dataPlnt->PlantLoop(1).MaxVolFlowRate = 3; state->dataPlnt->PlantLoop(1).MaxMassFlowRate = 3; state->dataSize->CurLoopNum = 1; @@ -297,7 +297,7 @@ TEST_F(EnergyPlusFixture, ExerciseTwoSpeedEvapFluidCooler) bool firstHVAC = true; Real64 curLoad = 0.0; ptr->plantLoc.loopNum = 1; - ptr->plantLoc.loopSideNum = EnergyPlus::DataPlant::LoopSideLocation::Demand; + ptr->plantLoc.loopSideNum = EnergyPlus::DataPlant::LoopSideLocation::Supply; ptr->plantLoc.branchNum = 1; ptr->plantLoc.compNum = 1; ptr->DesWaterMassFlowRate = 3.141; diff --git a/tst/EnergyPlus/unit/FluidCoolers.unit.cc b/tst/EnergyPlus/unit/FluidCoolers.unit.cc index ffe1b056dcf..c6b2e037171 100644 --- a/tst/EnergyPlus/unit/FluidCoolers.unit.cc +++ b/tst/EnergyPlus/unit/FluidCoolers.unit.cc @@ -389,10 +389,10 @@ TEST_F(EnergyPlusFixture, ExerciseSingleSpeedFluidCooler) FluidCoolerspecs *ptr = FluidCoolerspecs::factory(*state, DataPlant::PlantEquipmentType::FluidCooler_SingleSpd, "DRY COOLER"); - PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Demand, 1, 1}; + PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Supply, 1, 1}; state->dataPlnt->PlantLoop.allocate(1); - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch.allocate(1); - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1); + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch.allocate(1); + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp.allocate(1); Real64 max, opt, min = 0.0; ptr->getDesignCapacities(*state, pl, max, min, opt); @@ -401,9 +401,9 @@ TEST_F(EnergyPlusFixture, ExerciseSingleSpeedFluidCooler) EXPECT_NEAR(opt, 58601.0, 1.0); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).TempSetPoint = 2.0; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).MyLoad = 1000; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).ON = true; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).TempSetPoint = 2.0; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).MyLoad = 1000; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).ON = true; state->dataPlnt->PlantLoop(1).MaxVolFlowRate = 3; state->dataPlnt->PlantLoop(1).MaxMassFlowRate = 3; @@ -422,7 +422,7 @@ TEST_F(EnergyPlusFixture, ExerciseSingleSpeedFluidCooler) bool firstHVAC = true; Real64 curLoad = 0.0; ptr->plantLoc.loopNum = 1; - ptr->plantLoc.loopSideNum = EnergyPlus::DataPlant::LoopSideLocation::Demand; + ptr->plantLoc.loopSideNum = EnergyPlus::DataPlant::LoopSideLocation::Supply; ptr->plantLoc.branchNum = 1; ptr->plantLoc.compNum = 1; ptr->DesWaterMassFlowRate = 3.141; @@ -460,10 +460,10 @@ TEST_F(EnergyPlusFixture, ExerciseTwoSpeedFluidCooler) FluidCoolerspecs *ptr = FluidCoolerspecs::factory(*state, DataPlant::PlantEquipmentType::FluidCooler_TwoSpd, "BIG FLUIDCOOLER"); - PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Demand, 1, 1}; + PlantLocation pl{1, EnergyPlus::DataPlant::LoopSideLocation::Supply, 1, 1}; state->dataPlnt->PlantLoop.allocate(1); - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch.allocate(1); - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp.allocate(1); + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch.allocate(1); + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp.allocate(1); Real64 max, opt, min = 0.0; ptr->getDesignCapacities(*state, pl, max, min, opt); @@ -472,9 +472,9 @@ TEST_F(EnergyPlusFixture, ExerciseTwoSpeedFluidCooler) EXPECT_NEAR(opt, 58601.0, 1.0); state->dataPlnt->PlantLoop(1).LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).TempSetPoint = 2.0; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).MyLoad = 1000; - state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).ON = true; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).TempSetPoint = 2.0; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).MyLoad = 1000; + state->dataPlnt->PlantLoop(1).LoopSide(EnergyPlus::DataPlant::LoopSideLocation::Supply).Branch(1).Comp(1).ON = true; state->dataPlnt->PlantLoop(1).MaxVolFlowRate = 3; state->dataPlnt->PlantLoop(1).MaxMassFlowRate = 3; @@ -493,7 +493,7 @@ TEST_F(EnergyPlusFixture, ExerciseTwoSpeedFluidCooler) bool firstHVAC = true; Real64 curLoad = 0.0; ptr->plantLoc.loopNum = 1; - ptr->plantLoc.loopSideNum = EnergyPlus::DataPlant::LoopSideLocation::Demand; + ptr->plantLoc.loopSideNum = EnergyPlus::DataPlant::LoopSideLocation::Supply; ptr->plantLoc.branchNum = 1; ptr->plantLoc.compNum = 1; ptr->DesWaterMassFlowRate = 3.141; From dee7e5bbf8d5c0b2b0fb26bddad638b455dd5908 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 13 Dec 2024 10:53:20 +0100 Subject: [PATCH 05/11] Add tests for #10817 --- tst/EnergyPlus/unit/FluidCoolers.unit.cc | 41 ++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tst/EnergyPlus/unit/FluidCoolers.unit.cc b/tst/EnergyPlus/unit/FluidCoolers.unit.cc index c6b2e037171..5c67d39a7d9 100644 --- a/tst/EnergyPlus/unit/FluidCoolers.unit.cc +++ b/tst/EnergyPlus/unit/FluidCoolers.unit.cc @@ -508,3 +508,44 @@ TEST_F(EnergyPlusFixture, ExerciseTwoSpeedFluidCooler) state->dataPlnt->PlantLoop(pl.loopNum).LoopSide(pl.loopSideNum).FlowLock = DataPlant::FlowLock::Locked; ptr->simulate(*state, pl, firstHVAC, curLoad, true); } + +TEST_F(EnergyPlusFixture, FluidCooler_SizeWhenPlantSizingIndexIsZeroAndAutosized) +{ + // Test for #10817 + std::string const idf_objects = delimited_string({ + " FluidCooler:SingleSpeed,", + " Dry Cooler, !- Name", + " Dry Cooler Inlet Node, !- Water Inlet Node Name", + " Dry Cooler Outlet Node, !- Water Outlet Node Name", + " NominalCapacity, !- Performance Input Method", + " Autosize, !- Design Air Flow Rate U-factor Times Area Value {W/K}", + " 58601, !- Nominal Capacity {W}", + " 50, !- Design Entering Water Temperature {C}", + " 35, !- Design Entering Air Temperature {C}", + " 25, !- Design Entering Air Wetbulb Temperature {C}", + " Autosize, !- Design Water Flow Rate {m3/s}", + " Autosize, !- Design Air Flow Rate {m3/s}", + " Autosize; !- Design Air Flow Rate Fan Power {W}", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + GetFluidCoolerInput(*state); + int FluidCoolerNum(1); + + state->dataPlnt->PlantLoop.allocate(FluidCoolerNum); + state->dataPlnt->PlantLoop(FluidCoolerNum).PlantSizNum = 0; + + auto &thisFluidCooler = state->dataFluidCoolers->SimpleFluidCooler(FluidCoolerNum); + thisFluidCooler.plantLoc.loopNum = 1; + + // Necessary to trigger the crash from # + state->dataPlnt->PlantFirstSizesOkayToFinalize = false; + + EXPECT_TRUE(thisFluidCooler.DesignWaterFlowRateWasAutoSized); + EXPECT_TRUE(thisFluidCooler.HighSpeedFanPowerWasAutoSized); + EXPECT_TRUE(thisFluidCooler.HighSpeedAirFlowRateWasAutoSized); + EXPECT_TRUE(thisFluidCooler.HighSpeedFluidCoolerUAWasAutoSized); + + thisFluidCooler.size(*state); +} From 69323582d8929f8bcff73af8fefd3cc1206f3dfd Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 13 Dec 2024 10:53:56 +0100 Subject: [PATCH 06/11] Add test: EvaporativeFluidCooler also had the same issue as #10817 --- .../unit/EvaporativeFluidCoolers.unit.cc | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc b/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc index 1e3acb308b3..75db5d8e630 100644 --- a/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc +++ b/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc @@ -306,4 +306,47 @@ TEST_F(EnergyPlusFixture, ExerciseTwoSpeedEvapFluidCooler) ptr->simulate(*state, pl, firstHVAC, curLoad, true); } +TEST_F(EnergyPlusFixture, EvapFluidCooler_SizeWhenPlantSizingIndexIsZeroAndAutosized) +{ + // Test for #10817 + std::string const idf_objects = delimited_string({ + "EvaporativeFluidcooler:SingleSpeed,", + " Big EvaporativeFluidCooler, !- Name", + " Condenser EvaporativeFluidcooler Inlet Node, !- Water Inlet Node Name", + " Condenser EvaporativeFluidcooler Outlet Node, !- Water Outlet Node Name", + " Autosize, !- Design Air Flow Rate {m3/s}", + " Autosize, !- Design Air Flow Rate Fan Power {W}", + " 0.002208, !- Design Spray Water Flow Rate {m3/s}", + " UFactorTimesAreaAndDesignWaterFlowRate, !- Performance Input Method", + " , !- Outdoor Air Inlet Node Name", + " , !- Heat Rejection Capacity and Nominal Capacity Sizing Ratio", + " , !- Standard Design Capacity {W}", + " Autosize, !- Design Air Flow Rate U-factor Times Area Value {W/K}", + " Autosize, !- Design Water Flow Rate {m3/s}", + " , !- User Specified Design Capacity {W}", + " 46.11, !- Design Entering Water Temperature {C}", + " 35, !- Design Entering Air Temperature {C}", + " 25.6; !- Design Entering Air Wet-bulb Temperature {C}", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + EvapFluidCoolerSpecs *ptr = + EvapFluidCoolerSpecs::factory(*state, DataPlant::PlantEquipmentType::EvapFluidCooler_SingleSpd, "BIG EVAPORATIVEFLUIDCOOLER"); + + state->dataPlnt->PlantLoop.allocate(1); + state->dataPlnt->PlantLoop(1).PlantSizNum = 0; + ptr->plantLoc.loopNum = 1; + + // Necessary to trigger the crash from # + state->dataPlnt->PlantFirstSizesOkayToFinalize = false; + + EXPECT_TRUE(ptr->DesignWaterFlowRateWasAutoSized); + EXPECT_TRUE(ptr->HighSpeedAirFlowRateWasAutoSized); + EXPECT_TRUE(ptr->HighSpeedFanPowerWasAutoSized); + EXPECT_TRUE(ptr->HighSpeedEvapFluidCoolerUAWasAutoSized); + + ptr->SizeEvapFluidCooler(*state); +} + } // namespace EnergyPlus From 9e8586b51b58d934e2dbb8b9dbdd8d731d01c1a1 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 13 Dec 2024 12:21:25 +0100 Subject: [PATCH 07/11] Fix #10817 - Avoid crash in FluidCooler/EvaporativeFluidCooler when Water flow rate autosized and no Sizing:Plant --- src/EnergyPlus/EvaporativeFluidCoolers.cc | 61 ++++++++++++----------- src/EnergyPlus/FluidCoolers.cc | 36 ++++++------- 2 files changed, 50 insertions(+), 47 deletions(-) diff --git a/src/EnergyPlus/EvaporativeFluidCoolers.cc b/src/EnergyPlus/EvaporativeFluidCoolers.cc index d3627083a06..99ec418d85f 100644 --- a/src/EnergyPlus/EvaporativeFluidCoolers.cc +++ b/src/EnergyPlus/EvaporativeFluidCoolers.cc @@ -1338,14 +1338,10 @@ namespace EvaporativeFluidCoolers { Real64 constexpr Acc(0.0001); // Accuracy of result std::string const CalledFrom("SizeEvapFluidCooler"); - int SolFla; // Flag of solver - Real64 UA; // Calculated UA value [W/C] - Real64 OutWaterTempAtUA0; // Water outlet temperature at UA0 - Real64 OutWaterTempAtUA1; // Water outlet temperature at UA1 - Real64 DesignEnteringAirWetBulb; // Intermediate variable to check that design exit - // temperature specified in the plant:sizing object - // is higher than the design entering air wet-bulb temp - // when autosize feature is used + int SolFla; // Flag of solver + Real64 UA; // Calculated UA value [W/C] + Real64 OutWaterTempAtUA0; // Water outlet temperature at UA0 + Real64 OutWaterTempAtUA1; // Water outlet temperature at UA1 Real64 DesEvapFluidCoolerLoad = 0.0; // Design evaporative fluid cooler load [W] Real64 tmpDesignWaterFlowRate = this->DesignWaterFlowRate; @@ -1356,6 +1352,33 @@ namespace EvaporativeFluidCoolers { if (this->DesignWaterFlowRateWasAutoSized && this->PerformanceInputMethod_Num != PIM::StandardDesignCapacity) { if (PltSizCondNum > 0) { + + // Check when the user specified Condenser/Evaporative Fluid Cooler water design setpoint + // temperature is less than design inlet air wet bulb temperature + Real64 DesignEnteringAirWetBulb = 0; + if (this->PerformanceInputMethod_Num == PIM::UFactor) { + DesignEnteringAirWetBulb = 25.6; + } else { + DesignEnteringAirWetBulb = this->DesignEnteringAirWetBulbTemp; + } + if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= DesignEnteringAirWetBulb) { + ShowSevereError(state, format("Error when autosizing the UA value for Evaporative Fluid Cooler = {}.", this->Name)); + ShowContinueError(state, + format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air wet-bulb temperature " + "({:.2R} C) when autosizing the Evaporative Fluid Cooler UA.", + state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, + DesignEnteringAirWetBulb)); + ShowContinueError( + state, + "It is recommended that the Design Loop Exit Temperature = Design Entering Air Wet-bulb Temp plus the Evaporative " + "Fluid Cooler design approach temperature (e.g., 4 C)."); + ShowContinueError( + state, + "If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design Setpoint must be " + "> Design Entering Air Wet-bulb Temp if autosizing the Evaporative Fluid Cooler."); + ShowFatalError(state, "Review and revise design input values as appropriate."); + } + if (state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { tmpDesignWaterFlowRate = state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate * this->SizFac; if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->DesignWaterFlowRate = tmpDesignWaterFlowRate; @@ -1380,28 +1403,6 @@ namespace EvaporativeFluidCoolers { ShowFatalError(state, "Autosizing of evaporative fluid cooler condenser flow rate requires a loop Sizing:Plant object."); } } - // Check when the user specified Condenser/Evaporative Fluid Cooler water design setpoint - // temperature is less than design inlet air wet bulb temperature - if (this->PerformanceInputMethod_Num == PIM::UFactor) { - DesignEnteringAirWetBulb = 25.6; - } else { - DesignEnteringAirWetBulb = this->DesignEnteringAirWetBulbTemp; - } - if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= DesignEnteringAirWetBulb) { - ShowSevereError(state, format("Error when autosizing the UA value for Evaporative Fluid Cooler = {}.", this->Name)); - ShowContinueError(state, - format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air wet-bulb temperature " - "({:.2R} C) when autosizing the Evaporative Fluid Cooler UA.", - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - DesignEnteringAirWetBulb)); - ShowContinueError(state, - "It is recommended that the Design Loop Exit Temperature = Design Entering Air Wet-bulb Temp plus the Evaporative " - "Fluid Cooler design approach temperature (e.g., 4 C)."); - ShowContinueError(state, - "If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design Setpoint must be " - "> Design Entering Air Wet-bulb Temp if autosizing the Evaporative Fluid Cooler."); - ShowFatalError(state, "Review and revise design input values as appropriate."); - } } if (this->PerformanceInputMethod_Num == PIM::UFactor && !this->HighSpeedEvapFluidCoolerUAWasAutoSized) { diff --git a/src/EnergyPlus/FluidCoolers.cc b/src/EnergyPlus/FluidCoolers.cc index 0d2e0fcf4f1..6f5847d6050 100644 --- a/src/EnergyPlus/FluidCoolers.cc +++ b/src/EnergyPlus/FluidCoolers.cc @@ -956,6 +956,25 @@ void FluidCoolerspecs::size(EnergyPlusData &state) if (this->DesignWaterFlowRateWasAutoSized) { if (PltSizCondNum > 0) { + // This conditional statement is to trap when the user specified Condenser/Fluid Cooler water design setpoint + // temperature is less than design inlet air dry bulb temperature + if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= this->DesignEnteringAirTemp && + state.dataPlnt->PlantFirstSizesOkayToFinalize) { + ShowSevereError(state, format("Error when autosizing the UA value for fluid cooler = {}.", this->Name)); + ShowContinueError(state, + format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air dry-bulb temperature " + "({:.2R} C) when autosizing the fluid cooler UA.", + state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, + this->DesignEnteringAirTemp)); + ShowContinueError(state, + "It is recommended that the Design Loop Exit Temperature = design inlet air dry-bulb temp plus the Fluid Cooler " + "design approach temperature (e.g., 4 C)."); + ShowContinueError(state, + "If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design Setpoint must be " + "> design inlet air dry-bulb temp if autosizing the Fluid Cooler."); + ShowFatalError(state, "Review and revise design input values as appropriate."); + } + if (state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { tmpDesignWaterFlowRate = state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate; if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->DesignWaterFlowRate = tmpDesignWaterFlowRate; @@ -986,23 +1005,6 @@ void FluidCoolerspecs::size(EnergyPlusData &state) ShowFatalError(state, "Autosizing of fluid cooler condenser flow rate requires a loop Sizing:Plant object."); } } - // This conditional statement is to trap when the user specified Condenser/Fluid Cooler water design setpoint - // temperature is less than design inlet air dry bulb temperature - if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= this->DesignEnteringAirTemp && state.dataPlnt->PlantFirstSizesOkayToFinalize) { - ShowSevereError(state, format("Error when autosizing the UA value for fluid cooler = {}.", this->Name)); - ShowContinueError(state, - format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air dry-bulb temperature " - "({:.2R} C) when autosizing the fluid cooler UA.", - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - this->DesignEnteringAirTemp)); - ShowContinueError(state, - "It is recommended that the Design Loop Exit Temperature = design inlet air dry-bulb temp plus the Fluid Cooler " - "design approach temperature (e.g., 4 C)."); - ShowContinueError(state, - "If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design Setpoint must be " - "> design inlet air dry-bulb temp if autosizing the Fluid Cooler."); - ShowFatalError(state, "Review and revise design input values as appropriate."); - } } PlantUtilities::RegisterPlantCompDesignFlow(state, this->WaterInletNodeNum, tmpDesignWaterFlowRate); From b02725a4b50b44bd1e37f94bdf6eb6194f16a35d Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 13 Dec 2024 12:36:21 +0100 Subject: [PATCH 08/11] Dry up code via a lambda --- src/EnergyPlus/FluidCoolers.cc | 103 ++++++++++----------------------- 1 file changed, 31 insertions(+), 72 deletions(-) diff --git a/src/EnergyPlus/FluidCoolers.cc b/src/EnergyPlus/FluidCoolers.cc index 6f5847d6050..7b7def93c9c 100644 --- a/src/EnergyPlus/FluidCoolers.cc +++ b/src/EnergyPlus/FluidCoolers.cc @@ -954,26 +954,30 @@ void FluidCoolerspecs::size(EnergyPlusData &state) // Find the appropriate Plant Sizing object int PltSizCondNum = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).PlantSizNum; + // This is to trap when the user specified Condenser/Fluid Cooler water design setpoint temperature is less than design inlet air dry bulb + // temperature + auto ensureSizingPlantExitTempIsNotLessThanDesignEnteringAirTemp = [this, &state, PltSizCondNum]() { + if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= this->DesignEnteringAirTemp && state.dataPlnt->PlantFirstSizesOkayToFinalize) { + ShowSevereError(state, format("Error when autosizing the UA value for fluid cooler = {}.", this->Name)); + ShowContinueError(state, + format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air dry-bulb temperature " + "({:.2R} C) when autosizing the fluid cooler UA.", + state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, + this->DesignEnteringAirTemp)); + ShowContinueError(state, + "It is recommended that the Design Loop Exit Temperature = design inlet air dry-bulb temp plus the Fluid Cooler " + "design approach temperature (e.g., 4 C)."); + ShowContinueError(state, + "If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design Setpoint must be " + "> design inlet air dry-bulb temp if autosizing the Fluid Cooler."); + ShowFatalError(state, "Review and revise design input values as appropriate."); + } + }; + if (this->DesignWaterFlowRateWasAutoSized) { if (PltSizCondNum > 0) { - // This conditional statement is to trap when the user specified Condenser/Fluid Cooler water design setpoint - // temperature is less than design inlet air dry bulb temperature - if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= this->DesignEnteringAirTemp && - state.dataPlnt->PlantFirstSizesOkayToFinalize) { - ShowSevereError(state, format("Error when autosizing the UA value for fluid cooler = {}.", this->Name)); - ShowContinueError(state, - format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air dry-bulb temperature " - "({:.2R} C) when autosizing the fluid cooler UA.", - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - this->DesignEnteringAirTemp)); - ShowContinueError(state, - "It is recommended that the Design Loop Exit Temperature = design inlet air dry-bulb temp plus the Fluid Cooler " - "design approach temperature (e.g., 4 C)."); - ShowContinueError(state, - "If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design Setpoint must be " - "> design inlet air dry-bulb temp if autosizing the Fluid Cooler."); - ShowFatalError(state, "Review and revise design input values as appropriate."); - } + + ensureSizingPlantExitTempIsNotLessThanDesignEnteringAirTemp(); if (state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { tmpDesignWaterFlowRate = state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate; @@ -1039,24 +1043,9 @@ void FluidCoolerspecs::size(EnergyPlusData &state) if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->HighSpeedFanPower = tmpHighSpeedFanPower; } else if (PltSizCondNum > 0) { if (state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - // This conditional statement is to trap when the user specified Condenser/Fluid Cooler water design setpoint - // temperature is less than design inlet air dry bulb temperature - if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= this->DesignEnteringAirTemp && - state.dataPlnt->PlantFirstSizesOkayToFinalize) { - ShowSevereError(state, format("Error when autosizing the UA value for fluid cooler = {}.", this->Name)); - ShowContinueError(state, - format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air dry-bulb " - "temperature ({:.2R} C) when autosizing the fluid cooler UA.", - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - this->DesignEnteringAirTemp)); - ShowContinueError(state, - "It is recommended that the Design Loop Exit Temperature = design inlet air dry-bulb temp plus the " - "Fluid Cooler design approach temperature (e.g., 4 C)."); - ShowContinueError(state, - "If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design " - "Setpoint must be > design inlet air dry-bulb temp if autosizing the Fluid Cooler."); - ShowFatalError(state, "Review and revise design input values as appropriate."); - } + + ensureSizingPlantExitTempIsNotLessThanDesignEnteringAirTemp(); + rho = FluidProperties::GetDensityGlycol(state, state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, Constant::InitConvTemp, @@ -1128,24 +1117,9 @@ void FluidCoolerspecs::size(EnergyPlusData &state) if (state.dataPlnt->PlantFirstSizesOkayToFinalize) this->HighSpeedAirFlowRate = tmpHighSpeedAirFlowRate; } else if (PltSizCondNum > 0) { if (state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - // This conditional statement is to trap when the user specified Condenser/Fluid Cooler water design setpoint - // temperature is less than design inlet air dry bulb temperature - if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= this->DesignEnteringAirTemp && - state.dataPlnt->PlantFirstSizesOkayToFinalize) { - ShowSevereError(state, format("Error when autosizing the UA value for fluid cooler = {}.", this->Name)); - ShowContinueError(state, - format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air dry-bulb " - "temperature ({:.2R} C) when autosizing the fluid cooler UA.", - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - this->DesignEnteringAirTemp)); - ShowContinueError(state, - "It is recommended that the Design Loop Exit Temperature = design inlet air dry-bulb temp plus the " - "Fluid Cooler design approach temperature (e.g., 4 C)."); - ShowContinueError(state, - "If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design " - "Setpoint must be > design inlet air dry-bulb temp if autosizing the Fluid Cooler."); - ShowFatalError(state, "Review and revise design input values as appropriate."); - } + + ensureSizingPlantExitTempIsNotLessThanDesignEnteringAirTemp(); + rho = FluidProperties::GetDensityGlycol(state, state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, Constant::InitConvTemp, @@ -1210,24 +1184,9 @@ void FluidCoolerspecs::size(EnergyPlusData &state) if (this->HighSpeedFluidCoolerUAWasAutoSized && state.dataPlnt->PlantFirstSizesOkayToFinalize) { if (PltSizCondNum > 0) { if (state.dataSize->PlantSizData(PltSizCondNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) { - // This conditional statement is to trap when the user specified Condenser/Fluid Cooler water design setpoint - // temperature is less than design inlet air dry bulb temperature - if (state.dataSize->PlantSizData(PltSizCondNum).ExitTemp <= this->DesignEnteringAirTemp && - state.dataPlnt->PlantFirstSizesOkayToFinalize) { - ShowSevereError(state, format("Error when autosizing the UA value for fluid cooler = {}.", this->Name)); - ShowContinueError(state, - format("Design Loop Exit Temperature ({:.2R} C) must be greater than design entering air dry-bulb " - "temperature ({:.2R} C) when autosizing the fluid cooler UA.", - state.dataSize->PlantSizData(PltSizCondNum).ExitTemp, - this->DesignEnteringAirTemp)); - ShowContinueError(state, - "It is recommended that the Design Loop Exit Temperature = design inlet air dry-bulb temp plus the Fluid " - "Cooler design approach temperature (e.g., 4 C)."); - ShowContinueError(state, - "If using HVACTemplate:Plant:ChilledWaterLoop, then check that input field Condenser Water Design Setpoint " - "must be > design inlet air dry-bulb temp if autosizing the Fluid Cooler."); - ShowFatalError(state, "Review and revise design input values as appropriate."); - } + + ensureSizingPlantExitTempIsNotLessThanDesignEnteringAirTemp(); + rho = FluidProperties::GetDensityGlycol(state, state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, Constant::InitConvTemp, From 23fa1802c46cb86ef5cbe736098c5c3b3e225e4a Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 13 Dec 2024 12:58:47 +0100 Subject: [PATCH 09/11] Rename Fluidcooler -> FluidCooler in examples files for easier grepping ``` rg Fluidcool -l | xargs sed -i 's/Fluidcooler/FluidCooler/g' ``` --- testfiles/EvaporativeFluidCooler.idf | 6 +++--- testfiles/EvaporativeFluidCooler_TwoSpeed.idf | 4 ++-- testfiles/FluidCooler.idf | 6 +++--- testfiles/FluidCoolerTwoSpeed.idf | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/testfiles/EvaporativeFluidCooler.idf b/testfiles/EvaporativeFluidCooler.idf index 3cf01f2b174..8e1ff465a3c 100644 --- a/testfiles/EvaporativeFluidCooler.idf +++ b/testfiles/EvaporativeFluidCooler.idf @@ -1678,10 +1678,10 @@ EvaporativeFluidCooler:SingleSpeed, !- Equipment 1 Object Type Big EvaporativeFluidCooler; !- Equipment 1 Name - EvaporativeFluidcooler:SingleSpeed, + EvaporativeFluidCooler:SingleSpeed, Big EvaporativeFluidCooler, !- Name - Condenser EvaporativeFluidcooler Inlet Node, !- Water Inlet Node Name - Condenser EvaporativeFluidcooler Outlet Node, !- Water Outlet Node Name + Condenser EvaporativeFluidCooler Inlet Node, !- Water Inlet Node Name + Condenser EvaporativeFluidCooler Outlet Node, !- Water Outlet Node Name 3.02, !- Design Air Flow Rate {m3/s} 2250, !- Design Air Flow Rate Fan Power {W} 0.002208, !- Design Spray Water Flow Rate {m3/s} diff --git a/testfiles/EvaporativeFluidCooler_TwoSpeed.idf b/testfiles/EvaporativeFluidCooler_TwoSpeed.idf index 51828a63c59..21f6a1dea52 100644 --- a/testfiles/EvaporativeFluidCooler_TwoSpeed.idf +++ b/testfiles/EvaporativeFluidCooler_TwoSpeed.idf @@ -1686,8 +1686,8 @@ EvaporativeFluidCooler:TwoSpeed, Big EvaporativeFluidCooler, !- Name - Condenser EvaporativeFluidcooler Inlet Node, !- Water Inlet Node Name - Condenser EvaporativeFluidcooler Outlet Node, !- Water Outlet Node Name + Condenser EvaporativeFluidCooler Inlet Node, !- Water Inlet Node Name + Condenser EvaporativeFluidCooler Outlet Node, !- Water Outlet Node Name Autosize, !- High Fan Speed Air Flow Rate {m3/s} Autosize, !- High Fan Speed Fan Power {W} autocalculate, !- Low Fan Speed Air Flow Rate {m3/s} diff --git a/testfiles/FluidCooler.idf b/testfiles/FluidCooler.idf index f0df70546be..3888bed4093 100644 --- a/testfiles/FluidCooler.idf +++ b/testfiles/FluidCooler.idf @@ -1535,7 +1535,7 @@ Branch, Condenser Supply FLUIDCOOLER Branch, !- Name , !- Pressure Drop Curve Name - Fluidcooler:SingleSpeed, !- Component 1 Object Type + FluidCooler:SingleSpeed, !- Component 1 Object Type Big FLUIDCOOLER, !- Component 1 Name Condenser FLUIDCOOLER Inlet Node, !- Component 1 Inlet Node Name Condenser FLUIDCOOLER Outlet Node; !- Component 1 Outlet Node Name @@ -1676,10 +1676,10 @@ CondenserEquipmentList, All FLUIDCOOLERs, !- Name - Fluidcooler:SingleSpeed, !- Equipment 1 Object Type + FluidCooler:SingleSpeed, !- Equipment 1 Object Type Big FLUIDCOOLER; !- Equipment 1 Name - Fluidcooler:SingleSpeed, + FluidCooler:SingleSpeed, Big FLUIDCOOLER, !- Name Condenser FLUIDCOOLER Inlet Node, !- Water Inlet Node Name Condenser FLUIDCOOLER Outlet Node, !- Water Outlet Node Name diff --git a/testfiles/FluidCoolerTwoSpeed.idf b/testfiles/FluidCoolerTwoSpeed.idf index 4744e939a38..5a55fbed406 100644 --- a/testfiles/FluidCoolerTwoSpeed.idf +++ b/testfiles/FluidCoolerTwoSpeed.idf @@ -1690,7 +1690,7 @@ CondenserEquipmentList, All FluidCoolers, !- Name - Fluidcooler:TwoSpeed, !- Equipment 1 Object Type + FluidCooler:TwoSpeed, !- Equipment 1 Object Type Big FluidCooler; !- Equipment 1 Name FluidCooler:TwoSpeed, From a179c0d99ddc4e4f25698d984800c66dd9b85423 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 13 Dec 2024 13:40:39 +0100 Subject: [PATCH 10/11] Increase num sig digits from default=2 to 6 to report the **Water** Flow Rate (m3/s) --- src/EnergyPlus/FluidCoolers.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/EnergyPlus/FluidCoolers.cc b/src/EnergyPlus/FluidCoolers.cc index 7b7def93c9c..a13f590d5bb 100644 --- a/src/EnergyPlus/FluidCoolers.cc +++ b/src/EnergyPlus/FluidCoolers.cc @@ -1603,7 +1603,8 @@ void FluidCoolerspecs::size(EnergyPlusData &state) state, state.dataOutRptPredefined->pdchCTFCDesFanPwr, this->Name, this->HighSpeedFanPower); // equivalent to Design Fan Power? OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchCTFCDesInletAirWBT, this->Name, this->DesignEnteringAirWetBulbTemp); - OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCTFCDesWaterFlowRate, this->Name, this->DesignWaterFlowRate); + OutputReportPredefined::PreDefTableEntry( + state, state.dataOutRptPredefined->pdchCTFCDesWaterFlowRate, this->Name, this->DesignWaterFlowRate, 6); OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCTFCLevWaterSPTemp, this->Name, this->DesignLeavingWaterTemp); } From 4aaa7c0b09bd71c8552498138592c753d9761bc3 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 13 Dec 2024 13:41:19 +0100 Subject: [PATCH 11/11] Calculate DesignLeavingWaterTemp in all cases, since it's reported (and used to report Range & Approach) --- src/EnergyPlus/FluidCoolers.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/EnergyPlus/FluidCoolers.cc b/src/EnergyPlus/FluidCoolers.cc index a13f590d5bb..3e4656c8d71 100644 --- a/src/EnergyPlus/FluidCoolers.cc +++ b/src/EnergyPlus/FluidCoolers.cc @@ -1572,6 +1572,24 @@ void FluidCoolerspecs::size(EnergyPlusData &state) ErrorsFound = false; if (state.dataPlnt->PlantFinalSizesOkayToReport) { + + if (this->DesignLeavingWaterTemp <= HVAC::SmallTempDiff) { + this->WaterTemp = this->DesignEnteringWaterTemp; // design inlet water temperature + this->AirTemp = this->DesignEnteringAirTemp; // design inlet air dry-bulb temp + this->AirWetBulb = this->DesignEnteringAirWetBulbTemp; // design inlet air wet-bulb temp + this->AirPress = state.dataEnvrn->StdBaroPress; + this->AirHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, this->AirTemp, this->AirWetBulb, this->AirPress); + Real64 OutletTemp = 0; + rho = FluidProperties::GetDensityGlycol(state, + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidName, + Constant::InitConvTemp, + state.dataPlnt->PlantLoop(this->plantLoc.loopNum).FluidIndex, + CalledFrom); + CalcFluidCoolerOutlet( + state, this->indexInArray, rho * this->DesignWaterFlowRate, this->HighSpeedAirFlowRate, this->HighSpeedFluidCoolerUA, OutletTemp); + this->DesignLeavingWaterTemp = OutletTemp; + } + // create predefined report OutputReportPredefined::PreDefTableEntry( state, state.dataOutRptPredefined->pdchMechType, this->Name, DataPlant::PlantEquipTypeNames[static_cast(this->FluidCoolerType)]);