Skip to content

Commit

Permalink
deal with b^2 - 4ac < 0 no root case
Browse files Browse the repository at this point in the history
  • Loading branch information
Yujie Xu committed Aug 30, 2024
1 parent b3db156 commit 7647745
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14274,9 +14274,13 @@ void VRFCondenserEquipment::VRFOU_CalcCompH(
// Update SH and Pe to calculate Modification Factor, which is used to update rps to for N_comp calculations
if (this->C3Te == 0)
Modifi_SH = -(this->C1Te - Tfs + T_suction) / this->C2Te;
else
Modifi_SH =
(-this->C2Te + std::pow((pow_2(this->C2Te) - 4 * (this->C1Te - Tfs + T_suction) * this->C3Te), 0.5)) / (2 * this->C3Te);
else {
if ((pow_2(this->C2Te) - 4 * (this->C1Te - Tfs + T_suction) * this->C3Te) < 0.0)
Modifi_SH = this->C2Te / (-2 * (this->C1Te - Tfs + T_suction));
else
Modifi_SH =
(-this->C2Te + std::pow((pow_2(this->C2Te) - 4 * (this->C1Te - Tfs + T_suction) * this->C3Te), 0.5)) / (2 * this->C3Te);
}

Modifi_Pe = this->refrig->getSatPressure(state, T_suction, RoutineName);

Expand Down

4 comments on commit 7647745

@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.

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

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

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

Build Badge Test Badge Coverage Badge

Please sign in to comment.