Skip to content

Commit

Permalink
Move cycling ratio to inside compressor spd calc for heating
Browse files Browse the repository at this point in the history
after multiplying cycling ratio to the outdoor unit, some super large COP
appeared in some timesteps. This is probably due to the cycling ratio
calculation, moving it to inside the compressor speed calculation fixed this
problem.
  • Loading branch information
Yujie Xu committed Feb 26, 2024
1 parent b9c6bff commit 7d79eac
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 76 deletions.
134 changes: 60 additions & 74 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11856,80 +11856,61 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)
CapMinTe + 8,
this->IUCondensingTemp - 5);

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 {
// Required heating load is greater than or equal to the min heating capacity

// Iteration_Ncomp: Perform iterations to calculate Ncomp (Label20)
Counter = 1;
Label20:;
Ncomp_new = Ncomp;
Q_c_OU = max(0.0, Q_h_TU_PL - Ncomp);

// *VRF OU Te calculations
m_air = this->OUAirFlowRate * RhoAir;
SH_OU = this->SH;
this->VRFOU_TeTc(
state, HXOpMode::EvapMode, Q_c_OU, SH_OU, m_air, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, Tfs, this->EvaporatingTemp);
this->SH = SH_OU;

// *VRF OU Compressor Simulation at heating mode: Specify the compressor speed and power consumption
this->VRFOU_CalcCompH(state,
TU_HeatingLoad,
this->EvaporatingTemp,
Tdischarge,
h_IU_cond_out_ave,
this->IUCondensingTemp,
CapMinTe,
Tfs,
Pipe_Q_h,
Q_c_OU,
CompSpdActual,
Ncomp_new);

if ((std::abs(Ncomp_new - Ncomp) > (Tolerance * Ncomp)) && (Counter < 30)) {
Ncomp = Ncomp_new;
Counter = Counter + 1;
goto Label20;
}
// Required heating load is greater than or equal to the min heating capacity

// Iteration_Ncomp: Perform iterations to calculate Ncomp (Label20)
Counter = 1;
Label20:;
Ncomp_new = Ncomp;
Q_c_OU = max(0.0, Q_h_TU_PL - Ncomp);

// *VRF OU Te calculations
m_air = this->OUAirFlowRate * RhoAir;
SH_OU = this->SH;
this->VRFOU_TeTc(state, HXOpMode::EvapMode, Q_c_OU, SH_OU, m_air, OutdoorDryBulb, OutdoorHumRat, OutdoorPressure, Tfs, this->EvaporatingTemp);
this->SH = SH_OU;

Real64 CyclingRatio = 1.0;
// *VRF OU Compressor Simulation at heating mode: Specify the compressor speed and power consumption
this->VRFOU_CalcCompH(state,
TU_HeatingLoad,
this->EvaporatingTemp,
Tdischarge,
h_IU_cond_out_ave,
this->IUCondensingTemp,
CapMinTe,
Tfs,
Pipe_Q_h,
Q_c_OU,
CompSpdActual,
Ncomp_new,
CyclingRatio);

if ((std::abs(Ncomp_new - Ncomp) > (Tolerance * Ncomp)) && (Counter < 30)) {
Ncomp = Ncomp_new;
Counter = Counter + 1;
goto Label20;
}

// Update h_comp_out in iteration Label23
P_comp_in = GetSatPressureRefrig(state, this->RefrigerantName, this->EvaporatingTemp, RefrigerantIndex, RoutineName);
RefTSat = GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(P_comp_in, RefPHigh), RefPLow), RefrigerantIndex, RoutineName);
h_comp_in_new = GetSupHeatEnthalpyRefrig(state,
this->RefrigerantName,
max(RefTSat, this->SH + this->EvaporatingTemp),
max(min(P_comp_in, RefPHigh), RefPLow),
RefrigerantIndex,
RoutineName);
h_comp_out_new = Ncomp_new / m_ref_IU_cond + h_comp_in_new;
// Update h_comp_out in iteration Label23
P_comp_in = GetSatPressureRefrig(state, this->RefrigerantName, this->EvaporatingTemp, RefrigerantIndex, RoutineName);
RefTSat = GetSatTemperatureRefrig(state, this->RefrigerantName, max(min(P_comp_in, RefPHigh), RefPLow), RefrigerantIndex, RoutineName);
h_comp_in_new = GetSupHeatEnthalpyRefrig(state,
this->RefrigerantName,
max(RefTSat, this->SH + this->EvaporatingTemp),
max(min(P_comp_in, RefPHigh), RefPLow),
RefrigerantIndex,
RoutineName);
h_comp_out_new = Ncomp_new / m_ref_IU_cond + h_comp_in_new;

