Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix VRF_FluidTCtrl heating round 2 #10331

Merged
merged 25 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
34bef65
fix non-matching heating rate and supp heating coil
Dec 15, 2023
b9e8716
use PLR for energy transfer, clang-format
Dec 15, 2023
31d03bc
Add SC adjustment at high demand
Dec 16, 2023
5746fbf
clang-format
Dec 16, 2023
010fd51
Revert "Add SC adjustment at high demand"
Dec 18, 2023
b5b9122
Accumulate outputs in the new branch, fix single outlier
Dec 20, 2023
3c2ca1c
remove inlet ari temperature overwrite
Jan 24, 2024
cc209cd
add condition to only overwrite in heating mode
Jan 25, 2024
e2e5927
Merge remote-tracking branch 'origin/develop' into vrfHeating3
Jan 31, 2024
3decf87
change DefrostPower calc to use RTF
Feb 28, 2024
114ccb2
error msg to ensure CompEvaporatingCAPSpdMaxCurrentTsuc >= CompEvapor…
Feb 28, 2024
472513a
revert back to excluding Ncomp from Q_evap_req
Feb 28, 2024
6f3ad16
Merge remote-tracking branch 'origin/develop' into vrfHeating3
Feb 28, 2024
0d7f6ec
remove CompEvaporatingPWRSpdMaxCurrentTsuc from thresh, clang-format
Feb 28, 2024
f51b81d
clang format (copy in develop branch format)
Mar 1, 2024
a7a1178
resolve unbalanced air flow error
Mar 6, 2024
a2a0441
Fix recurring error
Apr 30, 2024
82f2a31
Move AirMassFlow update to after SimDXCoil
Apr 30, 2024
9a5912e
remove C_cap_operation overwrite
Apr 30, 2024
444eee3
impose MaxHeatCap limit to CalcVRFTUAirFlowRate_
May 3, 2024
cff7ba0
Revert "Fix recurring error"
May 3, 2024
93618cf
fix recurring error with timestamp and end summary
May 3, 2024
17442f0
clang-format
May 6, 2024
43e441c
Merge remote-tracking branch 'origin/develop' into vrfHeating3
May 6, 2024
99dc744
Merge remote-tracking branch 'origin/develop' into vrfHeating3
May 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/EnergyPlus/DXCoils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17286,8 +17286,9 @@ void CalcVRFHeatingCoil_FluidTCtrl(EnergyPlusData &state,
thisDXCoil.CompressorPartLoadRatio = PartLoadRatio;
thisDXCoil.ActualSH = ActualSH;
thisDXCoil.ActualSC = ActualSC;
thisDXCoil.TotalHeatingEnergyRate = AirMassFlow * (OutletAirEnthalpy - InletAirEnthalpy);
thisDXCoil.TotalHeatingEnergyRate = AirMassFlow * (OutletAirEnthalpy - InletAirEnthalpy) * PartLoadRatio;
thisDXCoil.DefrostPower = thisDXCoil.DefrostPower * thisDXCoil.HeatingCoilRuntimeFraction;
thisDXCoil.InletAirMassFlowRate = AirMassFlow * PartLoadRatio;

} else {
// DX coil is off; just pass through conditions
Expand Down Expand Up @@ -17578,7 +17579,6 @@ void ControlVRFIUCoil(EnergyPlusData &state,
// outlet air temperature is time-weighted
Tout = CoilOnOffRatio * To_2 + (1 - CoilOnOffRatio) * Tin;
}

Wout = Win;
Hout = PsyHFnTdbW(Tout, Wout);
SHact = 999.0;
Expand Down
40 changes: 34 additions & 6 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11361,7 +11361,6 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)
Real64 SH_Comp; // Temperature difference between compressor inlet node and Tsuction [C]
Real64 T_comp_in; // temperature of refrigerant at compressor inlet, after piping loss (c) [C]
Real64 TU_HeatingLoad; // Heating load from terminal units, excluding heating loss [W]
Real64 TU_HeatingLoad_actual; // TU_HeatingLoad trimed to maximum system capacity[W]
Real64 TU_CoolingLoad; // Cooling load from terminal units, excluding heating loss [W]
Real64 Tdischarge; // VRF Compressor discharge refrigerant temperature [C]
Real64 Tsuction; // VRF compressor suction refrigerant temperature [C]
Expand Down Expand Up @@ -11430,7 +11429,6 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)
}
this->TUCoolingLoad = TU_CoolingLoad; // this is cooling coil load, not terminal unit load
this->TUHeatingLoad = TU_HeatingLoad; // this is heating coil load, not terminal unit load
TU_HeatingLoad_actual = TU_HeatingLoad;

