Skip to content

Commit

Permalink
Merge pull request #10470 from NREL/10386VarSpeedCoilInputIssueTake2
Browse files Browse the repository at this point in the history
EnergyPlus Crash Due to Zero Input for Variable Speed Coil Total Cooling
  • Loading branch information
Myoldmopar authored Apr 24, 2024
2 parents 140469e + 9f33b05 commit bd08296
Show file tree
Hide file tree
Showing 5 changed files with 194 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3295,7 +3295,9 @@ \subsubsection{Inputs}\label{inputs-17-001}

\paragraph{Field: Gross Rated Total Cooling Capacity at Selected Nominal Speed Level}\label{field-gross-rated-total-cooling-capacity-at-selected-nominal-speed-level}

This numeric field contains the gross rated total cooling capacity at the nominal speed level. This field is autosizable. The gross rated total cooling capacity is used to determine a capacity scaling factor, as compared to the Reference Unit capacity at the nominal speed level.
This numeric field contains the gross rated total cooling capacity at the nominal speed level. This field is autosizable. Note that if this field is set to zero rather than a positive number or autosized, the coil will be ignored and will not run.

The gross rated total cooling capacity is used to determine a capacity scaling factor, as compared to the Reference Unit capacity at the nominal speed level.

\begin{equation}
{\rm{CapacityScaleFactor}} = \frac{{{\rm{Gross RatedTotalCoolingCapacity}}}}{{{\rm{ReferenceUnitCapacity}}@{\rm{NominalSpeedLevel}}}}
Expand Down Expand Up @@ -7521,7 +7523,9 @@ \subsubsection{Inputs}\label{inputs-31}

\paragraph{Field: Gross Rated Total Cooling Capacity at Selected Nominal Speed Level}\label{field-gross-rated-total-cooling-capacity-at-selected-nominal-speed-level-1}

This numeric field contains the gross rated total cooling capacity at the nominal speed level. This field is autosizable. The gross rated total cooling capacity is used to determine a capacity scaling factor, as compared to the Reference Unit capacity at the nominal speed level.
This numeric field contains the gross rated total cooling capacity at the nominal speed level. This field is autosizable. Note that if this field is set to zero rather than a positive number or autosized, the coil will be ignored and will not run.

The gross rated total cooling capacity is used to determine a capacity scaling factor, as compared to the Reference Unit capacity at the nominal speed level.

