From 004a60823c651376b1db1f0b99cb2b935277d225 Mon Sep 17 00:00:00 2001 From: "Lerond, Jeremy" Date: Mon, 16 Dec 2024 15:59:42 -0800 Subject: [PATCH 1/3] Fix reference ID. --- src/EnergyPlus/CondenserLoopTowers.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/CondenserLoopTowers.cc b/src/EnergyPlus/CondenserLoopTowers.cc index 4276c98e3e0..2402389b364 100644 --- a/src/EnergyPlus/CondenserLoopTowers.cc +++ b/src/EnergyPlus/CondenserLoopTowers.cc @@ -1017,7 +1017,7 @@ namespace CondenserLoopTowers { state, UniqueSimpleTowerNames, AlphArray(1), cCurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); auto &tower = state.dataCondenserLoopTowers->towers(TowerNum); - tower.VSTower = VariableSpeedTowerNumber; + tower.VSTower = TowerNum; tower.Name = AlphArray(1); tower.TowerType = DataPlant::PlantEquipmentType::CoolingTower_VarSpd; tower.WaterInletNodeNum = NodeInputManager::GetOnlySingleNode(state, From b9aad5581aede148c0bd94c08b083e4ae5b2aac2 Mon Sep 17 00:00:00 2001 From: "Lerond, Jeremy" Date: Mon, 16 Dec 2024 21:29:27 -0800 Subject: [PATCH 2/3] Add unit test. --- .../unit/CondenserLoopTowers.unit.cc | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc b/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc index 41e89f21271..d8ae7ce9cd3 100644 --- a/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc +++ b/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc @@ -4386,4 +4386,92 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_checkMassFlowAndLoadTest) EXPECT_NEAR(expectedPower, tower.BasinHeaterPower, allowedTolerance); } +TEST_F(EnergyPlusFixture, CondenserLoopTowers_checkTowerIndices) +{ + std::string const idf_objects = delimited_string({ + " CoolingTower:VariableSpeed,", + " CoolingTower-plant_loops-170, !- Name", + " Node 40, !- Water Inlet Node Name", + " Node 41, !- Water Outlet Node Name", + " YorkCalc, !- Model Type", + " , !- Model Coefficient Name", + " 25, !- Design Inlet Air Wet-Bulb Temperature {C}", + " 4.44, !- Design Approach Temperature {deltaC}", + " 5.56, !- Design Range Temperature {deltaC}", + " autosize, !- Design Water Flow Rate {m3/s}", + " Autosize, !- Design Air Flow Rate {m3/s}", + " 3544.15691546004, !- Design Fan Power {W}", + " Variable Speed Cooling Tower Fan Power Ratio Function of Air Flow Rate, !- Fan Power Ratio Function of Air Flow Rate Ratio Curve Name", + " 0.25, !- Minimum Air Flow Rate Ratio", + " 0.125, !- Fraction of Tower Capacity in Free Convection Regime", + " 0, !- Basin Heater Capacity {W/K}", + " 2, !- Basin Heater Setpoint Temperature {C}", + " , !- Basin Heater Operating Schedule Name", + " LossFactor, !- Evaporation Loss Mode", + " 0.2, !- Evaporation Loss Factor {percent/K}", + " 0.008, !- Drift Loss Percent {percent}", + " ConcentrationRatio, !- Blowdown Calculation Mode", + " 3, !- Blowdown Concentration Ratio", + " , !- Blowdown Makeup Water Usage Schedule Name", + " , !- Supply Water Storage Tank Name", + " , !- Outdoor Air Inlet Node Name", + " 2, !- Number of Cells", + " MaximalCell, !- Cell Control", + " 0.25, !- Cell Minimum Water Flow Rate Fraction", + " 2.5, !- Cell Maximum Water Flow Rate Fraction", + " 1, !- Sizing Factor", + " General; !- End-Use Subcategory", + " CoolingTower:TwoSpeed,", + " TowerWaterSys CoolTower1,!- Name", + " TowerWaterSys Pump-TowerWaterSys CoolTowerNode, !- Water Inlet Node Name", + " TowerWaterSys Supply Equipment Outlet Node, !- Water Outlet Node Name", + " , !- Design Water Flow Rate {m3/s}", + " AUTOSIZE, !- High Fan Speed Air Flow Rate {m3/s}", + " AUTOSIZE, !- High Fan Speed Fan Power {W}", + " , !- High Fan Speed U-Factor Times Area Value {W/K}", + " autocalculate, !- Low Fan Speed Air Flow Rate {m3/s}", + " , !- Low Fan Speed Air Flow Rate Sizing Factor", + " AUTOSIZE, !- Low Fan Speed Fan Power {W}", + " , !- Low Fan Speed Fan Power Sizing Factor", + " AUTOSIZE, !- Low Fan Speed U-Factor Times Area Value {W/K}", + " , !- Low Fan Speed U-Factor Times Area Sizing Factor", + " 0.9, !- Free Convection Regime Air Flow Rate {m3/s}", + " , !- Free Convection Regime Air Flow Rate Sizing Factor", + " autocalculate, !- Free Convection Regime U-Factor Times Area Value {W/K}", + " , !- Free Convection U-Factor Times Area Value Sizing Factor", + " NominalCapacity, !- Performance Input Method", + " , !- Heat Rejection Capacity and Nominal Capacity Sizing Ratio", + " 1E+5, !- High Speed Nominal Capacity {W}", + " 1E+4, !- Low Speed Nominal Capacity {W}", + " , !- Low Speed Nominal Capacity Sizing Factor", + " 5E+3, !- Free Convection Nominal Capacity {W}", + " , !- Free Convection Nominal Capacity Sizing Factor", + " 35.0, !- Design Inlet Air Dry-Bulb Temperature", + " 25.6, !- Design Inlet Air Wet-Bulb Temperature", + " 3.9, !- Design Approach Temperature", + " 5.5, !- Design Range Temperature", + " , !- Basin Heater Capacity {W/K}", + " , !- Basin Heater Setpoint Temperature {C}", + " , !- Basin Heater Operating Schedule Name", + " , !- Evaporation Loss Mode", + " , !- Evaporation Loss Factor {percent/K}", + " , !- Drift Loss Percent {percent}", + " , !- Blowdown Calculation Mode", + " , !- Blowdown Concentration Ratio", + " , !- Blowdown Makeup Water Usage Schedule Name", + " , !- Supply Water Storage Tank Name", + " ; !- Outdoor Air Inlet Node Name", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + // cooling tower get input + CondenserLoopTowers::GetTowerInput(*state); + int index; + index = Util::FindItemInList("COOLINGTOWER-PLANT_LOOPS-170", state->dataCondenserLoopTowers->towers); + EXPECT_TRUE(index == 2); + + index = Util::FindItemInList("TOWERWATERSYS COOLTOWER1", state->dataCondenserLoopTowers->towers); + EXPECT_TRUE(index == 1); +} + } // namespace EnergyPlus From a1f3094a96af9f788fbc59d475ebb842c03e4872 Mon Sep 17 00:00:00 2001 From: "Lerond, Jeremy" Date: Fri, 20 Dec 2024 15:01:52 -0800 Subject: [PATCH 3/3] Address review comments. --- src/EnergyPlus/CondenserLoopTowers.cc | 349 ++++++++++++-------------- src/EnergyPlus/CondenserLoopTowers.hh | 1 - 2 files changed, 166 insertions(+), 184 deletions(-) diff --git a/src/EnergyPlus/CondenserLoopTowers.cc b/src/EnergyPlus/CondenserLoopTowers.cc index 2402389b364..9e91dcfd5ba 100644 --- a/src/EnergyPlus/CondenserLoopTowers.cc +++ b/src/EnergyPlus/CondenserLoopTowers.cc @@ -1017,7 +1017,6 @@ namespace CondenserLoopTowers { state, UniqueSimpleTowerNames, AlphArray(1), cCurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); auto &tower = state.dataCondenserLoopTowers->towers(TowerNum); - tower.VSTower = TowerNum; tower.Name = AlphArray(1); tower.TowerType = DataPlant::PlantEquipmentType::CoolingTower_VarSpd; tower.WaterInletNodeNum = NodeInputManager::GetOnlySingleNode(state, @@ -1075,7 +1074,7 @@ namespace CondenserLoopTowers { } } - auto &vstower = state.dataCondenserLoopTowers->towers(tower.VSTower); + auto &vstower = state.dataCondenserLoopTowers->towers(TowerNum); if (Util::SameString(AlphArray(4), "CoolToolsCrossFlow")) { tower.TowerModelType = ModelType::CoolToolsXFModel; @@ -3275,12 +3274,9 @@ namespace CondenserLoopTowers { // check range for water flow rate ratio (make sure RegulaFalsi converges) Real64 MaxWaterFlowRateRatio = 0.5; // maximum water flow rate ratio which yields desired approach temp Real64 Tapproach = 0.0; // temporary tower approach temp variable [C] - Real64 const FlowRateRatioStep = (state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio - - state.dataCondenserLoopTowers->towers(this->VSTower).MinWaterFlowRatio) / - 10.0; + Real64 const FlowRateRatioStep = (this->MaxWaterFlowRatio - this->MinWaterFlowRatio) / 10.0; bool ModelCalibrated = true; - Real64 ModelWaterFlowRatioMax = state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio * - 4.0; // maximum water flow rate ratio used for model calibration + Real64 ModelWaterFlowRatioMax = this->MaxWaterFlowRatio * 4.0; // maximum water flow rate ratio used for model calibration // find a flow rate large enough to provide an approach temperature > than the user defined approach Real64 WaterFlowRateRatio(0.0); // tower water flow rate ratio while (Tapproach < this->DesignApproach && MaxWaterFlowRateRatio <= ModelWaterFlowRatioMax) { @@ -3331,15 +3327,14 @@ namespace CondenserLoopTowers { this->CalibratedWaterFlowRate = this->DesignWaterFlowRate / WaterFlowRatio; - if (WaterFlowRatio < state.dataCondenserLoopTowers->towers(this->VSTower).MinWaterFlowRatio || - WaterFlowRatio > state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio) { + if (WaterFlowRatio < this->MinWaterFlowRatio || WaterFlowRatio > this->MaxWaterFlowRatio) { ShowWarningError(state, format("CoolingTower:VariableSpeed, \"{}\" the calibrated water flow rate ratio is determined to be {:9.6F}. This " "is outside the valid range of {:.2F} to {:.2F}.", this->Name, WaterFlowRatio, - state.dataCondenserLoopTowers->towers(this->VSTower).MinWaterFlowRatio, - state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio)); + this->MinWaterFlowRatio, + this->MaxWaterFlowRatio)); } Real64 const rho = FluidProperties::GetDensityGlycol(state, @@ -5366,20 +5361,20 @@ namespace CondenserLoopTowers { // the warning for the last iteration only. Must wait for next time step to accomplish this. // If a warning occurs and the simulation down shifts, the warning is not valid. if (CurrentEndTime > this->CurrentEndTimeLast && state.dataHVACGlobal->TimeStepSys >= this->TimeStepSysLast) { - if (state.dataCondenserLoopTowers->towers(this->VSTower).PrintLGMessage) { - ++state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountFlowFrac; + if (this->PrintLGMessage) { + ++this->VSErrorCountFlowFrac; // Show single warning and pass additional info to ShowRecurringWarningErrorAtEnd - if (state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountFlowFrac < 2) { - ShowWarningError(state, state.dataCondenserLoopTowers->towers(this->VSTower).LGBuffer1); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).LGBuffer2); + if (this->VSErrorCountFlowFrac < 2) { + ShowWarningError(state, this->LGBuffer1); + ShowContinueError(state, this->LGBuffer2); } else { ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Liquid to gas ratio is out of range error continues...", DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], this->Name), - state.dataCondenserLoopTowers->towers(this->VSTower).ErrIndexLG, - state.dataCondenserLoopTowers->towers(this->VSTower).LGLast, - state.dataCondenserLoopTowers->towers(this->VSTower).LGLast); + this->ErrIndexLG, + this->LGLast, + this->LGLast); } } } @@ -5390,28 +5385,26 @@ namespace CondenserLoopTowers { // warn user on first occurrence if flow fraction is greater than maximum for the YorkCalc model, use recurring warning stats if (this->TowerModelType == ModelType::YorkCalcModel || this->TowerModelType == ModelType::YorkCalcUserDefined) { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintLGMessage = false; + this->PrintLGMessage = false; // Do not report error message in free convection regime if (this->airFlowRateRatio > this->MinimumVSAirFlowFrac) { Real64 const FlowFraction = WaterFlowRateRatioCapped / this->airFlowRateRatio; // Flow fractions greater than a MaxLiquidToGasRatio of 8 are not reliable using the YorkCalc model - if (FlowFraction > state.dataCondenserLoopTowers->towers(this->VSTower).MaxLiquidToGasRatio) { + if (FlowFraction > this->MaxLiquidToGasRatio) { // Report warnings only during actual simulation if (!state.dataGlobal->WarmupFlag) { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintLGMessage = true; - state.dataCondenserLoopTowers->towers(this->VSTower).LGBuffer1 = - format("{} \"{}\" - Liquid to gas ratio (L/G) is out of range at {:5.2F}.", - DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], - this->Name, - FlowFraction); - state.dataCondenserLoopTowers->towers(this->VSTower).LGBuffer2 = - format(" ...Valid maximum ratio = {:5.2F}. Occurrence info = {}, {} {}", - state.dataCondenserLoopTowers->towers(this->VSTower).MaxLiquidToGasRatio, - state.dataEnvrn->EnvironmentName, - state.dataEnvrn->CurMnDy, - General::CreateSysTimeIntervalString(state)); - - state.dataCondenserLoopTowers->towers(this->VSTower).LGLast = FlowFraction; + this->PrintLGMessage = true; + this->LGBuffer1 = format("{} \"{}\" - Liquid to gas ratio (L/G) is out of range at {:5.2F}.", + DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], + this->Name, + FlowFraction); + this->LGBuffer2 = format(" ...Valid maximum ratio = {:5.2F}. Occurrence info = {}, {} {}", + this->MaxLiquidToGasRatio, + state.dataEnvrn->EnvironmentName, + state.dataEnvrn->CurMnDy, + General::CreateSysTimeIntervalString(state)); + + this->LGLast = FlowFraction; } } } @@ -5902,39 +5895,38 @@ namespace CondenserLoopTowers { // York International Corporation, "YORKcalcTM Software, Chiller-Plant Energy-Estimating Program", // Form 160.00-SG2 (0502). 2002. - auto &tower = state.dataCondenserLoopTowers->towers(this->VSTower); if (this->TowerModelType == ModelType::YorkCalcModel || this->TowerModelType == ModelType::YorkCalcUserDefined) { Real64 PctAirFlow = airFlowRatioLocal; Real64 FlowFactor = PctWaterFlow / PctAirFlow; - return tower.Coeff[0] + tower.Coeff[1] * Twb + tower.Coeff[2] * Twb * Twb + tower.Coeff[3] * Tr + tower.Coeff[4] * Twb * Tr + - tower.Coeff[5] * Twb * Twb * Tr + tower.Coeff[6] * Tr * Tr + tower.Coeff[7] * Twb * Tr * Tr + - tower.Coeff[8] * Twb * Twb * Tr * Tr + tower.Coeff[9] * FlowFactor + tower.Coeff[10] * Twb * FlowFactor + - tower.Coeff[11] * Twb * Twb * FlowFactor + tower.Coeff[12] * Tr * FlowFactor + tower.Coeff[13] * Twb * Tr * FlowFactor + - tower.Coeff[14] * Twb * Twb * Tr * FlowFactor + tower.Coeff[15] * Tr * Tr * FlowFactor + - tower.Coeff[16] * Twb * Tr * Tr * FlowFactor + tower.Coeff[17] * Twb * Twb * Tr * Tr * FlowFactor + - tower.Coeff[18] * FlowFactor * FlowFactor + tower.Coeff[19] * Twb * FlowFactor * FlowFactor + - tower.Coeff[20] * Twb * Twb * FlowFactor * FlowFactor + tower.Coeff[21] * Tr * FlowFactor * FlowFactor + - tower.Coeff[22] * Twb * Tr * FlowFactor * FlowFactor + tower.Coeff[23] * Twb * Twb * Tr * FlowFactor * FlowFactor + - tower.Coeff[24] * Tr * Tr * FlowFactor * FlowFactor + tower.Coeff[25] * Twb * Tr * Tr * FlowFactor * FlowFactor + - tower.Coeff[26] * Twb * Twb * Tr * Tr * FlowFactor * FlowFactor; + return this->Coeff[0] + this->Coeff[1] * Twb + this->Coeff[2] * Twb * Twb + this->Coeff[3] * Tr + this->Coeff[4] * Twb * Tr + + this->Coeff[5] * Twb * Twb * Tr + this->Coeff[6] * Tr * Tr + this->Coeff[7] * Twb * Tr * Tr + + this->Coeff[8] * Twb * Twb * Tr * Tr + this->Coeff[9] * FlowFactor + this->Coeff[10] * Twb * FlowFactor + + this->Coeff[11] * Twb * Twb * FlowFactor + this->Coeff[12] * Tr * FlowFactor + this->Coeff[13] * Twb * Tr * FlowFactor + + this->Coeff[14] * Twb * Twb * Tr * FlowFactor + this->Coeff[15] * Tr * Tr * FlowFactor + + this->Coeff[16] * Twb * Tr * Tr * FlowFactor + this->Coeff[17] * Twb * Twb * Tr * Tr * FlowFactor + + this->Coeff[18] * FlowFactor * FlowFactor + this->Coeff[19] * Twb * FlowFactor * FlowFactor + + this->Coeff[20] * Twb * Twb * FlowFactor * FlowFactor + this->Coeff[21] * Tr * FlowFactor * FlowFactor + + this->Coeff[22] * Twb * Tr * FlowFactor * FlowFactor + this->Coeff[23] * Twb * Twb * Tr * FlowFactor * FlowFactor + + this->Coeff[24] * Tr * Tr * FlowFactor * FlowFactor + this->Coeff[25] * Twb * Tr * Tr * FlowFactor * FlowFactor + + this->Coeff[26] * Twb * Twb * Tr * Tr * FlowFactor * FlowFactor; } else { // empirical model is CoolTools format // the CoolTools model actually uses PctFanPower = AirFlowRatio^3 as an input to the model Real64 PctAirFlow = pow_3(airFlowRatioLocal); - return tower.Coeff[0] + tower.Coeff[1] * PctAirFlow + tower.Coeff[2] * PctAirFlow * PctAirFlow + - tower.Coeff[3] * PctAirFlow * PctAirFlow * PctAirFlow + tower.Coeff[4] * PctWaterFlow + - tower.Coeff[5] * PctAirFlow * PctWaterFlow + tower.Coeff[6] * PctAirFlow * PctAirFlow * PctWaterFlow + - tower.Coeff[7] * PctWaterFlow * PctWaterFlow + tower.Coeff[8] * PctAirFlow * PctWaterFlow * PctWaterFlow + - tower.Coeff[9] * PctWaterFlow * PctWaterFlow * PctWaterFlow + tower.Coeff[10] * Twb + tower.Coeff[11] * PctAirFlow * Twb + - tower.Coeff[12] * PctAirFlow * PctAirFlow * Twb + tower.Coeff[13] * PctWaterFlow * Twb + - tower.Coeff[14] * PctAirFlow * PctWaterFlow * Twb + tower.Coeff[15] * PctWaterFlow * PctWaterFlow * Twb + - tower.Coeff[16] * Twb * Twb + tower.Coeff[17] * PctAirFlow * Twb * Twb + tower.Coeff[18] * PctWaterFlow * Twb * Twb + - tower.Coeff[19] * Twb * Twb * Twb + tower.Coeff[20] * Tr + tower.Coeff[21] * PctAirFlow * Tr + - tower.Coeff[22] * PctAirFlow * PctAirFlow * Tr + tower.Coeff[23] * PctWaterFlow * Tr + - tower.Coeff[24] * PctAirFlow * PctWaterFlow * Tr + tower.Coeff[25] * PctWaterFlow * PctWaterFlow * Tr + - tower.Coeff[26] * Twb * Tr + tower.Coeff[27] * PctAirFlow * Twb * Tr + tower.Coeff[28] * PctWaterFlow * Twb * Tr + - tower.Coeff[29] * Twb * Twb * Tr + tower.Coeff[30] * Tr * Tr + tower.Coeff[31] * PctAirFlow * Tr * Tr + - tower.Coeff[32] * PctWaterFlow * Tr * Tr + tower.Coeff[33] * Twb * Tr * Tr + tower.Coeff[34] * Tr * Tr * Tr; + return this->Coeff[0] + this->Coeff[1] * PctAirFlow + this->Coeff[2] * PctAirFlow * PctAirFlow + + this->Coeff[3] * PctAirFlow * PctAirFlow * PctAirFlow + this->Coeff[4] * PctWaterFlow + + this->Coeff[5] * PctAirFlow * PctWaterFlow + this->Coeff[6] * PctAirFlow * PctAirFlow * PctWaterFlow + + this->Coeff[7] * PctWaterFlow * PctWaterFlow + this->Coeff[8] * PctAirFlow * PctWaterFlow * PctWaterFlow + + this->Coeff[9] * PctWaterFlow * PctWaterFlow * PctWaterFlow + this->Coeff[10] * Twb + this->Coeff[11] * PctAirFlow * Twb + + this->Coeff[12] * PctAirFlow * PctAirFlow * Twb + this->Coeff[13] * PctWaterFlow * Twb + + this->Coeff[14] * PctAirFlow * PctWaterFlow * Twb + this->Coeff[15] * PctWaterFlow * PctWaterFlow * Twb + + this->Coeff[16] * Twb * Twb + this->Coeff[17] * PctAirFlow * Twb * Twb + this->Coeff[18] * PctWaterFlow * Twb * Twb + + this->Coeff[19] * Twb * Twb * Twb + this->Coeff[20] * Tr + this->Coeff[21] * PctAirFlow * Tr + + this->Coeff[22] * PctAirFlow * PctAirFlow * Tr + this->Coeff[23] * PctWaterFlow * Tr + + this->Coeff[24] * PctAirFlow * PctWaterFlow * Tr + this->Coeff[25] * PctWaterFlow * PctWaterFlow * Tr + + this->Coeff[26] * Twb * Tr + this->Coeff[27] * PctAirFlow * Twb * Tr + this->Coeff[28] * PctWaterFlow * Twb * Tr + + this->Coeff[29] * Twb * Twb * Tr + this->Coeff[30] * Tr * Tr + this->Coeff[31] * PctAirFlow * Tr * Tr + + this->Coeff[32] * PctWaterFlow * Tr * Tr + this->Coeff[33] * Twb * Tr * Tr + this->Coeff[34] * Tr * Tr * Tr; } } @@ -5988,12 +5980,12 @@ namespace CondenserLoopTowers { // the warning for the last iteration only. Must wait for next time step to accomplish this. // If a warning occurs and the simulation down shifts, the warning is not valid. if (CurrentEndTime > this->CurrentEndTimeLast && state.dataHVACGlobal->TimeStepSys >= this->TimeStepSysLast) { - if (state.dataCondenserLoopTowers->towers(this->VSTower).PrintTrMessage) { - ++state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountTR; - if (state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountTR < 2) { - ShowWarningError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TrBuffer1); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TrBuffer2); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TrBuffer3); + if (this->PrintTrMessage) { + ++this->VSErrorCountTR; + if (this->VSErrorCountTR < 2) { + ShowWarningError(state, this->TrBuffer1); + ShowContinueError(state, this->TrBuffer2); + ShowContinueError(state, this->TrBuffer3); ShowContinueError(state, " ...Range temperatures outside model boundaries may not adversely affect tower performance."); ShowContinueError(state, " ...This is not an unexpected occurrence when simulating actual conditions."); } else { @@ -6001,34 +5993,34 @@ namespace CondenserLoopTowers { format("{} \"{}\" - Tower range temperature is out of range error continues...", DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], this->Name), - state.dataCondenserLoopTowers->towers(this->VSTower).ErrIndexTR, - state.dataCondenserLoopTowers->towers(this->VSTower).TrLast, - state.dataCondenserLoopTowers->towers(this->VSTower).TrLast); + this->ErrIndexTR, + this->TrLast, + this->TrLast); } } - if (state.dataCondenserLoopTowers->towers(this->VSTower).PrintTwbMessage) { - ++state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountIAWB; - if (state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountIAWB < 6) { - ShowWarningError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TwbBuffer1); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TwbBuffer2); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TwbBuffer3); + if (this->PrintTwbMessage) { + ++this->VSErrorCountIAWB; + if (this->VSErrorCountIAWB < 6) { + ShowWarningError(state, this->TwbBuffer1); + ShowContinueError(state, this->TwbBuffer2); + ShowContinueError(state, this->TwbBuffer3); ShowContinueError(state, " ...Wet-bulb temperatures outside model boundaries may not adversely affect tower performance."); } else { ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Inlet air wet-bulb temperature is out of range error continues...", DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], this->Name), - state.dataCondenserLoopTowers->towers(this->VSTower).ErrIndexIAWB, - state.dataCondenserLoopTowers->towers(this->VSTower).TwbLast, - state.dataCondenserLoopTowers->towers(this->VSTower).TwbLast); + this->ErrIndexIAWB, + this->TwbLast, + this->TwbLast); } } - if (state.dataCondenserLoopTowers->towers(this->VSTower).PrintTaMessage) { - ++state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountTA; - if (state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountTA < 2) { - ShowWarningError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TaBuffer1); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TaBuffer2); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).TaBuffer3); + if (this->PrintTaMessage) { + ++this->VSErrorCountTA; + if (this->VSErrorCountTA < 2) { + ShowWarningError(state, this->TaBuffer1); + ShowContinueError(state, this->TaBuffer2); + ShowContinueError(state, this->TaBuffer3); ShowContinueError(state, " ...Approach temperatures outside model boundaries may not adversely affect tower performance."); ShowContinueError(state, " ...This is not an unexpected occurrence when simulating actual conditions."); } else { @@ -6036,26 +6028,26 @@ namespace CondenserLoopTowers { format("{} \"{}\" - Tower approach temperature is out of range error continues...", DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], this->Name), - state.dataCondenserLoopTowers->towers(this->VSTower).ErrIndexTA, - state.dataCondenserLoopTowers->towers(this->VSTower).TaLast, - state.dataCondenserLoopTowers->towers(this->VSTower).TaLast); + this->ErrIndexTA, + this->TaLast, + this->TaLast); } } - if (state.dataCondenserLoopTowers->towers(this->VSTower).PrintWFRRMessage) { - ++state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountWFRR; - if (state.dataCondenserLoopTowers->towers(this->VSTower).VSErrorCountWFRR < 6) { - ShowWarningError(state, state.dataCondenserLoopTowers->towers(this->VSTower).WFRRBuffer1); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).WFRRBuffer2); - ShowContinueError(state, state.dataCondenserLoopTowers->towers(this->VSTower).WFRRBuffer3); + if (this->PrintWFRRMessage) { + ++this->VSErrorCountWFRR; + if (this->VSErrorCountWFRR < 6) { + ShowWarningError(state, this->WFRRBuffer1); + ShowContinueError(state, this->WFRRBuffer2); + ShowContinueError(state, this->WFRRBuffer3); ShowContinueError(state, " ...Water flow rate ratios outside model boundaries may not adversely affect tower performance."); } else { ShowRecurringWarningErrorAtEnd(state, format("{} \"{}\" - Water flow rate ratio is out of range error continues...", DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], this->Name), - state.dataCondenserLoopTowers->towers(this->VSTower).ErrIndexWFRR, - state.dataCondenserLoopTowers->towers(this->VSTower).WaterFlowRateRatioLast, - state.dataCondenserLoopTowers->towers(this->VSTower).WaterFlowRateRatioLast); + this->ErrIndexWFRR, + this->WaterFlowRateRatioLast, + this->WaterFlowRateRatioLast); } } } @@ -6065,134 +6057,125 @@ namespace CondenserLoopTowers { this->CurrentEndTimeLast = CurrentEndTime; // check boundaries of independent variables and post warnings to individual buffers to print at end of time step - if (Twb < state.dataCondenserLoopTowers->towers(this->VSTower).MinInletAirWBTemp || - Twb > state.dataCondenserLoopTowers->towers(this->VSTower).MaxInletAirWBTemp) { + if (Twb < this->MinInletAirWBTemp || Twb > this->MaxInletAirWBTemp) { OutputChar = format("{:.2R}", Twb); - OutputCharLo = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MinInletAirWBTemp); - OutputCharHi = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MaxInletAirWBTemp); - if (Twb < state.dataCondenserLoopTowers->towers(this->VSTower).MinInletAirWBTemp) { - TwbCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MinInletAirWBTemp; + OutputCharLo = format("{:.2R}", this->MinInletAirWBTemp); + OutputCharHi = format("{:.2R}", this->MaxInletAirWBTemp); + if (Twb < this->MinInletAirWBTemp) { + TwbCapped = this->MinInletAirWBTemp; } - if (Twb > state.dataCondenserLoopTowers->towers(this->VSTower).MaxInletAirWBTemp) { - TwbCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MaxInletAirWBTemp; + if (Twb > this->MaxInletAirWBTemp) { + TwbCapped = this->MaxInletAirWBTemp; } if (!state.dataGlobal->WarmupFlag) { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTwbMessage = true; - state.dataCondenserLoopTowers->towers(this->VSTower).TwbBuffer1 = - format("{} \"{}\" - Inlet air wet-bulb temperature is outside model boundaries at {}.", - DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], - this->Name, - OutputChar); - state.dataCondenserLoopTowers->towers(this->VSTower).TwbBuffer2 = - " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + - state.dataEnvrn->CurMnDy + ' ' + General::CreateSysTimeIntervalString(state); + this->PrintTwbMessage = true; + this->TwbBuffer1 = format("{} \"{}\" - Inlet air wet-bulb temperature is outside model boundaries at {}.", + DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], + this->Name, + OutputChar); + this->TwbBuffer2 = " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + + General::CreateSysTimeIntervalString(state); TrimValue = format("{:.6R}", TwbCapped); - state.dataCondenserLoopTowers->towers(this->VSTower).TwbBuffer3 = - " ...Inlet air wet-bulb temperature passed to the model = " + TrimValue; - state.dataCondenserLoopTowers->towers(this->VSTower).TwbLast = Twb; + this->TwbBuffer3 = " ...Inlet air wet-bulb temperature passed to the model = " + TrimValue; + this->TwbLast = Twb; } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTwbMessage = false; + this->PrintTwbMessage = false; } } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTwbMessage = false; + this->PrintTwbMessage = false; } - if (Tr < state.dataCondenserLoopTowers->towers(this->VSTower).MinRangeTemp || - Tr > state.dataCondenserLoopTowers->towers(this->VSTower).MaxRangeTemp) { + if (Tr < this->MinRangeTemp || Tr > this->MaxRangeTemp) { OutputChar = format("{:.2R}", Tr); - OutputCharLo = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MinRangeTemp); - OutputCharHi = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MaxRangeTemp); - if (Tr < state.dataCondenserLoopTowers->towers(this->VSTower).MinRangeTemp) { - TrCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MinRangeTemp; + OutputCharLo = format("{:.2R}", this->MinRangeTemp); + OutputCharHi = format("{:.2R}", this->MaxRangeTemp); + if (Tr < this->MinRangeTemp) { + TrCapped = this->MinRangeTemp; } - if (Tr > state.dataCondenserLoopTowers->towers(this->VSTower).MaxRangeTemp) { - TrCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MaxRangeTemp; + if (Tr > this->MaxRangeTemp) { + TrCapped = this->MaxRangeTemp; } if (!state.dataGlobal->WarmupFlag) { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTrMessage = true; - state.dataCondenserLoopTowers->towers(this->VSTower).TrBuffer1 = - format("{} \"{}\" - Tower range temperature is outside model boundaries at {}.", - DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], - this->Name, - OutputChar); - state.dataCondenserLoopTowers->towers(this->VSTower).TrBuffer2 = - " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + - state.dataEnvrn->CurMnDy + ' ' + General::CreateSysTimeIntervalString(state); + this->PrintTrMessage = true; + this->TrBuffer1 = format("{} \"{}\" - Tower range temperature is outside model boundaries at {}.", + DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], + this->Name, + OutputChar); + this->TrBuffer2 = " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + + General::CreateSysTimeIntervalString(state); TrimValue = format("{:.5R}", Tr); - state.dataCondenserLoopTowers->towers(this->VSTower).TrBuffer3 = " ...Tower range temperature passed to the model = " + TrimValue; - state.dataCondenserLoopTowers->towers(this->VSTower).TrLast = Tr; + this->TrBuffer3 = " ...Tower range temperature passed to the model = " + TrimValue; + this->TrLast = Tr; } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTrMessage = false; + this->PrintTrMessage = false; } } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTrMessage = false; + this->PrintTrMessage = false; } - if (Ta < state.dataCondenserLoopTowers->towers(this->VSTower).MinApproachTemp || - Ta > state.dataCondenserLoopTowers->towers(this->VSTower).MaxApproachTemp) { + if (Ta < this->MinApproachTemp || Ta > this->MaxApproachTemp) { OutputChar = format("{:.2R}", Ta); - OutputCharLo = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MinApproachTemp); - OutputCharHi = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MaxApproachTemp); - if (Ta < state.dataCondenserLoopTowers->towers(this->VSTower).MinApproachTemp) { - TaCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MinApproachTemp; + OutputCharLo = format("{:.2R}", this->MinApproachTemp); + OutputCharHi = format("{:.2R}", this->MaxApproachTemp); + if (Ta < this->MinApproachTemp) { + TaCapped = this->MinApproachTemp; } - if (Ta > state.dataCondenserLoopTowers->towers(this->VSTower).MaxApproachTemp) { - TaCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MaxApproachTemp; + if (Ta > this->MaxApproachTemp) { + TaCapped = this->MaxApproachTemp; } if (!state.dataGlobal->WarmupFlag) { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTaMessage = true; - state.dataCondenserLoopTowers->towers(this->VSTower).TaBuffer1 = - format("{} \"{}\" - Tower approach temperature is outside model boundaries at {}.", - DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], - this->Name, - OutputChar); - state.dataCondenserLoopTowers->towers(this->VSTower).TaBuffer2 = - " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + - state.dataEnvrn->CurMnDy + ' ' + General::CreateSysTimeIntervalString(state); + this->PrintTaMessage = true; + this->TaBuffer1 = format("{} \"{}\" - Tower approach temperature is outside model boundaries at {}.", + DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], + this->Name, + OutputChar); + this->TaBuffer2 = " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + + General::CreateSysTimeIntervalString(state); TrimValue = format("{:.5R}", Ta); - state.dataCondenserLoopTowers->towers(this->VSTower).TaBuffer3 = " ...Tower approach temperature passed to the model = " + TrimValue; - state.dataCondenserLoopTowers->towers(this->VSTower).TaLast = Ta; + this->TaBuffer3 = " ...Tower approach temperature passed to the model = " + TrimValue; + this->TaLast = Ta; } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTaMessage = false; + this->PrintTaMessage = false; } } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintTaMessage = false; + this->PrintTaMessage = false; } if (this->TowerModelType == ModelType::YorkCalcModel || this->TowerModelType == ModelType::YorkCalcUserDefined) { // Water flow rate ratio warning not valid for YorkCalc model, print liquid to gas ratio // warning instead (bottom of Subroutine VariableSpeedTower) - state.dataCondenserLoopTowers->towers(this->VSTower).PrintWFRRMessage = false; + this->PrintWFRRMessage = false; } else { - if (WaterFlowRateRatio < state.dataCondenserLoopTowers->towers(this->VSTower).MinWaterFlowRatio || - WaterFlowRateRatio > state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio) { + if (WaterFlowRateRatio < this->MinWaterFlowRatio || WaterFlowRateRatio > this->MaxWaterFlowRatio) { OutputChar = format("{:.2R}", WaterFlowRateRatio); - OutputCharLo = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MinWaterFlowRatio); - OutputCharHi = format("{:.2R}", state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio); - if (WaterFlowRateRatio < state.dataCondenserLoopTowers->towers(this->VSTower).MinWaterFlowRatio) { - WaterFlowRateRatioCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MinWaterFlowRatio; + OutputCharLo = format("{:.2R}", this->MinWaterFlowRatio); + OutputCharHi = format("{:.2R}", this->MaxWaterFlowRatio); + if (WaterFlowRateRatio < this->MinWaterFlowRatio) { + WaterFlowRateRatioCapped = this->MinWaterFlowRatio; } - if (WaterFlowRateRatio > state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio) { - WaterFlowRateRatioCapped = state.dataCondenserLoopTowers->towers(this->VSTower).MaxWaterFlowRatio; + if (WaterFlowRateRatio > this->MaxWaterFlowRatio) { + WaterFlowRateRatioCapped = this->MaxWaterFlowRatio; } if (!state.dataGlobal->WarmupFlag) { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintWFRRMessage = true; - state.dataCondenserLoopTowers->towers(this->VSTower).WFRRBuffer1 = - format("{} \"{}\" - Water flow rate ratio is outside model boundaries at {}.", - DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], - this->Name, - OutputChar); - state.dataCondenserLoopTowers->towers(this->VSTower).WFRRBuffer2 = - " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + - ", " + state.dataEnvrn->CurMnDy + ' ' + General::CreateSysTimeIntervalString(state); + this->PrintWFRRMessage = true; + this->WFRRBuffer1 = format("{} \"{}\" - Water flow rate ratio is outside model boundaries at {}.", + DataPlant::PlantEquipTypeNames[static_cast(this->TowerType)], + this->Name, + OutputChar); + this->WFRRBuffer2 = " ...Valid range = " + OutputCharLo + " to " + OutputCharHi + + ". Occurrence info = " + state.dataEnvrn->EnvironmentName + ", " + state.dataEnvrn->CurMnDy + ' ' + + General::CreateSysTimeIntervalString(state); TrimValue = format("{:.5R}", WaterFlowRateRatioCapped); - state.dataCondenserLoopTowers->towers(this->VSTower).WFRRBuffer3 = " ...Water flow rate ratio passed to the model = " + TrimValue; - state.dataCondenserLoopTowers->towers(this->VSTower).WaterFlowRateRatioLast = WaterFlowRateRatio; + this->WFRRBuffer3 = " ...Water flow rate ratio passed to the model = " + TrimValue; + this->WaterFlowRateRatioLast = WaterFlowRateRatio; } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintWFRRMessage = false; + this->PrintWFRRMessage = false; } } else { - state.dataCondenserLoopTowers->towers(this->VSTower).PrintWFRRMessage = false; + this->PrintWFRRMessage = false; } } } diff --git a/src/EnergyPlus/CondenserLoopTowers.hh b/src/EnergyPlus/CondenserLoopTowers.hh index 16170e121cf..5fcc590b17b 100644 --- a/src/EnergyPlus/CondenserLoopTowers.hh +++ b/src/EnergyPlus/CondenserLoopTowers.hh @@ -195,7 +195,6 @@ namespace CondenserLoopTowers { int WaterOutletNodeNum = 0; // Node number on the water outlet side of the tower int OutdoorAirInletNodeNum = 0; // Node number of outdoor air inlet for the tower ModelType TowerModelType = ModelType::Invalid; // Type of empirical model (1=CoolTools) - int VSTower = 0; // Index to a variable speed tower (otherwise = 0) int FanPowerfAirFlowCurve = 0; // Index to fan power correlation curve for VS Towers int BlowDownSchedulePtr = 0; // Pointer to blow down schedule int BasinHeaterSchedulePtr = 0; // Pointer to basin heater schedule