// loop through TU's and calculate average inlet conditions for active coils
for (NumTU = 1; NumTU <= NumTUInList; ++NumTU) {
Expand Down Expand Up @@ -11787,8 +11785,7 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)
RoutineName); // Quality=0
h_IU_cond_out_ave = h_IU_cond_out;
SC_IU_merged = 5;
TU_HeatingLoad_actual = min(TU_HeatingLoad, CompEvaporatingCAPSpdMax + CompEvaporatingPWRSpdMax);
m_ref_IU_cond = TU_HeatingLoad_actual / (h_IU_cond_in - h_IU_cond_out);
m_ref_IU_cond = TU_HeatingLoad / (h_IU_cond_in - h_IU_cond_out);

} else {
for (NumTU = 1; NumTU <= NumTUInList; NumTU++) {
Expand Down Expand Up @@ -11856,7 +11853,28 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)
CapMinTe + 8,
this->IUCondensingTemp - 5);

if ((Q_c_OU * C_cap_operation) <= CompEvaporatingCAPSpdMin) {
Real64 CompEvaporatingCAPSpdMaxCurrentTsuc = this->CoffEvapCap * this->RatedEvapCapacity *
CurveValue(state, this->OUCoolingCAPFT(NumOfCompSpdInput), Tdischarge, this->EvaporatingTemp);
Real64 CompEvaporatingPWRSpdMaxCurrentTsuc =
this->RatedCompPower * CurveValue(state, this->OUCoolingPWRFT(NumOfCompSpdInput), Tdischarge, this->EvaporatingTemp);
if (CompEvaporatingCAPSpdMin > CompEvaporatingCAPSpdMaxCurrentTsuc) {
ShowSevereMessage(state, format("{} \"{}\":", cVRFTypes(VRF_HeatPump), this->Name));
ShowContinueError(state,
format(" Evaporative Capacity at max speed is smaller than evaporative capacity at min speed, "
"{:.3T} < {:.3T}",
CompEvaporatingCAPSpdMaxCurrentTsuc,
CompEvaporatingCAPSpdMin));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should add the recurring error format so this warning, however unlikely, does not fill the err file if it ever does report. Also, if this warning does report shouldn't the model use one of these capacities (CAPSpdMin?) to set other variables so that subsequent calculations can proceed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

add the recurring error format in commit a2a0441 "Fix recurring error"

if ((Q_c_OU * C_cap_operation) > CompEvaporatingCAPSpdMaxCurrentTsuc) {
// this branch resolves the issue of supplemental heating coil turning on when compressor speed is not at the highest
Q_c_OU = CompEvaporatingCAPSpdMaxCurrentTsuc;
CompSpdActual = this->CompressorSpeed(NumOfCompSpdInput);
Ncomp = CompEvaporatingPWRSpdMaxCurrentTsuc;
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);
} else if ((Q_c_OU * C_cap_operation) <= CompEvaporatingCAPSpdMin) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't comment on the math here, but what if the curve result yields CompEvaporatingPWRSpdMaxCurrentTsuc that gives a value in the IF that is less than CompEvaporatingCAPSpdMin in the ELSE IF? Just pointing this out so you think about what that might mean.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, this part might also need some change as well. The intention was to match the calculation here (which computes the compressor speed) and previously in limitTUCapacity. Let me sort this through

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added a error message to ensure that CompEvaporatingCAPSpdMin is less than CompEvaporatingCAPSpdMaxCurrentTsuc so the case when Q_c_OU * C_cap_operation <= CompEvaporatingCAPSpdMin and Q_c_OU * C_cap_operation > CompEvaporatingCAPSpdMaxCurrentTsuc + CompEvaporatingPWRSpdMaxCurrentTsuc won't occur.

// Required heating load is smaller than the min heating capacity

if (Q_c_OU == 0) {
Expand All @@ -11875,6 +11893,7 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)
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

// Iteration_Ncomp: Perform iterations to calculate Ncomp (Label20)
Expand Down Expand Up @@ -11944,7 +11963,7 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)
this->OUCoolingPWRFT(NumOfCompSpdInput),
Tdischarge,
Tsuction); // Include the piping loss, at the highest compressor speed
this->PipingCorrectionHeating = TU_HeatingLoad_actual / (TU_HeatingLoad_actual + Pipe_Q_h);
this->PipingCorrectionHeating = TU_HeatingLoad / (TU_HeatingLoad + Pipe_Q_h);
state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond) =
this->HeatingCapacity; // for report, maximum condensing capacity the system can provide

