Skip to content

Commit

Permalink
add condensing temperature overwrite like in cooling mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Yujie Xu committed Aug 29, 2024
1 parent dda96d9 commit d5d686e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
37 changes: 33 additions & 4 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ void SimulateVRF(EnergyPlusData &state,

if (state.dataHVACVarRefFlow->VRF(VRFCondenser).VRFAlgorithmType == AlgorithmType::FluidTCtrl) {
// Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
state.dataHVACVarRefFlow->VRF(VRFCondenser).CalcVRFCondenser_FluidTCtrl(state);
state.dataHVACVarRefFlow->VRF(VRFCondenser).CalcVRFCondenser_FluidTCtrl(state, FirstHVACIteration);
} else {
// Algorithm Type: VRF model based on system curve
CalcVRFCondenser(state, VRFCondenser);
Expand Down Expand Up @@ -11010,7 +11010,7 @@ void VRFTerminalUnitEquipment::CalcVRFIUVariableTeTc(EnergyPlusData &state,
}
}

void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)
void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, const bool FirstHVACIteration)
{

// SUBROUTINE INFORMATION:
Expand Down Expand Up @@ -12333,6 +12333,26 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)

// Calculate the IU Te/Tc for the next time step
this->CalcVRFIUTeTc_FluidTCtrl(state);

// update coil and IU condensing temperature, also keep coil RTF updated with the condenser side cycling ratio, for the FluidTCtrl model
for (int VRFTUNum = 1; VRFTUNum <= state.dataHVACVarRefFlow->NumVRFTU; ++VRFTUNum) {
auto const &thisTU = state.dataHVACVarRefFlow->VRFTU(VRFTUNum);
auto &heatingCoil = state.dataDXCoils->DXCoil(thisTU.HeatCoilIndex);
if (this->adjustedTeHeating && (!FirstHVACIteration)) {
heatingCoil.CondensingTemp = this->CondensingTemp;
this->IUCondensingTemp = this->CondensingTemp;
}

int PLF;
if (heatingCoil.PLFFPLR(1) > 0 && this->VRFCondCyclingRatio < 1.0) {
PLF = Curve::CurveValue(state, heatingCoil.PLFFPLR(1), this->VRFCondCyclingRatio); // Calculate part-load factor
} else {
PLF = 1.0;
}
if (heatingCoil.TotalCoolingEnergyRate > 0.0) {
heatingCoil.CoolingCoilRuntimeFraction = this->VRFCondCyclingRatio / PLF;
}
}
}

void VRFTerminalUnitEquipment::ControlVRF_FluidTCtrl(EnergyPlusData &state,
Expand Down Expand Up @@ -14198,7 +14218,7 @@ void VRFCondenserEquipment::VRFOU_CalcCompH(
Real64 RefTSat; // Saturated temperature of the refrigerant [C]
Real64 RefPLow; // Low Pressure Value for Ps (>0.0) [Pa]
Real64 RefPHigh; // High Pressure Value for Ps (max in tables) [Pa]
Real64 Tolerance(0.05); // Tolerance for condensing temperature calculation [C]
Real64 constexpr Tolerance(0.05); // Tolerance for condensing temperature calculation [C]
Array1D<Real64> CompEvaporatingPWRSpd; // Array for the compressor power at certain speed [W]
Array1D<Real64> CompEvaporatingCAPSpd; // Array for the evaporating capacity at certain speed [W]

Expand All @@ -14223,6 +14243,7 @@ void VRFCondenserEquipment::VRFOU_CalcCompH(
C_cap_operation = this->VRFOU_CapModFactor(
state, Pipe_h_comp_in, Pipe_h_out_ave, max(min(MinOutdoorUnitPe, RefPHigh), RefPLow), T_suction + this->SH, T_suction + 8, IUMaxCondTemp - 5);

this->adjustedTeHeating = false;
// Perform iterations to find the compressor speed that can meet the required heating load, Iteration DoName2
for (CounterCompSpdTemp = 1; CounterCompSpdTemp <= NumOfCompSpdInput; CounterCompSpdTemp++) {

Expand Down Expand Up @@ -14265,11 +14286,19 @@ 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);
};

// Te can't be smaller than user input lower bound
MinOutdoorUnitTe = max(this->IUEvapTempLow, MinOutdoorUnitTe);
General::SolveRoot(state, 1.0e-3, MaxIter, SolFla, SmallLoadTe, f, MinOutdoorUnitTe, T_suction);
if (SolFla < 0) SmallLoadTe = MinOutdoorUnitTe;
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));
}

T_suction = SmallLoadTe;
this->adjustedTeHeating = true;

// Update SH and Pe to calculate Modification Factor, which is used to update rps to for N_comp calculations
if (this->C3Te == 0)
Expand Down
5 changes: 3 additions & 2 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.hh
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ namespace HVACVariableRefrigerantFlow {
Real64 VRFOperationSimPath; // simulation path indicating the VRF operation mode [--]
bool checkPlantCondTypeOneTime;
int CondenserCapErrIdx; // recurring condenser capacity error index
bool adjustedTeHeating;

// Default Constructor
VRFCondenserEquipment()
Expand Down Expand Up @@ -427,7 +428,7 @@ namespace HVACVariableRefrigerantFlow {
RatedHeatCapacity(0.0), RatedCompPower(14000.0), RatedCompPowerPerCapcity(0.35), RatedOUFanPower(0.0), RatedOUFanPowerPerCapcity(0.0),
RateBFOUEvap(0.45581), RateBFOUCond(0.21900), RefPipDiaSuc(0.0), RefPipDiaDis(0.0), RefPipLen(0.0), RefPipEquLen(0.0), RefPipHei(0.0),
RefPipInsThi(0.0), RefPipInsCon(0.0), SH(0.0), SC(0.0), SCHE(0.0), SHLow(0.0), SCLow(0.0), SHHigh(0.0), SCHigh(0.0),
VRFOperationSimPath(0.0), checkPlantCondTypeOneTime(true), CondenserCapErrIdx(0)
VRFOperationSimPath(0.0), checkPlantCondTypeOneTime(true), CondenserCapErrIdx(0), adjustedTeHeating(false)
{
}

Expand All @@ -449,7 +450,7 @@ namespace HVACVariableRefrigerantFlow {

void SizeVRFCondenser(EnergyPlusData &state);

void CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state);
void CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state, const bool FirstHVACIteration);

void CalcVRFIUTeTc_FluidTCtrl(EnergyPlusData &state);

Expand Down

4 comments on commit d5d686e

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

vrfFluidCtrlFixHeatingCycling (Unknown) - Win64-Windows-10-VisualStudio-16: OK (2870 of 2871 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1581
  • Failed: 1

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.

vrfFluidCtrlFixHeatingCycling (Unknown) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3703 of 3706 tests passed, 1 test warnings)

Messages:\n

  • 2 tests had: ESO big diffs.
  • 2 tests had: MTR big diffs.
  • 2 tests had: Table big diffs.
  • 2 tests had: Table string diffs.
  • 1 test had: ERR diffs.
  • 1 test had: EIO diffs.

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1583
  • Failed: 1

regression Test Summary

  • Passed: 811
  • Failed: 2

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.

vrfFluidCtrlFixHeatingCycling (Unknown) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (2076 of 2077 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1583
  • Failed: 1

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

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

Failures:\n

integration Test Summary

  • Passed: 796
  • Failed: 1

Build Badge Test Badge Coverage Badge

Please sign in to comment.