Skip to content

Commit

Permalink
Merge pull request #10416 from NREL/vrfFluidCtrlFixHeatingCycling
Browse files Browse the repository at this point in the history
 Fix VRFFluidCtrl heating cycling issue by moving cycling ratio calc in compressor spd calc
  • Loading branch information
Myoldmopar authored Sep 12, 2024
2 parents 6ebeecd + 348259b commit ac106a0
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 31 deletions.
53 changes: 26 additions & 27 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11644,24 +11644,6 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c
SH_OU = this->SH;
this->VRFOU_TeTc(
state, HXOpMode::EvapMode, Q_c_OU, SH_OU, m_air, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, Tfs, this->EvaporatingTemp);
} else if ((Q_c_OU * C_cap_operation) <= CompEvaporatingCAPSpdMin) {
// Required heating load is smaller than the min heating capacity

if (Q_c_OU == 0) {
// Q_h_TU_PL is less than or equal to CompEvaporatingPWRSpdMin
CyclingRatio = Q_h_TU_PL / CompEvaporatingPWRSpdMin;
this->EvaporatingTemp = OutdoorDryBulb;
} else {
// Q_h_TU_PL is greater than CompEvaporatingPWRSpdMin
CyclingRatio = Q_c_OU * C_cap_operation / CompEvaporatingCAPSpdMin;
this->EvaporatingTemp = max(CapMinTe, RefTLow);
}

double CyclingRatioFrac = 0.85 + 0.15 * CyclingRatio;
double HPRTF = CyclingRatio / CyclingRatioFrac;
Ncomp = CompEvaporatingPWRSpdMin * HPRTF;
CompSpdActual = this->CompressorSpeed(1);

} else {
// CompEvaporatingCAPSpdMin < (Q_c_OU * C_cap_operation) <= CompEvaporatingCAPSpdMaxCurrentTsuc + CompEvaporatingPWRSpdMaxCurrentTsuc
// Required heating load is greater than or equal to the min heating capacity
Expand All @@ -11686,12 +11668,14 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c
Tdischarge,
h_IU_cond_out_ave,
this->IUCondensingTemp,
CapMinTe,
// Te can't be smaller than user input lower bound
max(this->IUEvapTempLow, CapMinTe),
Tfs,
Pipe_Q_h,
Q_c_OU,
CompSpdActual,
Ncomp_new);
Ncomp_new,
CyclingRatio);

if ((std::abs(Ncomp_new - Ncomp) > (Tolerance * Ncomp)) && (Counter < 30)) {
Ncomp = Ncomp_new;
Expand All @@ -11717,6 +11701,8 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, c
}

// Key outputs of this subroutine
Ncomp *= CyclingRatio;
Q_c_OU *= CyclingRatio;
this->CompActSpeed = max(CompSpdActual, 0.0);
this->Ncomp = max(Ncomp, 0.0) / this->EffCompInverter;
this->OUFanPower = this->RatedOUFanPower * CyclingRatio;
Expand Down Expand Up @@ -14211,7 +14197,8 @@ void VRFCondenserEquipment::VRFOU_CalcCompH(
Real64 Pipe_Q, // Piping Loss Algorithm Parameter: Heat loss [W]
Real64 &OUEvapHeatExtract, // Condenser heat release (cooling mode) [W]
Real64 &CompSpdActual, // Actual compressor running speed [rps]
Real64 &Ncomp // Compressor power [W]
Real64 &Ncomp, // Compressor power [W]
Real64 &CyclingRatio // Compressor cycling ratio
)
{

Expand Down Expand Up @@ -14322,7 +14309,6 @@ void VRFCondenserEquipment::VRFOU_CalcCompH(
auto f = [&state, T_discharge, CondHeat, CAPFT](Real64 const T_suc) {
return CompResidual_FluidTCtrl(state, T_discharge, CondHeat, CAPFT, T_suc);
};

General::SolveRoot(state, 1.0e-3, MaxIter, SolFla, SmallLoadTe, f, MinOutdoorUnitTe, T_suction);
if (SolFla < 0) SmallLoadTe = MinOutdoorUnitTe;

Expand All @@ -14331,9 +14317,13 @@ void VRFCondenserEquipment::VRFOU_CalcCompH(
// Update SH and Pe to calculate Modification Factor, which is used to update rps to for N_comp calculations
if (this->C3Te == 0)
Modifi_SH = -(this->C1Te - Tfs + T_suction) / this->C2Te;
else
Modifi_SH =
(-this->C2Te + std::pow((pow_2(this->C2Te) - 4 * (this->C1Te - Tfs + T_suction) * this->C3Te), 0.5)) / (2 * this->C3Te);
else {
if ((pow_2(this->C2Te) - 4 * (this->C1Te - Tfs + T_suction) * this->C3Te) < 0.0)
Modifi_SH = this->C2Te / (-2 * (this->C1Te - Tfs + T_suction));
else
Modifi_SH =
(-this->C2Te + std::pow((pow_2(this->C2Te) - 4 * (this->C1Te - Tfs + T_suction) * this->C3Te), 0.5)) / (2 * this->C3Te);
}

Modifi_Pe = this->refrig->getSatPressure(state, T_suction, RoutineName);

Expand All @@ -14358,10 +14348,19 @@ void VRFCondenserEquipment::VRFOU_CalcCompH(
NumIteCcap = NumIteCcap + 1;
goto Label19;
}
if (CapDiff > (Tolerance * Cap_Eva0)) NumIteCcap = 999;
if (CapDiff > (Tolerance * Cap_Eva0) && (Cap_Eva1 - Cap_Eva0) >= 0.0) {
NumIteCcap = 999;
CyclingRatio = Cap_Eva0 / Cap_Eva1;
} else {
CyclingRatio = 1.0;
}

Ncomp = this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(CounterCompSpdTemp), T_discharge, T_suction);

// Cap_Eva1 is the updated compressor min speed capacity
OUEvapHeatExtract = Cap_Eva1;
this->EvaporatingTemp = T_suction;
this->CondensingTemp = T_discharge;
this->IUCondensingTemp = T_discharge;
break; // EXIT DoName2

} // End: if( CounterCompSpdTemp <= 1 ) Low load modification
Expand Down
3 changes: 2 additions & 1 deletion src/EnergyPlus/HVACVariableRefrigerantFlow.hh
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,8 @@ namespace HVACVariableRefrigerantFlow {
Real64 Pipe_Q, // Piping Loss Algorithm Parameter: Heat loss [W]
Real64 &OUEvapHeatExtract, // Condenser heat release (cooling mode) [W]
Real64 &CompSpdActual, // Actual compressor running speed [rps]
Real64 &Ncomp // Compressor power [W]
Real64 &Ncomp, // Compressor power [W]
Real64 &CyclingRatio // Compressor cycling ratio
);

void VRFHR_OU_HR_Mode(EnergyPlusData &state,
Expand Down
48 changes: 45 additions & 3 deletions tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2572,6 +2572,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor)
Real64 OUEvapHeatExtract = 5110.40; // Evaporator heat extract [W]
Real64 Ncomp = 1058; // Compressor power [W]
Real64 CompSpdActual; // Actual compressor running speed [rps]
Real64 CyclingRatio = 1.0;

// Run
state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CalcCompH(*state,
Expand All @@ -2585,13 +2586,54 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor)
Pipe_Q,
OUEvapHeatExtract,
CompSpdActual,
Ncomp);
Ncomp,
CyclingRatio);

