Skip to content

Commit

Permalink
Revert "Move cycling ratio to inside compressor spd calc for heating"
Browse files Browse the repository at this point in the history
This reverts commit 7d79eac.
  • Loading branch information
Yujie Xu authored and Yujie Xu committed Feb 28, 2024
1 parent 7d79eac commit aee8c4a
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 65 deletions.
134 changes: 74 additions & 60 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11856,61 +11856,80 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)
CapMinTe + 8,
this->IUCondensingTemp - 5);

// 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;
}
if ((Q_c_OU * C_cap_operation) <= CompEvaporatingCAPSpdMin) {
// Required heating load is smaller than the min heating capacity

// 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 (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);
}

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);
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;
}

// 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;
}
Ncomp = Ncomp_new;

// Key outputs of this subroutine
this->CompActSpeed = max(CompSpdActual, 0.0);
Expand Down Expand Up @@ -14468,8 +14487,7 @@ 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 &CyclingRatio // Compressor cycling ratio
Real64 &Ncomp // Compressor power [W]
)
{

Expand Down Expand Up @@ -14633,13 +14651,9 @@ void VRFCondenserEquipment::VRFOU_CalcCompH(
NumIteCcap = NumIteCcap + 1;
goto Label19;
}
if (CapDiff > (Tolerance * Cap_Eva0)) {
NumIteCcap = 999;
CyclingRatio = (TU_load + Pipe_Q) * C_cap_operation / Cap_Eva1;
}
if (CapDiff > (Tolerance * Cap_Eva0)) NumIteCcap = 999;

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

break; // EXIT DoName2

Expand Down
3 changes: 1 addition & 2 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.hh
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,7 @@ 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 &CyclingRatio // Compressor cycling ratio
Real64 &Ncomp // Compressor power [W]
);

void VRFHR_OU_HR_Mode(EnergyPlusData &state,
Expand Down
4 changes: 1 addition & 3 deletions tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2570,7 +2570,6 @@ 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 @@ -2583,8 +2582,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor)
Pipe_Q,
OUEvapHeatExtract,
CompSpdActual,
Ncomp,
CyclingRatio);
Ncomp);

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

5 comments on commit aee8c4a

@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 (2758 of 2758 tests passed, 0 test warnings)

Build Badge Test 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.

vrfCoolingFan (Unknown) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3311 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.

Failures:\n

regression Test Summary

  • Passed: 531
  • Failed: 275

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 (3270 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.
  • 1 test had: ERR diffs.

Failures:\n

regression Test Summary

  • Passed: 512
  • Failed: 274

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-IntegrationCoverage-Debug: OK (790 of 790 tests passed, 0 test warnings)

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-UnitTestsCoverage-Debug: OK (1971 of 1971 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.