\begin{equation}
CapacityScaleFactor = \frac{{GrossRatedTotalCoolingCapacity}}{{ReferenceUnitCapacity@NominalSpeedLevel}}
Expand Down
4 changes: 4 additions & 0 deletions src/EnergyPlus/DXCoils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11964,6 +11964,10 @@ Real64 CalcCBF(EnergyPlusData &state,

auto &DXCT = state.dataHVACGlobal->DXCT;

if (AirVolFlowRate <= 0.0 || TotCap <= 0.0) { // Coil not running or has no capacity, don't calculate CBF
return CBF;
}

AirMassFlowRate = AirVolFlowRate * PsyRhoAirFnPbTdbW(state, DataEnvironment::StdPressureSeaLevel, InletAirTemp, InletAirHumRat, RoutineName);
DeltaH = TotCap / AirMassFlowRate;
InletAirEnthalpy = PsyHFnTdbW(InletAirTemp, InletAirHumRat);
Expand Down
50 changes: 27 additions & 23 deletions src/EnergyPlus/VariableSpeedCoils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3998,6 +3998,7 @@ namespace VariableSpeedCoils {
if ((state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == DataHVACGlobals::Coil_CoolingWaterToAirHPVSEquationFit) ||
(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).VSCoilType == Coil_CoolingAirToAirVariableSpeed)) {
for (Mode = 1; Mode <= state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).NumOfSpeeds; ++Mode) {
if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal <= 0.0) break;
// Check for zero capacity or zero max flow rate
if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).MSRatedTotCap(Mode) <= 0.0) {
ShowSevereError(state,
Expand Down Expand Up @@ -5827,28 +5828,30 @@ namespace VariableSpeedCoils {
DefrostControl = StandardRatings::HPdefrostControl::Timed;
break;
}
StandardRatings::CalcDXCoilStandardRating(state,
varSpeedCoil.Name,
varSpeedCoil.VarSpeedCoilType,
varSpeedCoil.VSCoilType,
varSpeedCoil.NumOfSpeeds,
varSpeedCoil.MSRatedTotCap,
varSpeedCoil.MSRatedCOP,
varSpeedCoil.MSCCapAirFFlow,
varSpeedCoil.MSCCapFTemp,
varSpeedCoil.MSEIRAirFFlow,
varSpeedCoil.MSEIRFTemp,
varSpeedCoil.PLFFPLR,
varSpeedCoil.MSRatedAirVolFlowRate,
varSpeedCoil.MSRatedEvaporatorFanPowerPerVolumeFlowRate2017,
varSpeedCoil.MSRatedEvaporatorFanPowerPerVolumeFlowRate2023,
CondenserType,
0, // varSpeedCoil.RegionNum, // ??
varSpeedCoil.MinOATCompressor,
varSpeedCoil.OATempCompressorOn,
false, // varSpeedCoil.OATempCompressorOnOffBlank, // ??
DefrostControl,
ObjexxFCL::Optional_bool_const());
if (varSpeedCoil.RatedCapCoolTotal > 0.0) {
StandardRatings::CalcDXCoilStandardRating(state,
varSpeedCoil.Name,
varSpeedCoil.VarSpeedCoilType,
varSpeedCoil.VSCoilType,
varSpeedCoil.NumOfSpeeds,
varSpeedCoil.MSRatedTotCap,
varSpeedCoil.MSRatedCOP,
varSpeedCoil.MSCCapAirFFlow,
varSpeedCoil.MSCCapFTemp,
varSpeedCoil.MSEIRAirFFlow,
varSpeedCoil.MSEIRFTemp,
varSpeedCoil.PLFFPLR,
varSpeedCoil.MSRatedAirVolFlowRate,
varSpeedCoil.MSRatedEvaporatorFanPowerPerVolumeFlowRate2017,
varSpeedCoil.MSRatedEvaporatorFanPowerPerVolumeFlowRate2023,
CondenserType,
0, // varSpeedCoil.RegionNum, // ??
varSpeedCoil.MinOATCompressor,
varSpeedCoil.OATempCompressorOn,
false, // varSpeedCoil.OATempCompressorOnOffBlank, // ??
DefrostControl,
ObjexxFCL::Optional_bool_const());
}
break;
default:
break;
Expand Down Expand Up @@ -5974,6 +5977,7 @@ namespace VariableSpeedCoils {
state.dataVariableSpeedCoils->CpAir_Init = PsyCpAirFnW(state.dataVariableSpeedCoils->LoadSideInletHumRat_Init);
state.dataVariableSpeedCoils->firstTime = false;
}

state.dataVariableSpeedCoils->LoadSideInletWBTemp_Init = PsyTwbFnTdbWPb(state,
state.dataVariableSpeedCoils->LoadSideInletDBTemp_Init,
state.dataVariableSpeedCoils->LoadSideInletHumRat_Init,
Expand Down Expand Up @@ -6105,7 +6109,7 @@ namespace VariableSpeedCoils {
state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = true;
}

if (CompressorOp == CompressorOperation::Off) {
if (CompressorOp == CompressorOperation::Off || state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).RatedCapCoolTotal <= 0.0) {
state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).SimFlag = false;
return;
}
Expand Down
1 change: 1 addition & 0 deletions tst/EnergyPlus/unit/DXCoils.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,7 @@ TEST_F(EnergyPlusFixture, TestReadingCoilCoolingHeatingDX)
Real64 OnOffAirFlowRatio = 0.5;
state->dataVariableSpeedCoils->VarSpeedCoil(VarSpeedCoilNum).AirMassFlowRate = 1.0;
state->dataVariableSpeedCoils->VarSpeedCoil(VarSpeedCoilNum).RunFrac = 0.0;
state->dataVariableSpeedCoils->VarSpeedCoil(VarSpeedCoilNum).RatedCapCoolTotal = 100.0;
// power = 26 + 2x
VariableSpeedCoils::CalcVarSpeedCoilCooling(*state,
VarSpeedCoilNum,
Expand Down
Loading

2 comments on commit bd08296

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2768 of 2768 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-MacOS-10.18-clang-15.0.0: OK (2769 of 2769 tests passed, 0 test warnings)

Build Badge Test Badge

Please sign in to comment.