// Test
EXPECT_NEAR(5110, OUEvapHeatExtract, 1);
EXPECT_NEAR(1.0, CyclingRatio, 0.01);
EXPECT_NEAR(4654, OUEvapHeatExtract, 1); // low load calculation, min speed capacity should use the curve corresponding to the lowest speed
EXPECT_NEAR(1500, CompSpdActual, 1);
EXPECT_NEAR(2080, Ncomp, 1);
EXPECT_EQ(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU(1).VRFTUInletNodeNum).MassFlowRate, 0.0);

// Inputs_condition for an even lower load, and a more strict Te lower bound
TU_load = 3006; // Indoor unit cooling load [W]
T_suction = 8.86; // Compressor suction temperature Te' [C]
T_discharge = 40.26; // Compressor discharge temperature Tc' [C]
Pipe_h_out_ave = 233428; // Average Enthalpy of the refrigerant leaving IUs [kJ/kg]
IUMaxCondTemp = 36; // VRV IU condensing temperature, max among all indoor units [C]
MinOutdoorUnitTe = -5; // The minimum temperature that OU Te can be at cooling mode (only used for calculating Min capacity)
Tfs = 10.90; // Temperature of the air at the OU evaporator coil surface [C]]
Pipe_Q = 162.67; // Piping Loss Algorithm Parameter: Heat loss [W]
OUEvapHeatExtract = 5110.40; // Evaporator heat extract [W]
Ncomp = 1058; // Compressor power [W]
CompSpdActual; // Actual compressor running speed [rps]
CyclingRatio = 1.0;

// Run
state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CalcCompH(*state,
TU_load,
T_suction,
T_discharge,
Pipe_h_out_ave,
IUMaxCondTemp,
MinOutdoorUnitTe,
Tfs,
Pipe_Q,
OUEvapHeatExtract,
CompSpdActual,
Ncomp,
CyclingRatio);

EXPECT_NEAR(0.20, CyclingRatio, 0.01);
Real64 x = T_discharge;
Real64 y = -5; // in low load modification
Real64 CurveValueEvap = 3.19E-01 - 1.26E-03 * x - 2.15E-05 * x * x + 1.20E-02 * y + 1.05E-04 * y * y - 8.66E-05 * x * y;
Real64 CurveValuePower = 8.79E-02 - 1.72E-04 * x + 6.93E-05 * x * x - 3.38E-05 * y - 8.10E-06 * y * y - 1.04E-05 * x * y;
EXPECT_NEAR(CurveValueEvap * state->dataHVACVarRefFlow->VRF(1).RatedEvapCapacity, OUEvapHeatExtract, 1);
EXPECT_NEAR(1500, CompSpdActual, 1);
EXPECT_NEAR(CurveValuePower * state->dataHVACVarRefFlow->VRF(1).RatedCompPower, Ncomp, 1);
EXPECT_EQ(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU(1).VRFTUInletNodeNum).MassFlowRate, 0.0);
}

{
Expand Down Expand Up @@ -2634,7 +2676,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.34, CyclingRatio, 0.01);
EXPECT_NEAR(0.35, CyclingRatio, 0.01);
EXPECT_NEAR(OUEvapHeatExtract, CompEvaporatingCAPSpdMin + Ncomp, 1e-4);
EXPECT_NEAR(1500, CompSpdActual, 1);
EXPECT_NEAR(Ncomp, CompEvaporatingPWRSpdMin, 1e-4);
Expand Down

4 comments on commit ac106a0

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2890 of 2890 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (2912 of 2912 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-RelWithDebInfo: OK (799 of 799 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-RelWithDebInfo: OK (2096 of 2096 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.