Expand Down Expand Up @@ -13012,6 +13031,9 @@ void VRFTerminalUnitEquipment::CalcVRF_FluidTCtrl(EnergyPlusData &state,
_,
_,
state.dataHVACVarRefFlow->MaxHeatingCapacity(VRFCond));
// yujie: update TU air mass flow
state.dataLoopNodes->Node(state.dataHVACVarRefFlow->VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate =
state.dataDXCoils->DXCoil(this->HeatCoilIndex).InletAirMassFlowRate;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not standard practice to update another model's operating conditions. Why doesn't the VRF model know what air flow is being used?

Copy link
Collaborator Author

@yujiex yujiex Apr 30, 2024

Choose a reason for hiding this comment

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

In the original code, the air mass flow of the coil is updated here through FanSpdRatio.
image
As a result, the rate of air flowing into the coil should be updated as well. This is added in this PR, in the original code, the thisDXCoil.InletAirMassFlowRate is not adjusted when FanSpdRatio changes.
image
Maybe it's okay to just update the AirMassFlow after the SimDXCoil?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I would delete the new lines at 13034- 13046 and then follow suggestion below.

} else {
SimDXCoil(state, "", DataHVACGlobals::CompressorOperation::Off, FirstHVACIteration, this->HeatCoilIndex, OpMode, 0.0, _);
}
Expand Down Expand Up @@ -13082,6 +13104,11 @@ void VRFTerminalUnitEquipment::CalcVRF_FluidTCtrl(EnergyPlusData &state,
}
}
// calculate sensible load met using delta enthalpy
auto const &thisDXCoil = state.dataDXCoils->DXCoil(this->HeatCoilIndex);
// yujie: correct mismatching in the air mass flow rate
if (thisDXCoil.TotalHeatingEnergyRate > 0.0) {
AirMassFlow = state.dataDXCoils->DXCoil(this->HeatCoilIndex).InletAirMassFlowRate;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is there a mismatch in AirMassFlow? AirMassFlow is used in the LoadMet calculation on line 13112. That calculation should include any supply side AT Mixer flow if used on the supply side of this TU which would be different than the AirMassFlow used by the coil. See line 13082 above.

Copy link
Contributor

@rraustad rraustad Apr 30, 2024

Choose a reason for hiding this comment

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

Replace lines 13107 - 13111 with:

AirMassFlow = state.dataLoopNodes->Node(VRFTUOutletNodeNum).MassFlowRate;

This is the code flow:

SetAverageAirFlow(state, VRFTUNum, PartLoadRatio, OnOffAirFlowRatio); <-- sets TU inlet node mass flow
call ATMixer on inlet side if one exists
call fan and coils in correct order
call ATMixer on supply side if one exists

So now here each child component has passed air mass flow from it's inlet to outlet all the way through the TU. And the outlet node of the TU should be the mass flow rate used to calculate LoadMet.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved the AirMassFlow updates to after SimDXCoil where the coil gets its updated air flow rate value.

LoadMet = AirMassFlow * PsyDeltaHSenFnTdb2W2Tdb1W1(TempOut, SpecHumOut, TempIn, SpecHumIn); // sensible {W}
LatentLoadMet = AirMassFlow * (SpecHumOut - SpecHumIn); // latent {kgWater/s}
if (present(LatOutputProvided)) {
Expand Down Expand Up @@ -14546,6 +14573,7 @@ void VRFCondenserEquipment::VRFOU_CalcCompH(
RoutineName);
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);
C_cap_operation = 1.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

This line overwrites the calculation at line 14574, why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was used for debugging things. I forgot to remove it afterward. Sorry for the confusion.


// Perform iterations to find the compressor speed that can meet the required heating load, Iteration DoName2
for (CounterCompSpdTemp = 1; CounterCompSpdTemp <= NumOfCompSpdInput; CounterCompSpdTemp++) {
Expand Down
Loading