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

refactoring goto statements #10505

Draft
wants to merge 15 commits into
base: develop
Choose a base branch
from
Draft
Changes from 3 commits
Commits
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
56 changes: 28 additions & 28 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11687,36 +11687,36 @@ void VRFCondenserEquipment::CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state)

// Iteration_Ncomp: Perform iterations to calculate Ncomp (Label20)
Counter = 1;
Label20:;
Copy link
Collaborator

Choose a reason for hiding this comment

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

🙏

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)) {
bool not_converged;
do {
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);

bool not_converged = (std::abs(Ncomp_new - Ncomp) > (Tolerance * Ncomp));
Copy link
Member

Choose a reason for hiding this comment

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

If you are still making changes in this PR, could I make the tiniest of requests? Could you make the variable name converged instead of not_converged? If we ever need to check if we are converged, we have to check !not_converged, and that's a more difficult mental parse, at least to me. If you are done touching this code, then feel free to ignore, it's not all that important :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the suggestion @Myoldmopar. I will change it to converged instead. I will continue working on this.

Ncomp = Ncomp_new;
Counter = Counter + 1;
goto Label20;
}
} while (not_converged && (Counter < 30));

// Update h_comp_out in iteration Label23
P_comp_in = GetSatPressureRefrig(state, this->RefrigerantName, this->EvaporatingTemp, RefrigerantIndex, RoutineName);
Expand Down
Loading