if ((std::abs(h_comp_out - h_comp_out_new) > Tolerance * h_comp_out) && (h_IU_cond_in < h_IU_cond_in_up)) {
h_IU_cond_in = h_IU_cond_in + 0.1 * (h_IU_cond_in_up - h_IU_cond_in_low);
goto Label23;
}
if (h_IU_cond_in > h_IU_cond_in_up) {
h_IU_cond_in = 0.5 * (h_IU_cond_in_up + h_IU_cond_in_low);
}
Ncomp = Ncomp_new;
if ((std::abs(h_comp_out - h_comp_out_new) > Tolerance * h_comp_out) && (h_IU_cond_in < h_IU_cond_in_up)) {
h_IU_cond_in = h_IU_cond_in + 0.1 * (h_IU_cond_in_up - h_IU_cond_in_low);
goto Label23;
}
if (h_IU_cond_in > h_IU_cond_in_up) {
h_IU_cond_in = 0.5 * (h_IU_cond_in_up + h_IU_cond_in_low);
}
Ncomp = Ncomp_new;

// Key outputs of this subroutine
this->CompActSpeed = max(CompSpdActual, 0.0);
Expand Down Expand Up @@ -14487,7 +14468,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 @@ -14651,9 +14633,13 @@ void VRFCondenserEquipment::VRFOU_CalcCompH(
NumIteCcap = NumIteCcap + 1;
goto Label19;
}
if (CapDiff > (Tolerance * Cap_Eva0)) NumIteCcap = 999;
if (CapDiff > (Tolerance * Cap_Eva0)) {
NumIteCcap = 999;
CyclingRatio = (TU_load + Pipe_Q) * C_cap_operation / Cap_Eva1;
}

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

break; // EXIT DoName2

Expand Down
3 changes: 2 additions & 1 deletion src/EnergyPlus/HVACVariableRefrigerantFlow.hh
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,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
4 changes: 3 additions & 1 deletion tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2570,6 +2570,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor)
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,
TU_load,
Expand All @@ -2582,7 +2583,8 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor)
Pipe_Q,
OUEvapHeatExtract,
CompSpdActual,
Ncomp);
Ncomp,
CyclingRatio);

// Test
EXPECT_NEAR(5110, OUEvapHeatExtract, 1);
Expand Down

5 comments on commit 7d79eac

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

vrfCoolingFan (Unknown) - Win64-Windows-10-VisualStudio-16: OK (2757 of 2758 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1482
  • Failed: 1

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

vrfCoolingFan (Unknown) - x86_64-MacOS-10.18-clang-15.0.0: OK (3269 of 3545 tests passed, 256 test warnings)

Messages:\n

  • 463 tests had: DXF diffs.
  • 274 tests had: Table big diffs.
  • 30 tests had: EIO diffs.
  • 8 tests had: SSZ big diffs.
  • 26 tests had: AUD diffs.
  • 22 tests had: ESO small diffs.
  • 13 tests had: MTR small diffs.
  • 5 tests had: RDD diffs.
  • 16 tests had: Table small diffs.
  • 3 tests had: IDF diffs.
  • 1 test had: BND diffs.
  • 3 tests had: ESO big diffs.
  • 2 tests had: MTR big diffs.
  • 2 tests had: ERR diffs.

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1484
  • Failed: 1

regression Test Summary

  • Passed: 512
  • Failed: 274

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

vrfCoolingFan (Unknown) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3310 of 3586 tests passed, 259 test warnings)

Messages:\n

  • 466 tests had: DXF diffs.
  • 275 tests had: Table big diffs.
  • 27 tests had: EIO diffs.
  • 8 tests had: SSZ big diffs.
  • 26 tests had: AUD diffs.
  • 22 tests had: ESO small diffs.
  • 13 tests had: MTR small diffs.
  • 5 tests had: RDD diffs.
  • 16 tests had: Table small diffs.
  • 3 tests had: IDF diffs.
  • 1 test had: BND diffs.
  • 3 tests had: ESO big diffs.
  • 2 tests had: MTR big diffs.
  • 1 test had: ERR diffs.

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1484
  • Failed: 1

regression Test Summary

  • Passed: 531
  • Failed: 275

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.

vrfCoolingFan (Unknown) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1970 of 1971 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1484
  • Failed: 1

Build Badge Test Badge Coverage Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

vrfCoolingFan (Unknown) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (790 of 790 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.