Skip to content

Commit

Permalink
add converge check that h_comp_out_new changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Yujie Xu committed Aug 23, 2024
1 parent 765218b commit 35d4b69
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/EnergyPlus/HVACVariableRefrigerantFlow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11123,6 +11123,8 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)
Real64 h_comp_in_new; // enthalpy of refrigerant at compressor inlet (new) [kJ/kg]
Real64 h_comp_out; // enthalpy of refrigerant at compressor outlet [kJ/kg]
Real64 h_comp_out_new; // enthalpy of refrigerant at compressor outlet (new) [kJ/kg]
Real64 h_comp_out_new_prev; // previous value of h_comp_out_new
Real64 tol_h_comp_out_new; // tolerance of h_comp_out_new change
Real64 m_air; // OU coil air mass flow rate [kg/s]
Real64 m_ref_IU_cond; // mass flow rate of Refrigerant through IU condensers [kg/s]
Real64 m_ref_IU_cond_i; // mass flow rate of Refrigerant through an individual IU condenser [kg/s]
Expand Down Expand Up @@ -11214,6 +11216,8 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)
RefPLow = this->refrig->PsLowPresValue; // Low Pressure Value for Ps (>0.0)
RefPHigh = this->refrig->PsHighPresValue; // High Pressure Value for Ps (max in tables)

tol_h_comp_out_new = 1e-10;

This comment has been minimized.

Copy link
@rraustad

rraustad Aug 23, 2024

Contributor

constexpr

This comment has been minimized.

Copy link
@yujiex

yujiex Aug 23, 2024

Collaborator

Just added. I keep forgetting these...


// sum loads on TU coils
for (NumTU = 1; NumTU <= NumTUInList; ++NumTU) {
TU_CoolingLoad += state.dataHVACVarRefFlow->TerminalUnitList(TUListNum).TotalCoolLoad(NumTU);
Expand Down Expand Up @@ -11924,10 +11928,11 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)
}

//* Update h_comp_out in iteration (Label230)
h_comp_out_new_prev = h_comp_out_new;
h_comp_out_new = Ncomp / (m_ref_IU_evap + m_ref_OU_evap) + h_comp_in;

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_low < h_IU_cond_in)) {
(h_IU_cond_in_low < h_IU_cond_in) && std::abs(h_comp_out_new - h_comp_out_new_prev) > tol_h_comp_out_new) {

This comment has been minimized.

Copy link
@rraustad

rraustad Aug 23, 2024

Contributor

I am trying to think of a way to simplify this since this is a loop within each iteration. Wouldn't && (h_comp_out_new != h_comp_out_new_prev) work? Does that even help with execution speed?

This comment has been minimized.

Copy link
@yujiex

yujiex Aug 23, 2024

Collaborator

probably, not sure if we want early exiting for just small changes as well.

Real64 h_IU_cond_in_old = h_IU_cond_in;
if (h_comp_out < h_comp_out_new) {
h_IU_cond_in = h_IU_cond_in + 0.1 * (h_IU_cond_in_up - h_IU_cond_in_low);
Expand Down

4 comments on commit 35d4b69

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

fixVRFnegativeFanPower (Unknown) - Win64-Windows-10-VisualStudio-16: OK (2871 of 2871 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.

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

fixVRFnegativeFanPower (Unknown) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (2077 of 2077 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.

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

Build Badge Test Badge Coverage Badge

Please sign in to comment.