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

EnergyPlus Crash Due to Zero Input for Variable Speed Coil Total Cooling #10470

Merged
merged 9 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

protects the CBF calcs


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
Loading