From 1d3ab1c2c414bfbd572645407434e058fe77e3ab Mon Sep 17 00:00:00 2001 From: Yujie Xu Date: Thu, 20 Mar 2025 14:14:36 -0700 Subject: [PATCH 01/11] separate warning for -1 and -2, report SmallLoadTe range in warning --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 60 +++++++++++++------ src/EnergyPlus/HVACVariableRefrigerantFlow.hh | 8 ++- 2 files changed, 48 insertions(+), 20 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 4d94a8e06ae..7340b2fb605 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -13958,40 +13958,64 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, }; General::SolveRoot(state, 1.0e-3, MaxIter, SolFla, SmallLoadTe, f, MinOutdoorUnitTe, - T_suction); // SmallLoadTe is the updated Te' + T_suction + 6); // SmallLoadTe is the updated Te' if (SolFla == -1) { // show error not converging ShowWarningMessage(state, format("{}: low load Te adjustment failed for {}", RoutineName, this->Name)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, format(" Iteration limit [{}] exceeded in calculating OU evaporating temperature", MaxIter)); } else if (SolFla == -2) { - this->LowLoadTeError++; - if (LowLoadTeError < 5) { - ShowWarningMessage(state, - format("{}: no Te solution was found for {} f({})={} and f({})={} are the same sign", - RoutineName, - this->Name, - MinOutdoorUnitTe, - f(MinOutdoorUnitTe), - T_suction, - f(T_suction))); - ShowContinueErrorTimeStamp(state, ""); - } - ShowRecurringWarningErrorAtEnd(state, - "Low load calculation Te solution not found as end points have the same sign", - this->LowLoadTeErrorIndex, - SolFla, - SolFla); if (f(T_suction) < 0) { // demand < capacity at both endpoints of the Te range, assuming f(x) is roughly monotonic than this is the low load case // TeTol is added to prevent the final updated Te to go out of bounds SmallLoadTe = MinOutdoorUnitTe + TeTol; // MinOutdoorUnitTe; //SmallLoadTe( Te'_new ) is constant during iterations + this->LowLoadTeError2Neg++; + if (LowLoadTeError2Neg < 5) { + ShowWarningMessage( + state, + format("{}: no Te solution was found for {}, as load < capacity for the whole range of Te", RoutineName, this->Name)); + ShowContinueErrorTimeStamp(state, ""); + } + ShowRecurringWarningErrorAtEnd( + state, + "Low load calculation Te solution not found as load is smaller than min-speed capacity for the whole range", + this->LowLoadTeError2NegIndex, + SmallLoadTe, + SmallLoadTe); } else { // demand > capacity at both endpoints of the Te range, take the end point x where f(x) is closer to zero if (f(MinOutdoorUnitTe) > f(T_suction)) { // f(T_suction > 0, not equal as SolFla will not be -2 SmallLoadTe = T_suction; + this->LowLoadTeError2PosTsuc++; + if (LowLoadTeError2PosTsuc < 5) { + ShowWarningMessage(state, + format("{}: no Te solution was found for {}, as load > capacity for the full range of Te", + RoutineName, + this->Name)); + ShowContinueErrorTimeStamp(state, ""); + } + ShowRecurringWarningErrorAtEnd(state, + "Low load calculation Te solution not found as load is larger than min-speed capacity for " + "the whole range\nTake T_suction as the updated Te", + this->LowLoadTeError2PosTsucIndex, + SmallLoadTe, + SmallLoadTe); } else { SmallLoadTe = MinOutdoorUnitTe; + this->LowLoadTeError2PosOUTe++; + if (LowLoadTeError2PosOUTe < 5) { + ShowWarningMessage(state, + format("{}: no Te solution was found for {}, as load > capacity for the full range of Te", + RoutineName, + this->Name)); + ShowContinueErrorTimeStamp(state, ""); + } + ShowRecurringWarningErrorAtEnd(state, + "Low load calculation Te solution not found as load is larger than min-speed capacity for " + "the whole range\nTake MinOutdoorUnitTe as the updated Te", + this->LowLoadTeError2PosOUTeIndex, + SmallLoadTe, + SmallLoadTe); } } } diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh index 70f85927ad8..64800216389 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh @@ -315,8 +315,12 @@ namespace HVACVariableRefrigerantFlow { int CoolCapFTErrorIndex = 0; // warning message index int HeatEIRFPLRErrorIndex = 0; // warning message index int CoolEIRFPLRErrorIndex = 0; // warning message index - int LowLoadTeError = 0; - int LowLoadTeErrorIndex = 0; // warning message index + int LowLoadTeError2Neg = 0; + int LowLoadTeError2NegIndex = 0; // warning message index + int LowLoadTeError2PosTsuc = 0; + int LowLoadTeError2PosTsucIndex = 0; // warning message index + int LowLoadTeError2PosOUTe = 0; + int LowLoadTeError2PosOUTeIndex = 0; // warning message index // The following are for the Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control int AlgorithmIUCtrl; // VRF indoor unit contrl algorithm, 1-High sensible, 2-Te/Tc constant Array1D CompressorSpeed; // compressor speed array [rps] From c77f5d135d2f89dbf543772aca76927fa819c394 Mon Sep 17 00:00:00 2001 From: Yujie Xu Date: Thu, 20 Mar 2025 14:26:45 -0700 Subject: [PATCH 02/11] check sign of end points before solving root --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 74 ++++--------------- 1 file changed, 16 insertions(+), 58 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 7340b2fb605..968f626af94 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -13959,65 +13959,23 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, General::SolveRoot(state, 1.0e-3, MaxIter, SolFla, SmallLoadTe, f, MinOutdoorUnitTe, T_suction + 6); // SmallLoadTe is the updated Te' - if (SolFla == -1) { - // show error not converging - ShowWarningMessage(state, format("{}: low load Te adjustment failed for {}", RoutineName, this->Name)); - ShowContinueErrorTimeStamp(state, ""); - ShowContinueError(state, format(" Iteration limit [{}] exceeded in calculating OU evaporating temperature", MaxIter)); - } else if (SolFla == -2) { - if (f(T_suction) < 0) { - // demand < capacity at both endpoints of the Te range, assuming f(x) is roughly monotonic than this is the low load case - // TeTol is added to prevent the final updated Te to go out of bounds - SmallLoadTe = MinOutdoorUnitTe + TeTol; // MinOutdoorUnitTe; //SmallLoadTe( Te'_new ) is constant during iterations - this->LowLoadTeError2Neg++; - if (LowLoadTeError2Neg < 5) { - ShowWarningMessage( - state, - format("{}: no Te solution was found for {}, as load < capacity for the whole range of Te", RoutineName, this->Name)); - ShowContinueErrorTimeStamp(state, ""); - } - ShowRecurringWarningErrorAtEnd( - state, - "Low load calculation Te solution not found as load is smaller than min-speed capacity for the whole range", - this->LowLoadTeError2NegIndex, - SmallLoadTe, - SmallLoadTe); - } else { - // demand > capacity at both endpoints of the Te range, take the end point x where f(x) is closer to zero - if (f(MinOutdoorUnitTe) > f(T_suction)) { // f(T_suction > 0, not equal as SolFla will not be -2 - SmallLoadTe = T_suction; - this->LowLoadTeError2PosTsuc++; - if (LowLoadTeError2PosTsuc < 5) { - ShowWarningMessage(state, - format("{}: no Te solution was found for {}, as load > capacity for the full range of Te", - RoutineName, - this->Name)); - ShowContinueErrorTimeStamp(state, ""); - } - ShowRecurringWarningErrorAtEnd(state, - "Low load calculation Te solution not found as load is larger than min-speed capacity for " - "the whole range\nTake T_suction as the updated Te", - this->LowLoadTeError2PosTsucIndex, - SmallLoadTe, - SmallLoadTe); - } else { - SmallLoadTe = MinOutdoorUnitTe; - this->LowLoadTeError2PosOUTe++; - if (LowLoadTeError2PosOUTe < 5) { - ShowWarningMessage(state, - format("{}: no Te solution was found for {}, as load > capacity for the full range of Te", - RoutineName, - this->Name)); - ShowContinueErrorTimeStamp(state, ""); - } - ShowRecurringWarningErrorAtEnd(state, - "Low load calculation Te solution not found as load is larger than min-speed capacity for " - "the whole range\nTake MinOutdoorUnitTe as the updated Te", - this->LowLoadTeError2PosOUTeIndex, - SmallLoadTe, - SmallLoadTe); - } + Real64 f_xmin = f(MinOutdoorUnitTe); + Real64 f_xmax = f(T_suction); + if (f_xmin < 0 && f_xmax < 0) { + SmallLoadTe = MinOutdoorUnitTe; + } else if (f_xmin > 0 && f_xmax > 0) { + SmallLoadTe = T_suction; + if (f_xmin < f_xmax) { + SmallLoadTe = MinOutdoorUnitTe; } + } else { + General::SolveRoot(state, 1.0e-3, MaxIter, SolFla, SmallLoadTe, f, MinOutdoorUnitTe, T_suction); // SmallLoadTe is the updated Te' + if (SolFla == -1) { + // show error not converging + ShowWarningMessage(state, format("{}: low load Te adjustment failed for {}", RoutineName, this->Name)); + ShowContinueErrorTimeStamp(state, ""); + ShowContinueError(state, format(" Iteration limit [{}] exceeded in calculating OU evaporating temperature", MaxIter)); + } // the SolFla = -2 can't happen here as the f_xmin and f_xmax is have different signs here } // Get an updated Te corresponding to the updated Te' From 51cb0113f88a57d2f8a2780d53799894b79ba7e1 Mon Sep 17 00:00:00 2001 From: Yujie Xu Date: Fri, 21 Mar 2025 11:16:35 -0700 Subject: [PATCH 03/11] add back warnings, keep old upper bound SolveRoot --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 66 +++++++++++++++++-- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 968f626af94..f424d30de34 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -13958,14 +13958,15 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, }; General::SolveRoot(state, 1.0e-3, MaxIter, SolFla, SmallLoadTe, f, MinOutdoorUnitTe, - T_suction + 6); // SmallLoadTe is the updated Te' + T_suction); // SmallLoadTe is the updated Te' Real64 f_xmin = f(MinOutdoorUnitTe); Real64 f_xmax = f(T_suction); if (f_xmin < 0 && f_xmax < 0) { SmallLoadTe = MinOutdoorUnitTe; } else if (f_xmin > 0 && f_xmax > 0) { - SmallLoadTe = T_suction; - if (f_xmin < f_xmax) { + if (f_xmin > f_xmax) { + SmallLoadTe = T_suction; + } else { SmallLoadTe = MinOutdoorUnitTe; } } else { @@ -13975,7 +13976,64 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, ShowWarningMessage(state, format("{}: low load Te adjustment failed for {}", RoutineName, this->Name)); ShowContinueErrorTimeStamp(state, ""); ShowContinueError(state, format(" Iteration limit [{}] exceeded in calculating OU evaporating temperature", MaxIter)); - } // the SolFla = -2 can't happen here as the f_xmin and f_xmax is have different signs here + } else if (SolFla == -2) { + if (f_xmax < 0) { + // demand < capacity at both endpoints of the Te range, assuming f(x) is roughly monotonic than this is the low load case + // TeTol is added to prevent the final updated Te to go out of bounds + SmallLoadTe = MinOutdoorUnitTe; + this->LowLoadTeError2Neg++; + if (LowLoadTeError2Neg < 5) { + ShowWarningMessage(state, + format("{}: no Te solution was found for {}, as load < capacity for the whole range of Te", + RoutineName, + this->Name)); + ShowContinueErrorTimeStamp(state, ""); + } + ShowRecurringWarningErrorAtEnd( + state, + "Low load calculation Te solution not found as load is smaller than min-speed capacity for the whole range", + this->LowLoadTeError2NegIndex, + SmallLoadTe, + SmallLoadTe); + } else { + // demand > capacity at both endpoints of the Te range, take the end point x where f(x) is closer to zero + if (f_xmin > f_xmax) { // f(T_suction > 0, not equal as SolFla will not be -2 + SmallLoadTe = T_suction; + this->LowLoadTeError2PosTsuc++; + if (LowLoadTeError2PosTsuc < 5) { + ShowWarningMessage(state, + format("{}: no Te solution was found for {}, as load > capacity for the full range of Te", + RoutineName, + this->Name)); + ShowContinueErrorTimeStamp(state, ""); + } + ShowRecurringWarningErrorAtEnd( + state, + "Low load calculation Te solution not found as load is larger than min-speed capacity for " + "the whole range\nTake T_suction as the updated Te", + this->LowLoadTeError2PosTsucIndex, + SmallLoadTe, + SmallLoadTe); + } else { + SmallLoadTe = MinOutdoorUnitTe; + this->LowLoadTeError2PosOUTe++; + if (LowLoadTeError2PosOUTe < 5) { + ShowWarningMessage(state, + format("{}: no Te solution was found for {}, as load > capacity for the full range of Te", + RoutineName, + this->Name)); + ShowContinueErrorTimeStamp(state, ""); + } + ShowRecurringWarningErrorAtEnd( + state, + "Low load calculation Te solution not found as load is larger than min-speed capacity for " + "the whole range\nTake MinOutdoorUnitTe as the updated Te", + this->LowLoadTeError2PosOUTeIndex, + SmallLoadTe, + SmallLoadTe); + } + } + } } // Get an updated Te corresponding to the updated Te' From 4cff1474b9e36cabb4273bd8618049037fa19cb4 Mon Sep 17 00:00:00 2001 From: Yujie Xu Date: Fri, 21 Mar 2025 14:43:07 -0700 Subject: [PATCH 04/11] Fix unit test --- tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc index ae8d782e0c5..b075ba13037 100644 --- a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc +++ b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc @@ -2681,7 +2681,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) thisVRF.RatedEvapCapacity * CurveValue(*state, thisVRF.OUCoolingCAPFT(1), thisVRF.CondensingTemp, thisVRF.EvaporatingTemp); Real64 CompEvaporatingPWRSpdMin = thisVRF.RatedCompPower * CurveValue(*state, thisVRF.OUCoolingPWRFT(1), thisVRF.CondensingTemp, thisVRF.EvaporatingTemp); - EXPECT_NEAR(0.36, CyclingRatio, 0.01); + EXPECT_NEAR(0.37, CyclingRatio, 0.01); EXPECT_NEAR(OUEvapHeatExtract, CompEvaporatingCAPSpdMin + Ncomp, 1e-4); EXPECT_NEAR(1500, CompSpdActual, 1); EXPECT_NEAR(Ncomp, CompEvaporatingPWRSpdMin, 1e-4); @@ -13363,7 +13363,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) EXPECT_NEAR(5645.5696, thisVRFTU.TotalCoolingRate, 0.0001); EXPECT_NEAR(84.8359, thisFan->totalPower, 0.0001); EXPECT_NEAR(thisDXCoolingCoil.TotalCoolingEnergyRate, (thisVRFTU.TotalCoolingRate + thisFan->totalPower), 0.0001); - EXPECT_NEAR(0.4772, state->dataHVACVarRefFlow->VRF(1).VRFCondCyclingRatio, 0.0001); + EXPECT_NEAR(0.4851, state->dataHVACVarRefFlow->VRF(1).VRFCondCyclingRatio, 0.0001); EXPECT_NEAR(state->dataHVACVarRefFlow->VRF(1).OUFanPower, state->dataHVACVarRefFlow->VRF(1).RatedOUFanPower * state->dataHVACVarRefFlow->VRF(1).VRFCondCyclingRatio, 0.0001); From 7d4fa9c7d59ce12f445702db0c3b996176bf99be Mon Sep 17 00:00:00 2001 From: Yujie Xu Date: Wed, 2 Jul 2025 10:02:45 -0700 Subject: [PATCH 05/11] fix bracket issue from merging --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 156 +++++++++--------- 1 file changed, 79 insertions(+), 77 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 03aba88c4d2..bbac617193c 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -6276,7 +6276,7 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).TerminalUnitNotSizedYet(IndexToTUInTUList) = false; state.dataHVACVarRefFlow->MySizeFlag(VRFTUNum) = false; } // IF ( .NOT. ZoneSizingCalc) THEN - } // IF (MySizeFlag(VRFTUNum)) THEN + } // IF (MySizeFlag(VRFTUNum)) THEN // Do the Begin Environment initializations if (state.dataGlobal->BeginEnvrnFlag && state.dataHVACVarRefFlow->MyEnvrnFlag(VRFTUNum)) { @@ -14216,97 +14216,99 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, return CompResidual_FluidTCtrl(state, T_discharge_new, CondHeat, CAPFT, T_suc); }; - General::SolveRoot(state, 1.0e-3, MaxIter, SolFla, SmallLoadTe, f, MinOutdoorUnitTe, - T_suction); // SmallLoadTe is the updated Te' - Real64 f_xmin = f(MinOutdoorUnitTe); - Real64 f_xmax = f(T_suction); - if (f_xmin < 0 && f_xmax < 0) { - SmallLoadTe = MinOutdoorUnitTe; - } else if (f_xmin > 0 && f_xmax > 0) { - if (f_xmin > f_xmax) { - SmallLoadTe = T_suction; - } else { + General::SolveRoot(state, 1.0e-3, MaxIter, SolFla, SmallLoadTe, f, MinOutdoorUnitTe, + T_suction); // SmallLoadTe is the updated Te' + Real64 f_xmin = f(MinOutdoorUnitTe); + Real64 f_xmax = f(T_suction); + if (f_xmin < 0 && f_xmax < 0) { SmallLoadTe = MinOutdoorUnitTe; - } - } else { - General::SolveRoot(state, 1.0e-3, MaxIter, SolFla, SmallLoadTe, f, MinOutdoorUnitTe, T_suction); // SmallLoadTe is the updated Te' - if (SolFla == -1) { - // show error not converging - ShowWarningMessage(state, format("{}: low load Te adjustment failed for {}", RoutineName, this->Name)); - ShowContinueErrorTimeStamp(state, ""); - ShowContinueError(state, format(" Iteration limit [{}] exceeded in calculating OU evaporating temperature", MaxIter)); - } else if (SolFla == -2) { - if (f_xmax < 0) { - // demand < capacity at both endpoints of the Te range, assuming f(x) is roughly monotonic than this is the low load case - // TeTol is added to prevent the final updated Te to go out of bounds - SmallLoadTe = MinOutdoorUnitTe; - this->LowLoadTeError2Neg++; - if (LowLoadTeError2Neg < 5) { - ShowWarningMessage(state, - format("{}: no Te solution was found for {}, as load < capacity for the whole range of Te", - RoutineName, - this->Name)); - ShowContinueErrorTimeStamp(state, ""); - } - ShowRecurringWarningErrorAtEnd( - state, - "Low load calculation Te solution not found as load is smaller than min-speed capacity for the whole range", - this->LowLoadTeError2NegIndex, - SmallLoadTe, - SmallLoadTe); + } else if (f_xmin > 0 && f_xmax > 0) { + if (f_xmin > f_xmax) { + SmallLoadTe = T_suction; } else { - // demand > capacity at both endpoints of the Te range, take the end point x where f(x) is closer to zero - if (f_xmin > f_xmax) { // f(T_suction > 0, not equal as SolFla will not be -2 - SmallLoadTe = T_suction; - this->LowLoadTeError2PosTsuc++; - if (LowLoadTeError2PosTsuc < 5) { + SmallLoadTe = MinOutdoorUnitTe; + } + } else { + General::SolveRoot( + state, 1.0e-3, MaxIter, SolFla, SmallLoadTe, f, MinOutdoorUnitTe, T_suction); // SmallLoadTe is the updated Te' + if (SolFla == -1) { + // show error not converging + ShowWarningMessage(state, format("{}: low load Te adjustment failed for {}", RoutineName, this->Name)); + ShowContinueErrorTimeStamp(state, ""); + ShowContinueError(state, format(" Iteration limit [{}] exceeded in calculating OU evaporating temperature", MaxIter)); + } else if (SolFla == -2) { + if (f_xmax < 0) { + // demand < capacity at both endpoints of the Te range, assuming f(x) is roughly monotonic than this is the low load + // case TeTol is added to prevent the final updated Te to go out of bounds + SmallLoadTe = MinOutdoorUnitTe; + this->LowLoadTeError2Neg++; + if (LowLoadTeError2Neg < 5) { ShowWarningMessage(state, - format("{}: no Te solution was found for {}, as load > capacity for the full range of Te", + format("{}: no Te solution was found for {}, as load < capacity for the whole range of Te", RoutineName, this->Name)); ShowContinueErrorTimeStamp(state, ""); } ShowRecurringWarningErrorAtEnd( state, - "Low load calculation Te solution not found as load is larger than min-speed capacity for " - "the whole range\nTake T_suction as the updated Te", - this->LowLoadTeError2PosTsucIndex, + "Low load calculation Te solution not found as load is smaller than min-speed capacity for the whole range", + this->LowLoadTeError2NegIndex, SmallLoadTe, SmallLoadTe); } else { - SmallLoadTe = MinOutdoorUnitTe; - this->LowLoadTeError2PosOUTe++; - if (LowLoadTeError2PosOUTe < 5) { - ShowWarningMessage(state, - format("{}: no Te solution was found for {}, as load > capacity for the full range of Te", - RoutineName, - this->Name)); - ShowContinueErrorTimeStamp(state, ""); + // demand > capacity at both endpoints of the Te range, take the end point x where f(x) is closer to zero + if (f_xmin > f_xmax) { // f(T_suction > 0, not equal as SolFla will not be -2 + SmallLoadTe = T_suction; + this->LowLoadTeError2PosTsuc++; + if (LowLoadTeError2PosTsuc < 5) { + ShowWarningMessage(state, + format("{}: no Te solution was found for {}, as load > capacity for the full range of Te", + RoutineName, + this->Name)); + ShowContinueErrorTimeStamp(state, ""); + } + ShowRecurringWarningErrorAtEnd( + state, + "Low load calculation Te solution not found as load is larger than min-speed capacity for " + "the whole range\nTake T_suction as the updated Te", + this->LowLoadTeError2PosTsucIndex, + SmallLoadTe, + SmallLoadTe); + } else { + SmallLoadTe = MinOutdoorUnitTe; + this->LowLoadTeError2PosOUTe++; + if (LowLoadTeError2PosOUTe < 5) { + ShowWarningMessage(state, + format("{}: no Te solution was found for {}, as load > capacity for the full range of Te", + RoutineName, + this->Name)); + ShowContinueErrorTimeStamp(state, ""); + } + ShowRecurringWarningErrorAtEnd( + state, + "Low load calculation Te solution not found as load is larger than min-speed capacity for " + "the whole range\nTake MinOutdoorUnitTe as the updated Te", + this->LowLoadTeError2PosOUTeIndex, + SmallLoadTe, + SmallLoadTe); } - ShowRecurringWarningErrorAtEnd( - state, - "Low load calculation Te solution not found as load is larger than min-speed capacity for " - "the whole range\nTake MinOutdoorUnitTe as the updated Te", - this->LowLoadTeError2PosOUTeIndex, - SmallLoadTe, - SmallLoadTe); } - } - ShowRecurringWarningErrorAtEnd(state, - "Low load calculation Te solution not found as end points have the same sign", - this->LowLoadTeErrorIndex, - SolFla, - SolFla); - if (f(T_suction) < 0) { - // demand < capacity at both endpoints of the Te range, assuming f(x) is roughly monotonic than this is the low load case - // TeTol is added to prevent the final updated Te to go out of bounds - SmallLoadTe = MinOutdoorUnitTe + TeTol; // MinOutdoorUnitTe; //SmallLoadTe( Te'_new ) is constant during iterations - } else { - // demand > capacity at both endpoints of the Te range, take the end point x where f(x) is closer to zero - if (f(MinOutdoorUnitTe) > f(T_suction)) { // f(T_suction > 0, not equal as SolFla will not be -2 - SmallLoadTe = T_suction; + ShowRecurringWarningErrorAtEnd(state, + "Low load calculation Te solution not found as end points have the same sign", + this->LowLoadTeErrorIndex, + SolFla, + SolFla); + if (f(T_suction) < 0) { + // demand < capacity at both endpoints of the Te range, assuming f(x) is roughly monotonic than this is the low load + // case TeTol is added to prevent the final updated Te to go out of bounds + SmallLoadTe = MinOutdoorUnitTe + TeTol; // MinOutdoorUnitTe; //SmallLoadTe( Te'_new ) is constant during iterations } else { - SmallLoadTe = MinOutdoorUnitTe; + // demand > capacity at both endpoints of the Te range, take the end point x where f(x) is closer to zero + if (f(MinOutdoorUnitTe) > f(T_suction)) { // f(T_suction > 0, not equal as SolFla will not be -2 + SmallLoadTe = T_suction; + } else { + SmallLoadTe = MinOutdoorUnitTe; + } } } } From 339935148529f012164664b59ca3bcfd9f4f009e Mon Sep 17 00:00:00 2001 From: Yujie Xu Date: Wed, 2 Jul 2025 10:03:09 -0700 Subject: [PATCH 06/11] temp mod feenableexcept so apple arm can build --- src/EnergyPlus/ElectricPowerServiceManager.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/EnergyPlus/ElectricPowerServiceManager.cc b/src/EnergyPlus/ElectricPowerServiceManager.cc index 0274ca8fa2e..22122bb8a28 100644 --- a/src/EnergyPlus/ElectricPowerServiceManager.cc +++ b/src/EnergyPlus/ElectricPowerServiceManager.cc @@ -4130,8 +4130,10 @@ void ElectricStorage::simulateLiIonNmcBatteryModel(EnergyPlusData &state, // Disable floating point exceptions around SSC battery calculations, which uses quiet_NaN in particular #ifdef DEBUG_ARITHM_GCC_OR_CLANG - int old_excepts = fegetexcept(); - fedisableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); + #ifndef __APPLE__ + int old_excepts = fegetexcept(); + fedisableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); + #endif #endif #ifdef DEBUG_ARITHM_MSVC @@ -4219,7 +4221,9 @@ void ElectricStorage::simulateLiIonNmcBatteryModel(EnergyPlusData &state, } #ifdef DEBUG_ARITHM_GCC_OR_CLANG - feenableexcept(old_excepts); + #ifndef __APPLE__ + feenableexcept(old_excepts); + #endif #endif #ifdef DEBUG_ARITHM_MSVC From 67b3cf37fe40d3b1cc818916f33d6b2a9449dea5 Mon Sep 17 00:00:00 2001 From: Yujie Xu Date: Wed, 2 Jul 2025 11:25:27 -0700 Subject: [PATCH 07/11] Revert "temp mod feenableexcept so apple arm can build" This reverts commit 339935148529f012164664b59ca3bcfd9f4f009e. --- src/EnergyPlus/ElectricPowerServiceManager.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/EnergyPlus/ElectricPowerServiceManager.cc b/src/EnergyPlus/ElectricPowerServiceManager.cc index 22122bb8a28..0274ca8fa2e 100644 --- a/src/EnergyPlus/ElectricPowerServiceManager.cc +++ b/src/EnergyPlus/ElectricPowerServiceManager.cc @@ -4130,10 +4130,8 @@ void ElectricStorage::simulateLiIonNmcBatteryModel(EnergyPlusData &state, // Disable floating point exceptions around SSC battery calculations, which uses quiet_NaN in particular #ifdef DEBUG_ARITHM_GCC_OR_CLANG - #ifndef __APPLE__ - int old_excepts = fegetexcept(); - fedisableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); - #endif + int old_excepts = fegetexcept(); + fedisableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); #endif #ifdef DEBUG_ARITHM_MSVC @@ -4221,9 +4219,7 @@ void ElectricStorage::simulateLiIonNmcBatteryModel(EnergyPlusData &state, } #ifdef DEBUG_ARITHM_GCC_OR_CLANG - #ifndef __APPLE__ - feenableexcept(old_excepts); - #endif + feenableexcept(old_excepts); #endif #ifdef DEBUG_ARITHM_MSVC From bbf421400e24add81a6a53fb0da7d052ed45ce99 Mon Sep 17 00:00:00 2001 From: Yujie Xu Date: Wed, 2 Jul 2025 11:38:28 -0700 Subject: [PATCH 08/11] apply clang-format --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 2 +- src/EnergyPlus/HVACVariableRefrigerantFlow.hh | 2 +- .../unit/HVACVariableRefrigerantFlow.unit.cc | 22 +++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index bbac617193c..d10500bd476 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -6276,7 +6276,7 @@ void InitVRF(EnergyPlusData &state, int const VRFTUNum, int const ZoneNum, bool state.dataHVACVarRefFlow->TerminalUnitList(TUListIndex).TerminalUnitNotSizedYet(IndexToTUInTUList) = false; state.dataHVACVarRefFlow->MySizeFlag(VRFTUNum) = false; } // IF ( .NOT. ZoneSizingCalc) THEN - } // IF (MySizeFlag(VRFTUNum)) THEN + } // IF (MySizeFlag(VRFTUNum)) THEN // Do the Begin Environment initializations if (state.dataGlobal->BeginEnvrnFlag && state.dataHVACVarRefFlow->MyEnvrnFlag(VRFTUNum)) { diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh index e78ad56e1c6..e823f890964 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.hh +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.hh @@ -321,7 +321,7 @@ namespace HVACVariableRefrigerantFlow { int LowLoadTeError2PosTsucIndex = 0; // warning message index int LowLoadTeError2PosOUTe = 0; int LowLoadTeError2PosOUTeIndex = 0; // warning message index - int LowLoadTeErrorIndex = 0; // warning message index + int LowLoadTeErrorIndex = 0; // warning message index // The following are for the Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control int AlgorithmIUCtrl; // VRF indoor unit contrl algorithm, 1-High sensible, 2-Te/Tc constant Array1D CompressorSpeed; // compressor speed array [rps] diff --git a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc index da56e972aaf..83fc2f98434 100644 --- a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc +++ b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc @@ -2660,17 +2660,17 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) Ncomp, CyclingRatio); - // Test - auto const &thisVRF = state->dataHVACVarRefFlow->VRF(VRFCond); - Real64 CompEvaporatingCAPSpdMin = - thisVRF.RatedEvapCapacity * CurveValue(*state, thisVRF.OUCoolingCAPFT(1), thisVRF.CondensingTemp, thisVRF.EvaporatingTemp); - Real64 CompEvaporatingPWRSpdMin = - thisVRF.RatedCompPower * CurveValue(*state, thisVRF.OUCoolingPWRFT(1), thisVRF.CondensingTemp, thisVRF.EvaporatingTemp); - EXPECT_NEAR(0.37, CyclingRatio, 0.01); - EXPECT_NEAR(OUEvapHeatExtract, CompEvaporatingCAPSpdMin + Ncomp, 1e-4); - EXPECT_NEAR(1500, CompSpdActual, 1); - EXPECT_NEAR(Ncomp, CompEvaporatingPWRSpdMin, 1e-4); -} + // Test + auto const &thisVRF = state->dataHVACVarRefFlow->VRF(VRFCond); + Real64 CompEvaporatingCAPSpdMin = + thisVRF.RatedEvapCapacity * CurveValue(*state, thisVRF.OUCoolingCAPFT(1), thisVRF.CondensingTemp, thisVRF.EvaporatingTemp); + Real64 CompEvaporatingPWRSpdMin = + thisVRF.RatedCompPower * CurveValue(*state, thisVRF.OUCoolingPWRFT(1), thisVRF.CondensingTemp, thisVRF.EvaporatingTemp); + EXPECT_NEAR(0.37, CyclingRatio, 0.01); + EXPECT_NEAR(OUEvapHeatExtract, CompEvaporatingCAPSpdMin + Ncomp, 1e-4); + EXPECT_NEAR(1500, CompSpdActual, 1); + EXPECT_NEAR(Ncomp, CompEvaporatingPWRSpdMin, 1e-4); + } } TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Coil) From 125bd13d30ad28b3589c4339250579020d984b44 Mon Sep 17 00:00:00 2001 From: rraustad Date: Wed, 21 Jan 2026 20:32:40 -0500 Subject: [PATCH 09/11] Remove unused and redundant code --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index 35a848c7a44..aa2c8304c28 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -14206,8 +14206,6 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, return CompResidual_FluidTCtrl(state, T_discharge_new, CondHeat, CAPFT, T_suc); }; - // General::SolveRoot(state, 1.0e-3, MaxIter, SolFla, SmallLoadTe, f, MinOutdoorUnitTe, - // T_suction); // SmallLoadTe is the updated Te' Real64 f_xmin = f(MinOutdoorUnitTe); Real64 f_xmax = f(T_suction); if (f_xmin < 0 && f_xmax < 0) { @@ -14289,23 +14287,6 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, SmallLoadTe); } } - // ShowRecurringWarningErrorAtEnd(state, - // "Low load calculation Te solution not found as end points have the same sign", - // this->LowLoadTeErrorIndex, - // SolFla, - // SolFla); - // if (f(T_suction) < 0) { - // // demand < capacity at both endpoints of the Te range, assuming f(x) is roughly monotonic than this is the low load - // // case TeTol is added to prevent the final updated Te to go out of bounds - // SmallLoadTe = MinOutdoorUnitTe + TeTol; // MinOutdoorUnitTe; //SmallLoadTe( Te'_new ) is constant during iterations - // } else { - // // demand > capacity at both endpoints of the Te range, take the end point x where f(x) is closer to zero - // if (f(MinOutdoorUnitTe) > f(T_suction)) { // f(T_suction > 0, not equal as SolFla will not be -2 - // SmallLoadTe = T_suction; - // } else { - // SmallLoadTe = MinOutdoorUnitTe; - // } - // } } } From 964e38d26acf800697ac2cc070c52edcdb3922ed Mon Sep 17 00:00:00 2001 From: rraustad Date: Thu, 22 Jan 2026 22:03:12 -0500 Subject: [PATCH 10/11] Simple comment update on cloned repo to test workflow --- src/EnergyPlus/HVACVariableRefrigerantFlow.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index aa2c8304c28..dc7a0238adc 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -14296,7 +14296,7 @@ void VRFCondenserEquipment::VRFOU_CalcCompC(EnergyPlusData &state, { // Initialization of Iteration_Te (Label11) // i.e., find a new Te (Pipe_Te_assumed) that can generate a new T_suction equaling to SmallLoadTe. - // This requires the re-calculate of piping loss. + // This requires the re-calculation of piping loss. NumIteTe = 1; MaxNumIteTe = (this->EvaporatingTemp - SmallLoadTe) / 0.1 + 1; // upper bound and lower bound of Te iterations Pipe_Te_assumed = this->EvaporatingTemp - 0.1; From cf8ea42429e942ef9b80eb3a087b23fc95bff39c Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Thu, 22 Jan 2026 22:47:35 -0500 Subject: [PATCH 11/11] Test yml update --- .github/workflows/test_pull_requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_pull_requests.yml b/.github/workflows/test_pull_requests.yml index ebf34993c02..39e494f6764 100644 --- a/.github/workflows/test_pull_requests.yml +++ b/.github/workflows/test_pull_requests.yml @@ -277,7 +277,7 @@ jobs: # - uses: lhotari/action-upterm@v1 - name: Fail on Regressions from Forked Repository - if: always() && matrix.run_regressions && steps.regressions.outcome == 'failure' && github.event.pull_request.head.repo.full_name != 'NREL/EnergyPlus' + if: always() && matrix.run_regressions && steps.regressions.outcome == 'failure' && github.event.pull_request.head.repo.full_name != 'NatLabRockies/EnergyPlus' run: | echo "::error::Regressions detected in pull request from forked repository, check job summary for details and to download regression results" exit 1