From e404a0d756d91bc4ba87c972b168d528d0e4aa5b Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Tue, 9 Jan 2024 11:38:49 -0700 Subject: [PATCH 01/21] Ported function signature changes. --- src/EnergyPlus/Coils/CoilCoolingDX.cc | 16 ++-- src/EnergyPlus/Coils/CoilCoolingDX.hh | 10 +-- .../CoilCoolingDXCurveFitOperatingMode.cc | 29 +++--- .../CoilCoolingDXCurveFitOperatingMode.hh | 9 +- .../Coils/CoilCoolingDXCurveFitPerformance.cc | 38 +++----- .../Coils/CoilCoolingDXCurveFitPerformance.hh | 20 ++--- .../Coils/CoilCoolingDXCurveFitSpeed.cc | 2 +- .../Coils/CoilCoolingDXCurveFitSpeed.hh | 2 +- src/EnergyPlus/UnitarySystem.cc | 90 ++++++------------- ...CoilCoolingDXCurveFitOperatingMode.unit.cc | 1 - 10 files changed, 78 insertions(+), 139 deletions(-) diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.cc b/src/EnergyPlus/Coils/CoilCoolingDX.cc index adc30cf4964..3f1b528f4b7 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDX.cc @@ -665,13 +665,12 @@ void CoilCoolingDX::size(EnergyPlusData &state) } void CoilCoolingDX::simulate(EnergyPlusData &state, - int useAlternateMode, - Real64 PLR, - int speedNum, - Real64 speedRatio, + int const useAlternateMode, + int const speedNum, + Real64 const speedRatio, int const fanOpMode, bool const singleMode, - Real64 LoadSHR) + Real64 const LoadSHR) { if (this->myOneTimeInitFlag) { this->oneTimeInit(state); @@ -704,7 +703,6 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, evapInletNode, evapOutletNode, useAlternateMode, - PLR, speedNum, speedRatio, fanOpMode, @@ -788,7 +786,7 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, this->wasteHeatEnergyRate = this->performance.wasteHeatRate; this->wasteHeatEnergy = this->performance.wasteHeatRate * reportingConstant; - this->partLoadRatioReport = PLR; + this->partLoadRatioReport = speedNum == 1 ? 1.0 : speedRatio; this->speedNumReport = speedNum; this->speedRatioReport = speedRatio; @@ -855,10 +853,9 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, DataLoopNode::NodeData dummyEvapOutlet; DataLoopNode::NodeData dummyCondInlet; DataLoopNode::NodeData dummyCondOutlet; - Real64 dummyPLR = 1.0; int dummySpeedNum = 1; Real64 dummySpeedRatio = 1.0; - int dummyFanOpMode = 1.0; + int dummyFanOpMode = 1; bool dummySingleMode = false; Real64 constexpr RatedInletAirTemp(26.6667); // 26.6667C or 80F @@ -897,7 +894,6 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, dummyEvapInlet, dummyEvapOutlet, false, - dummyPLR, dummySpeedNum, dummySpeedRatio, dummyFanOpMode, diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.hh b/src/EnergyPlus/Coils/CoilCoolingDX.hh index c84a2438f60..dcd050aec58 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.hh +++ b/src/EnergyPlus/Coils/CoilCoolingDX.hh @@ -84,14 +84,8 @@ struct CoilCoolingDX static void reportAllStandardRatings(EnergyPlusData &state); void instantiateFromInputSpec(EnergyPlusData &state, const CoilCoolingDXInputSpecification &input_data); void oneTimeInit(EnergyPlusData &state); - void simulate(EnergyPlusData &state, - int useAlternateMode, - Real64 PLR, - int speedNum, - Real64 speedRatio, - int const fanOpMode, - bool const singleMode, - Real64 LoadSHR = -1.0); + void + simulate(EnergyPlusData &state, int useAlternateMode, int speedNum, Real64 speedRatio, int fanOpMode, bool singleMode, Real64 LoadSHR = -1.0); void setData(int fanIndex, int fanType, std::string const &fanName, int airLoopNum); void getFixedData(int &evapInletNodeIndex, int &evapOutletNodeIndex, diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc index b8b4ac5e59e..4511b34f0ef 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc @@ -278,9 +278,8 @@ void CoilCoolingDXCurveFitOperatingMode::size(EnergyPlus::EnergyPlusData &state) void CoilCoolingDXCurveFitOperatingMode::CalcOperatingMode(EnergyPlus::EnergyPlusData &state, const DataLoopNode::NodeData &inletNode, DataLoopNode::NodeData &outletNode, - Real64 &PLR, - int &speedNum, - Real64 &speedRatio, + int const speedNum, + Real64 const speedRatio, int const fanOpMode, DataLoopNode::NodeData &condInletNode, [[maybe_unused]] DataLoopNode::NodeData &condOutletNode, @@ -291,7 +290,7 @@ void CoilCoolingDXCurveFitOperatingMode::CalcOperatingMode(EnergyPlus::EnergyPlu // Currently speedNum is 1-based, while this->speeds are zero-based auto &thisspeed(this->speeds[max(speedNum - 1, 0)]); - if (((speedNum == 1) && (PLR == 0.0)) || (inletNode.MassFlowRate == 0.0)) { + if (((speedNum == 1) && (speedRatio == 0.0)) || (inletNode.MassFlowRate == 0.0)) { outletNode.Temp = inletNode.Temp; outletNode.HumRat = inletNode.HumRat; outletNode.Enthalpy = inletNode.Enthalpy; @@ -314,8 +313,8 @@ void CoilCoolingDXCurveFitOperatingMode::CalcOperatingMode(EnergyPlus::EnergyPlu thisspeed.ambPressure = condInletNode.Press; thisspeed.AirMassFlow = inletNode.MassFlowRate; if (fanOpMode == DataHVACGlobals::CycFanCycCoil && speedNum == 1) { - if (PLR > 0.0) { - thisspeed.AirMassFlow = thisspeed.AirMassFlow / PLR; + if (speedRatio > 0.0) { + thisspeed.AirMassFlow = thisspeed.AirMassFlow / speedRatio; } else { thisspeed.AirMassFlow = 0.0; } @@ -331,12 +330,12 @@ void CoilCoolingDXCurveFitOperatingMode::CalcOperatingMode(EnergyPlus::EnergyPlu } // If multispeed, evaluate high speed first using speedRatio as PLR - Real64 plr1 = PLR; - if (speedNum > 1) { - plr1 = speedRatio; - } + // Real64 plr1 = PLR; + // if (speedNum > 1) { + // plr1 = speedRatio; + //} - thisspeed.CalcSpeedOutput(state, inletNode, outletNode, plr1, fanOpMode, this->condInletTemp); + thisspeed.CalcSpeedOutput(state, inletNode, outletNode, speedRatio, fanOpMode, this->condInletTemp); // the outlet node conditions are based on it running at the truncated flow, we need to merge the bypassed air back in and ramp up flow rate if (thisspeed.adjustForFaceArea) { @@ -360,8 +359,8 @@ void CoilCoolingDXCurveFitOperatingMode::CalcOperatingMode(EnergyPlus::EnergyPlu Real64 outSpeed1Enthalpy = outletNode.Enthalpy; if (fanOpMode == DataHVACGlobals::ContFanCycCoil) { - outletNode.HumRat = outletNode.HumRat * plr1 + (1.0 - plr1) * inletNode.HumRat; - outletNode.Enthalpy = outletNode.Enthalpy * plr1 + (1.0 - plr1) * inletNode.Enthalpy; + outletNode.HumRat = outletNode.HumRat * speedRatio + (1.0 - speedRatio) * inletNode.HumRat; + outletNode.Enthalpy = outletNode.Enthalpy * speedRatio + (1.0 - speedRatio) * inletNode.Enthalpy; outletNode.Temp = Psychrometrics::PsyTdbFnHW(outletNode.Enthalpy, outletNode.HumRat); // Check for saturation error and modify temperature at constant enthalpy @@ -382,7 +381,7 @@ void CoilCoolingDXCurveFitOperatingMode::CalcOperatingMode(EnergyPlus::EnergyPlu auto &lowerspeed(this->speeds[max(speedNum - 2, 0)]); lowerspeed.AirMassFlow = state.dataHVACGlobal->MSHPMassFlowRateLow * lowerspeed.active_fraction_of_face_coil_area; - lowerspeed.CalcSpeedOutput(state, inletNode, outletNode, PLR, fanOpMode, condInletTemp); // out + lowerspeed.CalcSpeedOutput(state, inletNode, outletNode, 1.0f, fanOpMode, condInletTemp); // out if (lowerspeed.adjustForFaceArea) { lowerspeed.AirMassFlow /= lowerspeed.active_fraction_of_face_coil_area; @@ -406,8 +405,6 @@ void CoilCoolingDXCurveFitOperatingMode::CalcOperatingMode(EnergyPlus::EnergyPlu outletNode.Enthalpy = (outSpeed1Enthalpy * speedRatio * thisspeed.AirMassFlow + (1.0 - speedRatio) * outletNode.Enthalpy * lowerspeed.AirMassFlow) / inletNode.MassFlowRate; - // outletNode.HumRat = outSpeed1HumRat * speedRatio + (1.0 - speedRatio) * outletNode.HumRat; - // outletNode.Enthalpy = outSpeed1Enthalpy * speedRatio + (1.0 - speedRatio) * outletNode.Enthalpy; outletNode.Temp = Psychrometrics::PsyTdbFnHW(outletNode.Enthalpy, outletNode.HumRat); this->OpModePower += (1.0 - thisspeed.RTF) * lowerspeed.fullLoadPower; diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.hh b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.hh index fdf2daac4b9..93a6325a6cb 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.hh +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.hh @@ -92,13 +92,12 @@ struct CoilCoolingDXCurveFitOperatingMode void CalcOperatingMode(EnergyPlusData &state, const DataLoopNode::NodeData &inletNode, DataLoopNode::NodeData &outletNode, - Real64 &PLR, - int &speedNum, - Real64 &speedRatio, - int const fanOpMode, + int speedNum, + Real64 speedRatio, + int fanOpMode, DataLoopNode::NodeData &condInletNode, DataLoopNode::NodeData &condOutletNode, - bool const singleMode); + bool singleMode); std::string name; Real64 ratedGrossTotalCap = 0.0; // [W] diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc index e6883298d49..e9b2cd5e0da 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc @@ -205,10 +205,9 @@ CoilCoolingDXCurveFitPerformance::CoilCoolingDXCurveFitPerformance(EnergyPlus::E void CoilCoolingDXCurveFitPerformance::simulate(EnergyPlus::EnergyPlusData &state, const DataLoopNode::NodeData &inletNode, DataLoopNode::NodeData &outletNode, - int useAlternateMode, - Real64 &PLR, - int &speedNum, - Real64 &speedRatio, + int const useAlternateMode, + int const speedNum, + Real64 const speedRatio, int const fanOpMode, DataLoopNode::NodeData &condInletNode, DataLoopNode::NodeData &condOutletNode, @@ -234,8 +233,7 @@ void CoilCoolingDXCurveFitPerformance::simulate(EnergyPlus::EnergyPlusData &stat Real64 EnthalpyNorOut; Real64 modeRatio; - this->calculate( - state, this->normalMode, inletNode, outletNode, PLR, speedNum, speedRatio, fanOpMode, condInletNode, condOutletNode, singleMode); + this->calculate(state, this->normalMode, inletNode, outletNode, speedNum, speedRatio, fanOpMode, condInletNode, condOutletNode, singleMode); // this->OperatingMode = 1; CalcComponentSensibleLatentOutput( @@ -248,7 +246,7 @@ void CoilCoolingDXCurveFitPerformance::simulate(EnergyPlus::EnergyPlusData &stat this->wasteHeatRate = this->normalMode.OpModeWasteHeat; } - if ((PLR != 0.0) && (LoadSHR != 0.0)) { + if ((speedRatio != 0.0) && (LoadSHR != 0.0)) { if (totalCoolingRate == 0.0) { SysNorSHR = 1.0; } else { @@ -261,17 +259,8 @@ void CoilCoolingDXCurveFitPerformance::simulate(EnergyPlus::EnergyPlusData &stat if (LoadSHR < SysNorSHR) { outletNode.MassFlowRate = inletNode.MassFlowRate; - this->calculate(state, - this->alternateMode, - inletNode, - outletNode, - PLR, - speedNum, - speedRatio, - fanOpMode, - condInletNode, - condOutletNode, - singleMode); + this->calculate( + state, this->alternateMode, inletNode, outletNode, speedNum, speedRatio, fanOpMode, condInletNode, condOutletNode, singleMode); CalcComponentSensibleLatentOutput(outletNode.MassFlowRate, inletNode.Temp, inletNode.HumRat, @@ -287,7 +276,6 @@ void CoilCoolingDXCurveFitPerformance::simulate(EnergyPlus::EnergyPlusData &stat this->alternateMode2, inletNode, outletNode, - PLR, speedNum, speedRatio, fanOpMode, @@ -348,14 +336,13 @@ void CoilCoolingDXCurveFitPerformance::simulate(EnergyPlus::EnergyPlusData &stat } } else if (useAlternateMode == DataHVACGlobals::coilEnhancedMode) { this->calculate( - state, this->alternateMode, inletNode, outletNode, PLR, speedNum, speedRatio, fanOpMode, condInletNode, condOutletNode, singleMode); + state, this->alternateMode, inletNode, outletNode, speedNum, speedRatio, fanOpMode, condInletNode, condOutletNode, singleMode); this->OperatingMode = 2; this->powerUse = this->alternateMode.OpModePower; this->RTF = this->alternateMode.OpModeRTF; this->wasteHeatRate = this->alternateMode.OpModeWasteHeat; } else { - this->calculate( - state, this->normalMode, inletNode, outletNode, PLR, speedNum, speedRatio, fanOpMode, condInletNode, condOutletNode, singleMode); + this->calculate(state, this->normalMode, inletNode, outletNode, speedNum, speedRatio, fanOpMode, condInletNode, condOutletNode, singleMode); this->OperatingMode = 1; this->powerUse = this->normalMode.OpModePower; this->RTF = this->normalMode.OpModeRTF; @@ -419,9 +406,8 @@ void CoilCoolingDXCurveFitPerformance::calculate(EnergyPlus::EnergyPlusData &sta CoilCoolingDXCurveFitOperatingMode ¤tMode, const DataLoopNode::NodeData &inletNode, DataLoopNode::NodeData &outletNode, - Real64 &PLR, - int &speedNum, - Real64 &speedRatio, + int const speedNum, + Real64 const speedRatio, int const fanOpMode, DataLoopNode::NodeData &condInletNode, DataLoopNode::NodeData &condOutletNode, @@ -429,7 +415,7 @@ void CoilCoolingDXCurveFitPerformance::calculate(EnergyPlus::EnergyPlusData &sta { // calculate the performance at this mode/speed - currentMode.CalcOperatingMode(state, inletNode, outletNode, PLR, speedNum, speedRatio, fanOpMode, condInletNode, condOutletNode, singleMode); + currentMode.CalcOperatingMode(state, inletNode, outletNode, speedNum, speedRatio, fanOpMode, condInletNode, condOutletNode, singleMode); } void CoilCoolingDXCurveFitPerformance::calcStandardRatings210240(EnergyPlus::EnergyPlusData &state) diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.hh b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.hh index b705945991d..8d4698d975f 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.hh +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.hh @@ -89,27 +89,27 @@ struct CoilCoolingDXCurveFitPerformance const DataLoopNode::NodeData &inletNode, DataLoopNode::NodeData &outletNode, int useAlternateMode, - Real64 &PLR, - int &speedNum, - Real64 &speedRatio, - int const fanOpMode, + int speedNum, + Real64 speedRatio, + int fanOpMode, DataLoopNode::NodeData &condInletNode, DataLoopNode::NodeData &condOutletNode, - bool const singleMode, + bool singleMode, Real64 LoadSHR = 0.0); void calculate(EnergyPlusData &state, CoilCoolingDXCurveFitOperatingMode ¤tMode, const DataLoopNode::NodeData &inletNode, DataLoopNode::NodeData &outletNode, - Real64 &PLR, - int &speedNum, - Real64 &speedRatio, - int const fanOpMode, + int speedNum, + Real64 speedRatio, + int fanOpMode, DataLoopNode::NodeData &condInletNode, DataLoopNode::NodeData &condOutletNode, - bool const singleMode); + bool singleMode); + void calcStandardRatings210240(EnergyPlusData &state); + CoilCoolingDXCurveFitPerformanceInputSpecification original_input_specs; CoilCoolingDXCurveFitPerformance() = default; explicit CoilCoolingDXCurveFitPerformance(EnergyPlusData &state, const std::string &name); diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc index 6b1c4ca1f40..4184ce738dc 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc @@ -427,7 +427,7 @@ void CoilCoolingDXCurveFitSpeed::size(EnergyPlus::EnergyPlusData &state) void CoilCoolingDXCurveFitSpeed::CalcSpeedOutput(EnergyPlus::EnergyPlusData &state, const DataLoopNode::NodeData &inletNode, DataLoopNode::NodeData &outletNode, - Real64 &_PLR, + Real64 const _PLR, int const fanOpMode, const Real64 condInletTemp) { diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh index a6c2bcc3d69..135817d3f26 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh @@ -163,7 +163,7 @@ struct CoilCoolingDXCurveFitSpeed void CalcSpeedOutput(EnergyPlusData &state, const DataLoopNode::NodeData &inletNode, DataLoopNode::NodeData &outletNode, - Real64 &PLR, + Real64 PLR, int const fanOpMode, Real64 condInletTemp); void size(EnergyPlusData &state); diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 478ec26311f..a9f71a2f4fc 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -3145,7 +3145,7 @@ namespace UnitarySystems { this->m_HeatingCoilIndex, this->m_HeatingCoilSensDemand, dummy, - 0.0, + 0, DataHVACGlobals::CompressorOperation::Off, 0.0, FirstHVACIteration); @@ -3162,7 +3162,7 @@ namespace UnitarySystems { this->m_CoolingCoilIndex, this->m_CoolingCoilSensDemand, this->m_CoolingCoilLatentDemand, - 0.0, + 0, DataHVACGlobals::CompressorOperation::Off, 0.0, FirstHVACIteration); @@ -11467,7 +11467,7 @@ namespace UnitarySystems { PartLoadFrac = 1.0; CycRatio = 1.0; SpeedRatio = 1.0; - int SolFla = 0.0; + int SolFla = 0; // SUBROUTINE PARAMETER DEFINITIONS: int constexpr MaxIte(500); // Maximum number of iterations for solver @@ -11693,7 +11693,7 @@ namespace UnitarySystems { } state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( - state, OperationMode, CoilPLR, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode, this->CoilSHR); + state, OperationMode, this->m_CoolingSpeedNum, CoilPLR, this->m_FanOpMode, singleMode, this->CoilSHR); if (this->m_CoolingSpeedNum > 1) { if (this->m_SingleMode == 0) { @@ -12483,7 +12483,7 @@ namespace UnitarySystems { } bool const singleMode = (this->m_SingleMode == 1); state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( - state, OperationMode, PartLoadFrac, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode); + state, OperationMode, this->m_CoolingSpeedNum, PartLoadFrac, this->m_FanOpMode, singleMode); } } else if (CoilType_Num == DataHVACGlobals::CoilDX_CoolingSingleSpeed) { // COIL:DX:COOLINGBYPASSFACTOREMPIRICAL @@ -12564,8 +12564,9 @@ namespace UnitarySystems { OperationMode = DataHVACGlobals::coilEnhancedMode; } bool const singleMode = (this->m_SingleMode == 1); + // PartLoadFrac has not been set in this branch - so use m_CoolingSpeedRatio? state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( - state, OperationMode, PartLoadFrac, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode); + state, OperationMode, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode); this->m_CoolCompPartLoadRatio = PartLoadFrac; } else if ((CoilType_Num == DataHVACGlobals::Coil_CoolingWater) || (CoilType_Num == DataHVACGlobals::Coil_CoolingWaterDetailed)) { // COIL:COOLING:WATER @@ -12782,13 +12783,8 @@ namespace UnitarySystems { bool const singleMode = (this->m_SingleMode == 1); for (int speedNum = 1; speedNum <= this->m_NumOfSpeedCooling; speedNum++) { this->m_CoolingSpeedNum = speedNum; - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate(state, - OperationMode, - PartLoadFrac, - this->m_CoolingSpeedNum, - this->m_CoolingSpeedRatio, - this->m_FanOpMode, - singleMode); + state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( + state, OperationMode, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode); if (speedNum == this->m_NumOfSpeedCooling) { FullLoadHumRatOut = state.dataLoopNodes->Node(OutletNode).HumRat; } @@ -13072,8 +13068,8 @@ namespace UnitarySystems { int par3 = this->m_UnitarySysNum; // 4-7 are not used for TwoSpeed coils, so these shouldn't matter at all Real64 par4_CycRatio = 0.0; - int par5_SpeedNum = 0.0; - int par6_FanOpMode = 0.0; + int par5_SpeedNum = 0; + int par6_FanOpMode = 0; DataHVACGlobals::CompressorOperation par7_CompressorOp = DataHVACGlobals::CompressorOperation::On; return UnitarySys::DXCoilVarSpeedResidual( state, SpeedRatio, par1, par2, par3, par4_CycRatio, par5_SpeedNum, par6_FanOpMode, par7_CompressorOp); @@ -13084,8 +13080,8 @@ namespace UnitarySystems { auto f = [&state, this, DesOutTemp, AirLoopNum, FirstHVACIteration](Real64 const CycRatio) { // several pars are not used in two speed coils, so these are just dummy values Real64 par4_SpeedRatio = 0.0; - int par5_SpeedNum = 0.0; - int par6_FanOpMode = 0.0; + int par5_SpeedNum = 0; + int par6_FanOpMode = 0; DataHVACGlobals::CompressorOperation par7_CompressorOp = DataHVACGlobals::CompressorOperation::On; return UnitarySys::DXCoilCyclingResidual(state, CycRatio, @@ -13112,7 +13108,7 @@ namespace UnitarySystems { int par3 = this->m_UnitarySysNum; Real64 par4_CycRatio = CycRatio; int par5_SpeedNum = this->m_CoolingSpeedNum; - int par6_FanOpMode = 1.0; + int par6_FanOpMode = 1; DataHVACGlobals::CompressorOperation par7_CompressorOp = DataHVACGlobals::CompressorOperation::On; return UnitarySys::DXCoilVarSpeedResidual( state, SpeedRatio, par1, par2, par3, par4_CycRatio, par5_SpeedNum, par6_FanOpMode, par7_CompressorOp); @@ -13130,7 +13126,7 @@ namespace UnitarySystems { this->m_UnitarySysNum, SpeedRatio, this->m_CoolingSpeedNum, - 1.0, + 1, DataHVACGlobals::CompressorOperation::On, AirLoopNum, FirstHVACIteration); @@ -13202,19 +13198,11 @@ namespace UnitarySystems { this->m_CompPartLoadRatio = PartLoadFrac; } else if (CoilType_Num == DataHVACGlobals::CoilDX_Cooling) { // CoilCoolingDX auto f = [&state, this, DesOutTemp, DehumidMode, FanOpMode](Real64 const PartLoadRatio) { - int CoilIndex = this->m_CoolingCoilIndex; - int CoolingSpeedNum = this->m_CoolingSpeedNum; - Real64 CoolingSpeedRatio = this->m_CoolingSpeedRatio; bool const singleMode = this->m_SingleMode; - if (CoolingSpeedNum == 1) { - state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate( - state, DehumidMode, PartLoadRatio, CoolingSpeedNum, CoolingSpeedRatio, FanOpMode, singleMode); - } else { - state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate( - state, DehumidMode, CoolingSpeedRatio, CoolingSpeedNum, PartLoadRatio, FanOpMode, singleMode); - } + state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( + state, DehumidMode, this->m_CoolingSpeedNum, PartLoadRatio, FanOpMode, singleMode); Real64 outletCondition = - state.dataLoopNodes->Node(state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].evapOutletNodeIndex).Temp; + state.dataLoopNodes->Node(state.dataCoilCooingDX->coilCoolingDXs[m_CoolingCoilIndex].evapOutletNodeIndex).Temp; return DesOutTemp - outletCondition; }; @@ -13443,7 +13431,7 @@ namespace UnitarySystems { for (int speedNum = this->m_CoolingSpeedNum; speedNum <= this->m_NumOfSpeedCooling; speedNum++) { this->m_CoolingSpeedNum = speedNum; state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( - state, OperationMode, PartLoadFrac, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode); + state, OperationMode, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode); // Cooling: break if outlet temp is lower than DesOutTemp or approaches DesOutTemp to within Acc from above if ((state.dataLoopNodes->Node(OutletNode).Temp - DesOutTemp) < Acc) break; } @@ -13453,20 +13441,12 @@ namespace UnitarySystems { if ((DesOutTemp - state.dataLoopNodes->Node(OutletNode).Temp) > Acc) { auto f = [&state, this, DesOutTemp, FanOpMode](Real64 const PartLoadFrac) { - int CoilIndex = this->m_CoolingCoilIndex; bool useDehumMode = true; - int CoolingSpeedNum = this->m_CoolingSpeedNum; - Real64 CoolingSpeedRatio = 1.0; bool const singleMode = false; - if (CoolingSpeedNum == 1) { - state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate( - state, useDehumMode, PartLoadFrac, CoolingSpeedNum, CoolingSpeedRatio, FanOpMode, singleMode); - } else { - state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate( - state, useDehumMode, CoolingSpeedRatio, CoolingSpeedNum, PartLoadFrac, FanOpMode, singleMode); - } + state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( + state, useDehumMode, this->m_CoolingSpeedNum, PartLoadFrac, FanOpMode, singleMode); Real64 outletCondition = - state.dataLoopNodes->Node(state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].evapOutletNodeIndex).Temp; + state.dataLoopNodes->Node(state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].evapOutletNodeIndex).Temp; return DesOutTemp - outletCondition; }; @@ -13888,13 +13868,8 @@ namespace UnitarySystems { PartLoadFrac = 1.0; for (int speedNum = this->m_CoolingSpeedNum; speedNum <= this->m_NumOfSpeedCooling; speedNum++) { this->m_CoolingSpeedNum = speedNum; - state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate(state, - OperationMode, - PartLoadFrac, - this->m_CoolingSpeedNum, - this->m_CoolingSpeedRatio, - this->m_FanOpMode, - singleMode); + state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( + state, OperationMode, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode); // Cooling: break if outlet humrat is lower than DesOutHumRat or approaches DesOutHumRat to within HumRatAcc from above if ((state.dataLoopNodes->Node(OutletNode).HumRat - DesOutHumRat) < HumRatAcc) break; } @@ -13907,20 +13882,13 @@ namespace UnitarySystems { DesOutHumRat, // 1 FanOpMode // 3 ](Real64 const PartLoadFrac) { - int CoilIndex = this->m_CoolingCoilIndex; bool useDehumMode = false; - int CoolingSpeedNum = this->m_CoolingSpeedNum; - Real64 CoolingSpeedRatio = 1.0; bool const singleMode = false; - if (CoolingSpeedNum == 1) { - state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate( - state, useDehumMode, PartLoadFrac, CoolingSpeedNum, CoolingSpeedRatio, FanOpMode, singleMode); - } else { - state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].simulate( - state, useDehumMode, CoolingSpeedRatio, CoolingSpeedNum, PartLoadFrac, FanOpMode, singleMode); - } + state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( + state, useDehumMode, this->m_CoolingSpeedNum, PartLoadFrac, FanOpMode, singleMode); Real64 outletCondition = - state.dataLoopNodes->Node(state.dataCoilCooingDX->coilCoolingDXs[CoilIndex].evapOutletNodeIndex).HumRat; + state.dataLoopNodes->Node(state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].evapOutletNodeIndex) + .HumRat; return DesOutHumRat - outletCondition; }; @@ -15346,7 +15314,7 @@ namespace UnitarySystems { } state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( - state, OperationMode, CycRatio, this->m_CoolingSpeedNum, SpeedRatio, this->m_FanOpMode, singleMode, this->CoilSHR); + state, OperationMode, this->m_CoolingSpeedNum, PartLoadFrac, this->m_FanOpMode, singleMode, this->CoilSHR); } else if (CoilTypeNum == DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed) { diff --git a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc index d16c8d23f98..34ab8d64c57 100644 --- a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc +++ b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc @@ -283,7 +283,6 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXCurveFitCrankcaseHeaterCurve) evapInletNode, evapOutletNode, useAlternateMode, - PLR, speedNum, speedRatio, fanOpMode, From 64088c63ebe96190e4588d703b1b0539a9c173bd Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Tue, 16 Jan 2024 07:47:26 -0700 Subject: [PATCH 02/21] Fix clang-format. --- src/EnergyPlus/Coils/CoilCoolingDX.cc | 13 ++----------- .../Coils/CoilCoolingDXCurveFitOperatingMode.cc | 3 ++- .../CoilCoolingDXCurveFitOperatingMode.unit.cc | 13 ++----------- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.cc b/src/EnergyPlus/Coils/CoilCoolingDX.cc index 3f1b528f4b7..7f7daafb556 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDX.cc @@ -699,17 +699,8 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, // TODO: check the minOATcompressor and reset data/pass through data as needed this->performance.OperatingMode = 0; this->performance.ModeRatio = 0.0; - this->performance.simulate(state, - evapInletNode, - evapOutletNode, - useAlternateMode, - speedNum, - speedRatio, - fanOpMode, - condInletNode, - condOutletNode, - singleMode, - LoadSHR); + this->performance.simulate( + state, evapInletNode, evapOutletNode, useAlternateMode, speedNum, speedRatio, fanOpMode, condInletNode, condOutletNode, singleMode, LoadSHR); CoilCoolingDX::passThroughNodeData(evapInletNode, evapOutletNode); // calculate energy conversion factor diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc index 4511b34f0ef..c431a0d1b16 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc @@ -381,7 +381,8 @@ void CoilCoolingDXCurveFitOperatingMode::CalcOperatingMode(EnergyPlus::EnergyPlu auto &lowerspeed(this->speeds[max(speedNum - 2, 0)]); lowerspeed.AirMassFlow = state.dataHVACGlobal->MSHPMassFlowRateLow * lowerspeed.active_fraction_of_face_coil_area; - lowerspeed.CalcSpeedOutput(state, inletNode, outletNode, 1.0f, fanOpMode, condInletTemp); // out + // Use 0, 1, or speedRatio? + lowerspeed.CalcSpeedOutput(state, inletNode, outletNode, speedRatio, fanOpMode, condInletTemp); // out if (lowerspeed.adjustForFaceArea) { lowerspeed.AirMassFlow /= lowerspeed.active_fraction_of_face_coil_area; diff --git a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc index 34ab8d64c57..fc0557f1379 100644 --- a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc +++ b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc @@ -279,16 +279,7 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXCurveFitCrankcaseHeaterCurve) auto &condInletNode = state->dataLoopNodes->Node(thisCoil.condInletNodeIndex); auto &condOutletNode = state->dataLoopNodes->Node(thisCoil.condOutletNodeIndex); Real64 LoadSHR = 0.0; - thisCoil.performance.simulate(*state, - evapInletNode, - evapOutletNode, - useAlternateMode, - speedNum, - speedRatio, - fanOpMode, - condInletNode, - condOutletNode, - singleMode, - LoadSHR); + thisCoil.performance.simulate( + *state, evapInletNode, evapOutletNode, useAlternateMode, speedNum, speedRatio, fanOpMode, condInletNode, condOutletNode, singleMode, LoadSHR); EXPECT_EQ(thisCoil.performance.crankcaseHeaterPower, 120.0); } From ad6d7b6d4582a2d8080885471115b3352b10d371 Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Mon, 29 Jan 2024 07:21:17 -0700 Subject: [PATCH 03/21] Remove extra function parameter in tests. --- .../Coils/CoilCoolingDXCurveFitOperatingMode.cc | 3 +-- tst/EnergyPlus/unit/Coils/CoilCoolingDX.unit.cc | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc index c431a0d1b16..c05f27047e1 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc @@ -381,8 +381,7 @@ void CoilCoolingDXCurveFitOperatingMode::CalcOperatingMode(EnergyPlus::EnergyPlu auto &lowerspeed(this->speeds[max(speedNum - 2, 0)]); lowerspeed.AirMassFlow = state.dataHVACGlobal->MSHPMassFlowRateLow * lowerspeed.active_fraction_of_face_coil_area; - // Use 0, 1, or speedRatio? - lowerspeed.CalcSpeedOutput(state, inletNode, outletNode, speedRatio, fanOpMode, condInletTemp); // out + lowerspeed.CalcSpeedOutput(state, inletNode, outletNode, 1.0, fanOpMode, condInletTemp); // out if (lowerspeed.adjustForFaceArea) { lowerspeed.AirMassFlow /= lowerspeed.active_fraction_of_face_coil_area; diff --git a/tst/EnergyPlus/unit/Coils/CoilCoolingDX.unit.cc b/tst/EnergyPlus/unit/Coils/CoilCoolingDX.unit.cc index 96871d18c8a..3af57b42f67 100644 --- a/tst/EnergyPlus/unit/Coils/CoilCoolingDX.unit.cc +++ b/tst/EnergyPlus/unit/Coils/CoilCoolingDX.unit.cc @@ -176,7 +176,7 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXAlternateModePerformance) Real64 speedRatio = 1.0; int fanOpMode = 1; bool singleMode = false; - thisCoil.simulate(*state, useAlternateMode, PLR, speedNum, speedRatio, fanOpMode, singleMode); + thisCoil.simulate(*state, useAlternateMode, speedNum, speedRatio, fanOpMode, singleMode); // std::cout << thisCoil.totalCoolingEnergyRate << ',' << evapOutletNode.Temp << ',' << evapOutletNode.HumRat << std::endl; EXPECT_NEAR(2500, thisCoil.totalCoolingEnergyRate, 0.1); // expect the coil to run full out, at speed 1 EXPECT_NEAR(19.485, evapOutletNode.Temp, 0.01); @@ -185,7 +185,7 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXAlternateModePerformance) // alter values and run at rated conditions normal mode speed 2 evapInletNode.MassFlowRate = thisCoil.performance.normalMode.speeds.back().RatedAirMassFlowRate; speedNum = 2; - thisCoil.simulate(*state, useAlternateMode, PLR, speedNum, speedRatio, fanOpMode, singleMode); + thisCoil.simulate(*state, useAlternateMode, speedNum, speedRatio, fanOpMode, singleMode); // std::cout << thisCoil.totalCoolingEnergyRate << ',' << evapOutletNode.Temp << ',' << evapOutletNode.HumRat << std::endl; EXPECT_NEAR(5000, thisCoil.totalCoolingEnergyRate, 0.01); // expect the coil to run full out, at speed 1 // EXPECT_NEAR(17.896, evapOutletNode.Temp, 0.01); @@ -195,7 +195,7 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXAlternateModePerformance) // ok so now run at alternate mode, speed 1 useAlternateMode = DataHVACGlobals::coilEnhancedMode; speedNum = 1; - thisCoil.simulate(*state, useAlternateMode, PLR, speedNum, speedRatio, fanOpMode, singleMode); + thisCoil.simulate(*state, useAlternateMode, speedNum, speedRatio, fanOpMode, singleMode); // std::cout << thisCoil.totalCoolingEnergyRate << ',' << evapOutletNode.Temp << ',' << evapOutletNode.HumRat << std::endl; EXPECT_NEAR(2250, thisCoil.totalCoolingEnergyRate, 0.01); // expect the coil to run full out, at speed 1 // EXPECT_NEAR(24.45, evapOutletNode.Temp, 0.01); @@ -205,7 +205,7 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXAlternateModePerformance) // ok so now run at alternate mode, speed 2 useAlternateMode = DataHVACGlobals::coilEnhancedMode; speedNum = 2; - thisCoil.simulate(*state, useAlternateMode, PLR, speedNum, speedRatio, fanOpMode, singleMode); + thisCoil.simulate(*state, useAlternateMode, speedNum, speedRatio, fanOpMode, singleMode); // std::cout << thisCoil.totalCoolingEnergyRate << ',' << evapOutletNode.Temp << ',' << evapOutletNode.HumRat << std::endl; EXPECT_NEAR(4500, thisCoil.totalCoolingEnergyRate, 0.01); // expect the coil to run full out, at speed 1 // EXPECT_NEAR(20.39, evapOutletNode.Temp, 0.01); From 45ddc48df554a0efde1cdf979139f5b0d0cd526c Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Mon, 29 Jan 2024 07:39:43 -0700 Subject: [PATCH 04/21] Revert CoilPLR to m_CoolingSpeedRatio. --- src/EnergyPlus/UnitarySystem.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index a9f71a2f4fc..3cd520dfa3c 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -11693,7 +11693,7 @@ namespace UnitarySystems { } state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( - state, OperationMode, this->m_CoolingSpeedNum, CoilPLR, this->m_FanOpMode, singleMode, this->CoilSHR); + state, OperationMode, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode, this->CoilSHR); if (this->m_CoolingSpeedNum > 1) { if (this->m_SingleMode == 0) { From e2fade201c59ef81027563c55920c3c5e0c139d8 Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Wed, 31 Jan 2024 09:05:13 -0700 Subject: [PATCH 05/21] Pass locally-calculated CoilPLR to CoilDX simulate inside calcUnitaryCoolingSystem. --- src/EnergyPlus/UnitarySystem.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 3cd520dfa3c..a9f71a2f4fc 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -11693,7 +11693,7 @@ namespace UnitarySystems { } state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( - state, OperationMode, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode, this->CoilSHR); + state, OperationMode, this->m_CoolingSpeedNum, CoilPLR, this->m_FanOpMode, singleMode, this->CoilSHR); if (this->m_CoolingSpeedNum > 1) { if (this->m_SingleMode == 0) { From 4b62938f9cd29266c8a0fee8ee9e212161275ffa Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Fri, 9 Feb 2024 10:25:30 -0700 Subject: [PATCH 06/21] Modify input CoilPLR calculation prior to DXCoil simulate() call. --- src/EnergyPlus/UnitarySystem.cc | 19 +- tst/EnergyPlus/unit/UnitarySystem.unit.cc | 252 ++++++++++++++++++++++ 2 files changed, 260 insertions(+), 11 deletions(-) diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index a9f71a2f4fc..f4905ed3d97 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -11669,19 +11669,16 @@ namespace UnitarySystems { if (this->m_EMSOverrideCoilSpeedNumOn) { CoilPLR = this->m_CoolingSpeedRatio; } else { - if (state.dataUnitarySystems->CoolingLoad) { - if (this->m_CoolingSpeedNum > 1) { - if (!singleMode) { - CoilPLR = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? 1.0 : 0.0; - this->m_CoolingSpeedRatio = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? PartLoadRatio : 0.0; - } else { - CoilPLR = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? PartLoadRatio : 0.0; - } + if (CompressorOn == DataHVACGlobals::CompressorOperation::Off) { + this->m_CoolingSpeedNum = 1; // Bypass mixed-speed calculations in called functions + CoilPLR = 0.0; + } else { + if (singleMode) { + CoilPLR = (m_CoolingSpeedNum == 1) ? PartLoadRatio + : 0.0; // singleMode allows cycling, but not part load operation at higher speeds } else { - CoilPLR = (CompressorOn == DataHVACGlobals::CompressorOperation::On) ? PartLoadRatio : 0.0; + CoilPLR = PartLoadRatio; } - } else { - CoilPLR = 0.0; } } } diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index 9e1cf689458..cb855ce8ec5 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -23844,3 +23844,255 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedFanWSHP_Test) EXPECT_EQ(thisSys1.m_SpeedNum, 2); EXPECT_NEAR(sensOut, 500.0, 2); } + +TEST_F(ZoneUnitarySysTest, CoilSystemDXCoil_CalcTest) +{ + std::string_view constexpr idf_objects = R"IDF( + + AirLoopHVAC:UnitarySystem, + Sys 1 Furnace DX Cool Unitary System, !- Name + Load, !- Control Type + SPACE1-1, !- Controlling Zone or Thermostat Location + None, !- Dehumidification Control Type + , !- Availability Schedule Name + Sys 1 Furnace DX Cool Mixed Air Outlet, !- Air Inlet Node Name + Sys 1 Furnace DX Cool Heating Coil Outlet, !- Air Outlet Node Name + , !- Supply Fan Object Type + , !- Supply Fan Name + , !- Fan Placement + , !- Supply Air Fan Operating Mode Schedule Name + , !- Heating Coil Object Type + , !- Heating Coil Name + , !- DX Heating Coil Sizing Ratio + Coil:Cooling:DX, !- Cooling Coil Object Type + Sys 1 Furnace DX Cool Cooling Coil, !- Cooling Coil Name + , !- Use DOAS DX Cooling Coil + , !- Minimum Supply Air Temperature {C} + , !- Latent Load Control + , !- Supplemental Heating Coil Object Type + , !- Supplemental Heating Coil Name + SupplyAirFlowRate, !- Cooling Supply Air Flow Rate Method + autosize, !- Cooling Supply Air Flow Rate {m3/s} + , !- Cooling Supply Air Flow Rate Per Floor Area {m3/s-m2} + , !- Cooling Fraction of Autosized Cooling Supply Air Flow Rate + , !- Cooling Supply Air Flow Rate Per Unit of Capacity {m3/s-W} + SupplyAirFlowRate, !- Heating Supply Air Flow Rate Method + autosize, !- Heating Supply Air Flow Rate {m3/s} + , !- Heating Supply Air Flow Rate Per Floor Area {m3/s-m2} + , !- Heating Fraction of Autosized Heating Supply Air Flow Rate + , !- Heating Supply Air Flow Rate Per Unit of Capacity {m3/s-W} + SupplyAirFlowRate, !- No Load Supply Air Flow Rate Method + autosize, !- No Load Supply Air Flow Rate {m3/s} + , !- No Load Supply Air Flow Rate Per Floor Area {m3/s-m2} + , !- No Load Fraction of Autosized Cooling Supply Air Flow Rate + , !- No Load Fraction of Autosized Heating Supply Air Flow Rate + , !- No Load Supply Air Flow Rate Per Unit of Capacity During Cooling Operation {m3/s-W} + , !- No Load Supply Air Flow Rate Per Unit of Capacity During Heating Operation {m3/s-W} + Autosize, !- Maximum Supply Air Temperature {C} + 21, !- Maximum Outdoor Dry-Bulb Temperature for Supplemental Heater Operation {C} + , !- Outdoor Dry-Bulb Temperature Sensor Node Name + , !- Ancillary On-Cycle Electric Power {W} + , !- Ancillary Off-Cycle Electric Power {W} + , !- Design Heat Recovery Water Flow Rate {m3/s} + , !- Maximum Temperature for Heat Recovery {C} + , !- Heat Recovery Water Inlet Node Name + , !- Heat Recovery Water Outlet Node Name + UnitarySystemPerformance:Multispeed, !- Design Specification Multispeed Object Type + Sys 1 Furnace DX Cool Unitary System MultiSpeed Performance; !- Design Specification Multispeed Object Name + Coil:Cooling:DX, + Sys 1 Furnace DX Cool Cooling Coil, !- Name + Sys 1 Furnace DX Cool Supply Fan Outlet, !- Evaporator Inlet Node Name + Sys 1 Furnace DX Cool Cooling Coil Outlet, !- Evaporator Outlet Node Name + , !- Availability Schedule Name + , !- Condenser Zone Name + Sys 1 Furnace DX Cool Cooling Coil Condenser Inlet, !- Condenser Inlet Node Name + Sys 1 Furnace DX Cool Cooling Coil Condenser Outlet Node, !- Condenser Outlet Node Name + Sys 1 Furnace DX Cool Cooling Coil Performance; !- Performance Object Name + + Coil:Cooling:DX:CurveFit:Performance, + Sys 1 Furnace DX Cool Cooling Coil Performance, !- Name + 0.0, !- Crankcase Heater Capacity {W} + , !- Crankcase Heater Capacity Function of Temperature Curve Name + , !- Minimum Outdoor Dry-Bulb Temperature for Compressor Operation {C} + 10.0, !- Maximum Outdoor Dry-Bulb Temperature for Crankcase Heater Operation {C} + , !- Unit Internal Static Air Pressure {Pa} + Discrete, !- Capacity Control Method + , !- Evaporative Condenser Basin Heater Capacity {W/K} + , !- Evaporative Condenser Basin Heater Setpoint Temperature {C} + , !- Evaporative Condenser Basin Heater Operating Schedule Name + Electricity, !- Compressor Fuel Type + Sys 1 Furnace DX Cool Cooling Coil Operating Mode; !- Base Operating Mode + + Coil:Cooling:DX:CurveFit:OperatingMode, + Sys 1 Furnace DX Cool Cooling Coil Operating Mode, !- Name + autosize, !- Rated Gross Total Cooling Capacity {W} + autosize, !- Rated Evaporator Air Flow Rate {m3/s} + , !- Rated Condenser Air Flow Rate {m3/s} + 0, !- Maximum Cycling Rate {cycles/hr} + 0, !- Ratio of Initial Moisture Evaporation Rate and Steady State Latent Capacity {dimensionless} + 0, !- Latent Capacity Time Constant {s} + 0, !- Nominal Time for Condensate Removal to Begin {s} + No, !- Apply Latent Degradation to Speeds Greater than 1 + AirCooled, !- Condenser Type + , !- Nominal Evaporative Condenser Pump Power {W} + 2, !- Nominal Speed Number + Sys 1 Furnace DX Cool Cooling Coil Speed 1 Performance, !- Speed 1 Name + Sys 1 Furnace DX Cool Cooling Coil Speed 2 Performance; !- Speed 2 Name + + Coil:Cooling:DX:CurveFit:Speed, + Sys 1 Furnace DX Cool Cooling Coil Speed 1 Performance, !- Name + 0.5000, !- Gross Total Cooling Capacity Fraction + 0.5000, !- Evaporator Air Flow Rate Fraction + , !- Condenser Air Flow Rate Fraction + autosize, !- Gross Sensible Heat Ratio + 3, !- Gross Cooling COP {W/W} + 1.0, !- Active Fraction of Coil Face Area + , !- 2017 Rated Evaporator Fan Power Per Volume Flow Rate {W/(m3/s)} + 934.4, !- 2023 Rated Evaporator Fan Power Per Volume Flow Rate {W/(m3/s)} + , !- Evaporative Condenser Pump Power Fraction + , !- Evaporative Condenser Effectiveness {dimensionless} + Sys 1 Furnace DX Cool Cool Coil Cap-FT, !- Total Cooling Capacity Modifier Function of Temperature Curve Name + Sys 1 Furnace DX Cool Cool Coil Cap-FF, !- Total Cooling Capacity Modifier Function of Air Flow Fraction Curve Name + Sys 1 Furnace DX Cool Cool Coil EIR-FT, !- Energy Input Ratio Modifier Function of Temperature Curve Name + Sys 1 Furnace DX Cool Cool Coil EIR-FF, !- Energy Input Ratio Modifier Function of Air Flow Fraction Curve Name + Sys 1 Furnace DX Cool Cool Coil PLF, !- Part Load Fraction Correlation Curve Name + 0.2, !- Rated Waste Heat Fraction of Power Input {dimensionless} + Sys 1 Furnace DX Cool Cool Coil WH-FT; !- Waste Heat Modifier Function of Temperature Curve Name + + Coil:Cooling:DX:CurveFit:Speed, + Sys 1 Furnace DX Cool Cooling Coil Speed 2 Performance, !- Name + 1.0000, !- Gross Total Cooling Capacity Fraction + 1.0000, !- Evaporator Air Flow Rate Fraction + , !- Condenser Air Flow Rate Fraction + autosize, !- Gross Sensible Heat Ratio + 3, !- Gross Cooling COP {W/W} + 1.0, !- Active Fraction of Coil Face Area + , !- 2017 Rated Evaporator Fan Power Per Volume Flow Rate {W/(m3/s)} + 934.4, !- 2023 Rated Evaporator Fan Power Per Volume Flow Rate {W/(m3/s)} + , !- Evaporative Condenser Pump Power Fraction + , !- Evaporative Condenser Effectiveness {dimensionless} + Sys 1 Furnace DX Cool Cool Coil Cap-FT, !- Total Cooling Capacity Modifier Function of Temperature Curve Name + Sys 1 Furnace DX Cool Cool Coil Cap-FF, !- Total Cooling Capacity Modifier Function of Air Flow Fraction Curve Name + Sys 1 Furnace DX Cool Cool Coil EIR-FT, !- Energy Input Ratio Modifier Function of Temperature Curve Name + Sys 1 Furnace DX Cool Cool Coil EIR-FF, !- Energy Input Ratio Modifier Function of Air Flow Fraction Curve Name + Sys 1 Furnace DX Cool Cool Coil PLF, !- Part Load Fraction Correlation Curve Name + 0.2, !- Rated Waste Heat Fraction of Power Input {dimensionless} + Sys 1 Furnace DX Cool Cool Coil WH-FT; !- Waste Heat Modifier Function of Temperature Curve Name + +! Curves from example file MultiSpeedHeatPump.idf, Sep 2013, same curves for all speeds. + + Curve:Biquadratic, + Sys 1 Furnace DX Cool Cool Coil Cap-FT, !- Name + 0.476428E+00, !- Coefficient1 Constant + 0.401147E-01, !- Coefficient2 x + 0.226411E-03, !- Coefficient3 x**2 + -0.827136E-03, !- Coefficient4 y + -0.732240E-05, !- Coefficient5 y**2 + -0.446278E-03, !- Coefficient6 x*y + 0.0, !- Minimum Value of x + 50.0, !- Maximum Value of x + 0.0, !- Minimum Value of y + 50.0, !- Maximum Value of y + 0.0, !- Minimum Curve Output + 5.0, !- Maximum Curve Output + Temperature, !- Input Unit Type for X + Temperature, !- Input Unit Type for Y + Dimensionless; !- Output Unit Type + + Curve:Cubic, + Sys 1 Furnace DX Cool Cool Coil Cap-FF, !- Name + 0.47278589, !- Coefficient1 Constant + 1.2433415, !- Coefficient2 x + -1.0387055, !- Coefficient3 x**2 + 0.32257813, !- Coefficient4 x**3 + 0.5, !- Minimum Value of x + 1.5; !- Maximum Value of x + + Curve:Biquadratic, + Sys 1 Furnace DX Cool Cool Coil EIR-FT, !- Name + 0.632475E+00, !- Coefficient1 Constant + -0.121321E-01, !- Coefficient2 x + 0.507773E-03, !- Coefficient3 x**2 + 0.155377E-01, !- Coefficient4 y + 0.272840E-03, !- Coefficient5 y**2 + -0.679201E-03, !- Coefficient6 x*y + 0.0, !- Minimum Value of x + 50.0, !- Maximum Value of x + 0.0, !- Minimum Value of y + 50.0, !- Maximum Value of y + 0.0, !- Minimum Curve Output + 5.0, !- Maximum Curve Output + Temperature, !- Input Unit Type for X + Temperature, !- Input Unit Type for Y + Dimensionless; !- Output Unit Type + + Curve:Cubic, + Sys 1 Furnace DX Cool Cool Coil EIR-FF, !- Name + 0.47278589, !- Coefficient1 Constant + 1.2433415, !- Coefficient2 x + -1.0387055, !- Coefficient3 x**2 + 0.32257813, !- Coefficient4 x**3 + 0.5, !- Minimum Value of x + 1.5; !- Maximum Value of x + +! PLF = l.- Cd(1.-PLR) where Cd = 0.15 + + Curve:Quadratic, + Sys 1 Furnace DX Cool Cool Coil PLF, !- Name + 0.85, !- Coefficient1 Constant + 0.15, !- Coefficient2 x + 0, !- Coefficient3 x**2 + 0, !- Minimum Value of x + 1; !- Maximum Value of x + + Curve:Biquadratic, + Sys 1 Furnace DX Cool Cool Coil WH-FT, !- Name + 1.0, !- Coefficient1 Constant + 0.0, !- Coefficient2 x + 0.0, !- Coefficient3 x**2 + 0.0, !- Coefficient4 y + 0.0, !- Coefficient5 y**2 + 0.0, !- Coefficient6 x*y + 0, !- Minimum Value of x + 50, !- Maximum Value of x + 0, !- Minimum Value of y + 50, !- Maximum Value of y + , !- Minimum Curve Output + , !- Maximum Curve Output + Temperature, !- Input Unit Type for X + Temperature, !- Input Unit Type for Y + Dimensionless; !- Output Unit Type + +)IDF"; + + EXPECT_TRUE(process_idf(idf_objects, false)); + + bool zoneEquipment = true; + state->dataZoneEquip->ZoneEquipInputsFilled = true; + bool ErrorsFound(false); + std::string compName = "SYS 1 FURNACE DX COOL UNITARY SYSTEM"; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + auto thisSys = &state->dataUnitarySystems->unitarySys[0]; + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); + + OutputReportPredefined::SetPredefinedTables(*state); + + state->dataGlobal->BeginEnvrnFlag = false; + state->dataLoopNodes->Node(thisSys->CoolCoilInletNodeNum).MassFlowRate = 0.05; + state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); + state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(1); + state->dataUnitarySystems->CoolingLoad = true; + state->dataHVACGlobal->MSHPMassFlowRateLow = 0.15; + + int AirLoopNum(0); + bool FirstHVACIteration = false; + thisSys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); + + Real64 OnOffAirFlowRatio(1.0); + Real64 CoilCoolHeatRat(1.0); + DataHVACGlobals::CompressorOperation CompressorOn(DataHVACGlobals::CompressorOperation::Off); + thisSys->m_CoolingSpeedNum = 2; + thisSys->m_SingleMode = 0; + thisSys->calcUnitaryCoolingSystem( + *state, AirLoopNum, FirstHVACIteration, thisSys->m_CoolingPartLoadFrac, CompressorOn, OnOffAirFlowRatio, CoilCoolHeatRat, false); +} From 4716bfb17f8d1ffeccb8e2651e06a1c58f4a3767 Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Fri, 9 Feb 2024 13:57:13 -0700 Subject: [PATCH 07/21] Correct parameters in call to DXCoil simulate. --- src/EnergyPlus/HVACHXAssistedCoolingCoil.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc index 4bad6a59634..8d746918e36 100644 --- a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc +++ b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc @@ -983,9 +983,8 @@ namespace HVACHXAssistedCoolingCoil { state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].simulate( state, OperationMode, // partially implemented for HXAssistedCoil - CoilPLR, // PartLoadRatio, mCoolingSpeedNum, - mCoolingSpeedRatio, + CoilPLR, FanOpMode, singleMode); // From b992bd8a3589620edb1ca51067ba0134575cf2a3 Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Fri, 16 Feb 2024 14:12:57 -0700 Subject: [PATCH 08/21] Fix PartLoadRatioReport, initialize cooling speed to 1, assert if 0. --- src/EnergyPlus/Coils/CoilCoolingDX.cc | 4 +++- src/EnergyPlus/UnitarySystem.cc | 21 +++++++++++---------- src/EnergyPlus/UnitarySystem.hh | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.cc b/src/EnergyPlus/Coils/CoilCoolingDX.cc index 7f7daafb556..00ecb4fa3e9 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDX.cc @@ -672,6 +672,8 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, bool const singleMode, Real64 const LoadSHR) { + assert(speedNum != 0); + if (this->myOneTimeInitFlag) { this->oneTimeInit(state); this->myOneTimeInitFlag = false; @@ -777,7 +779,7 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, this->wasteHeatEnergyRate = this->performance.wasteHeatRate; this->wasteHeatEnergy = this->performance.wasteHeatRate * reportingConstant; - this->partLoadRatioReport = speedNum == 1 ? 1.0 : speedRatio; + this->partLoadRatioReport = speedNum > 1 ? 1.0 : speedRatio; this->speedNumReport = speedNum; this->speedRatioReport = speedRatio; diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index f4905ed3d97..0a9242bfd48 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -11660,24 +11660,25 @@ namespace UnitarySystems { } break; case DataHVACGlobals::CoilDX_Cooling: { // CoilCoolingDX bool const singleMode = (this->m_SingleMode == 1); + CoilPLR = 0.0; if (this->m_ControlType == UnitarySysCtrlType::Setpoint) { if (CompressorOn == DataHVACGlobals::CompressorOperation::On) { CoilPLR = (this->m_CoolingSpeedNum > 1) ? 1.0 : PartLoadRatio; - } else - CoilPLR = 0.0; + } } else { if (this->m_EMSOverrideCoilSpeedNumOn) { CoilPLR = this->m_CoolingSpeedRatio; } else { - if (CompressorOn == DataHVACGlobals::CompressorOperation::Off) { - this->m_CoolingSpeedNum = 1; // Bypass mixed-speed calculations in called functions - CoilPLR = 0.0; - } else { - if (singleMode) { - CoilPLR = (m_CoolingSpeedNum == 1) ? PartLoadRatio - : 0.0; // singleMode allows cycling, but not part load operation at higher speeds + if (state.dataUnitarySystems->CoolingLoad) { + if (CompressorOn == DataHVACGlobals::CompressorOperation::Off) { + this->m_CoolingSpeedNum = 1; // Bypass mixed-speed calculations in called functions } else { - CoilPLR = PartLoadRatio; + if (singleMode) { + CoilPLR = (m_CoolingSpeedNum == 1) ? PartLoadRatio + : 0.0; // singleMode allows cycling, but not part load operation at higher speeds + } else { + CoilPLR = PartLoadRatio; + } } } } diff --git a/src/EnergyPlus/UnitarySystem.hh b/src/EnergyPlus/UnitarySystem.hh index f6426deecde..5ddccfdad38 100644 --- a/src/EnergyPlus/UnitarySystem.hh +++ b/src/EnergyPlus/UnitarySystem.hh @@ -372,7 +372,7 @@ namespace UnitarySystems { Real64 m_CoolingCycRatio = 0.0; Real64 m_CoolingSpeedRatio = 0.0; - int m_CoolingSpeedNum = 0; + int m_CoolingSpeedNum = 1; int m_EconoSpeedNum = 0; Real64 m_EconoPartLoadRatio = 0; From 7ab582b06299b3168e0b0a2246099d22e19fb84f Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Wed, 21 Feb 2024 06:59:59 -0700 Subject: [PATCH 09/21] Update test IDF. --- tst/EnergyPlus/unit/UnitarySystem.unit.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index 70bb25018f1..5614993536a 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -23941,6 +23941,7 @@ TEST_F(ZoneUnitarySysTest, CoilSystemDXCoil_CalcTest) , !- No Load Fraction of Autosized Heating Supply Air Flow Rate , !- No Load Supply Air Flow Rate Per Unit of Capacity During Cooling Operation {m3/s-W} , !- No Load Supply Air Flow Rate Per Unit of Capacity During Heating Operation {m3/s-W} + , !- No Load Supply Air Flow Rate Control Set To Low Speed Autosize, !- Maximum Supply Air Temperature {C} 21, !- Maximum Outdoor Dry-Bulb Temperature for Supplemental Heater Operation {C} , !- Outdoor Dry-Bulb Temperature Sensor Node Name From 4a83d3d5f9c7889a4b0d5e33a587a7f2642f7630 Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Tue, 23 Jul 2024 08:18:36 -0600 Subject: [PATCH 10/21] Fix formatting. --- src/EnergyPlus/Coils/CoilCoolingDX.cc | 4 +- src/EnergyPlus/Coils/CoilCoolingDX.hh | 9 +- .../CoilCoolingDXCurveFitOperatingMode.cc | 2 +- .../Coils/CoilCoolingDXCurveFitPerformance.cc | 15 +- .../Coils/CoilCoolingDXCurveFitPerformance.hh | 228 ++++++++------- .../Coils/CoilCoolingDXCurveFitSpeed.cc | 207 ++++++------- .../Coils/CoilCoolingDXCurveFitSpeed.hh | 275 +++++++++--------- src/EnergyPlus/UnitarySystem.cc | 2 +- 8 files changed, 352 insertions(+), 390 deletions(-) diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.cc b/src/EnergyPlus/Coils/CoilCoolingDX.cc index 482cbda2c1c..5ca3800eedc 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDX.cc @@ -657,10 +657,10 @@ void CoilCoolingDX::size(EnergyPlusData &state) } void CoilCoolingDX::simulate(EnergyPlusData &state, - HVAC::CoilMode coilMode, + HVAC::CoilMode coilMode, int const speedNum, Real64 const speedRatio, - HVAC::FanOp const fanOp, + HVAC::FanOp const fanOp, bool const singleMode, Real64 const LoadSHR) { diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.hh b/src/EnergyPlus/Coils/CoilCoolingDX.hh index eae07bb761f..86fb69e8820 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.hh +++ b/src/EnergyPlus/Coils/CoilCoolingDX.hh @@ -84,8 +84,13 @@ struct CoilCoolingDX static void reportAllStandardRatings(EnergyPlusData &state); void instantiateFromInputSpec(EnergyPlusData &state, const CoilCoolingDXInputSpecification &input_data); void oneTimeInit(EnergyPlusData &state); - void - simulate(EnergyPlusData &state, HVAC::CoilMode coilMode, int speedNum, Real64 speedRatio, HVAC::FanOp const fanOp, bool singleMode, Real64 LoadSHR = -1.0); + void simulate(EnergyPlusData &state, + HVAC::CoilMode coilMode, + int speedNum, + Real64 speedRatio, + HVAC::FanOp const fanOp, + bool singleMode, + Real64 LoadSHR = -1.0); void setData(int fanIndex, HVAC::FanType fanType, std::string const &fanName, int airLoopNum); void getFixedData(int &evapInletNodeIndex, int &evapOutletNodeIndex, diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc index 0e1d1654334..f0ec0522120 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc @@ -312,7 +312,7 @@ void CoilCoolingDXCurveFitOperatingMode::CalcOperatingMode(EnergyPlus::EnergyPlu } thisspeed.ambPressure = condInletNode.Press; thisspeed.AirMassFlow = inletNode.MassFlowRate; - if (fanOp == HVAC::FanOp::Cycling && speedNum == 1) { + if (fanOp == HVAC::FanOp::Cycling && speedNum == 1) { if (speedRatio > 0.0) { thisspeed.AirMassFlow = thisspeed.AirMassFlow / speedRatio; } else { diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc index 204c1171a90..4cdda2e333c 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc @@ -271,16 +271,8 @@ void CoilCoolingDXCurveFitPerformance::simulate(EnergyPlus::EnergyPlusData &stat SysSubSHR = sensSubRate / totalCoolingRate; if (LoadSHR < SysSubSHR) { outletNode.MassFlowRate = inletNode.MassFlowRate; - this->calculate(state, - this->alternateMode2, - inletNode, - outletNode, - speedNum, - speedRatio, - fanOp, - condInletNode, - condOutletNode, - singleMode); + this->calculate( + state, this->alternateMode2, inletNode, outletNode, speedNum, speedRatio, fanOp, condInletNode, condOutletNode, singleMode); CalcComponentSensibleLatentOutput(outletNode.MassFlowRate, inletNode.Temp, inletNode.HumRat, @@ -334,8 +326,7 @@ void CoilCoolingDXCurveFitPerformance::simulate(EnergyPlus::EnergyPlusData &stat } } } else if (currentCoilMode == HVAC::CoilMode::Enhanced) { - this->calculate( - state, this->alternateMode, inletNode, outletNode, speedNum, speedRatio, fanOp, condInletNode, condOutletNode, singleMode); + this->calculate(state, this->alternateMode, inletNode, outletNode, speedNum, speedRatio, fanOp, condInletNode, condOutletNode, singleMode); this->OperatingMode = 2; this->powerUse = this->alternateMode.OpModePower; this->RTF = this->alternateMode.OpModeRTF; diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.hh b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.hh index 858574d9e4f..86539db4644 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.hh +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.hh @@ -60,120 +60,122 @@ namespace EnergyPlus { // Forward declarations - struct EnergyPlusData; - - struct CoilCoolingDXCurveFitPerformanceInputSpecification { - std::string name; - Real64 crankcase_heater_capacity; - Real64 minimum_outdoor_dry_bulb_temperature_for_compressor_operation; - Real64 maximum_outdoor_dry_bulb_temperature_for_crankcase_heater_operation; - Real64 unit_internal_static_air_pressure; - Real64 basin_heater_capacity; - Real64 basin_heater_setpoint_temperature; - std::string basin_heater_operating_schedule_name; - std::string compressor_fuel_type; - std::string base_operating_mode_name; - std::string alternate_operating_mode_name; - std::string alternate_operating_mode2_name; - std::string outdoor_temperature_dependent_crankcase_heater_capacity_curve_name; - std::string capacity_control; - }; - - struct CoilCoolingDXCurveFitPerformance { - std::string object_name = "Coil:Cooling:DX:CurveFit:Performance"; - std::string parentName; - - void instantiateFromInputSpec(EnergyPlusData &state, - const CoilCoolingDXCurveFitPerformanceInputSpecification &input_data); - - void simulate(EnergyPlusData &state, - const DataLoopNode::NodeData &inletNode, - DataLoopNode::NodeData &outletNode, - HVAC::CoilMode currentCoilMode, - int speedNum, - Real64 speedRatio, - HVAC::FanOp const fanOp, - DataLoopNode::NodeData &condInletNode, - DataLoopNode::NodeData &condOutletNode, - bool singleMode, - Real64 LoadSHR = 0.0); - - void calculate(EnergyPlusData &state, - CoilCoolingDXCurveFitOperatingMode ¤tMode, - const DataLoopNode::NodeData &inletNode, - DataLoopNode::NodeData &outletNode, - int speedNum, - Real64 speedRatio, - HVAC::FanOp const fanOp, - DataLoopNode::NodeData &condInletNode, - DataLoopNode::NodeData &condOutletNode, - bool singleMode); - - void calcStandardRatings210240(EnergyPlusData &state); - - CoilCoolingDXCurveFitPerformanceInputSpecification original_input_specs; - - CoilCoolingDXCurveFitPerformance() = default; - - explicit CoilCoolingDXCurveFitPerformance(EnergyPlusData &state, const std::string &name); - - void size(EnergyPlusData &state); - - void setOperMode(EnergyPlusData &state, CoilCoolingDXCurveFitOperatingMode ¤tMode, int const mode); - - std::string name; - Real64 crankcaseHeaterCap = 0.0; - Real64 crankcaseHeaterPower = 0.0; - int crankcaseHeaterCapacityCurveIndex = 0; - Real64 crankcaseHeaterElectricityConsumption = 0.0; - Real64 minOutdoorDrybulb = 0.0; - Real64 maxOutdoorDrybulbForBasin = 0.0; - bool mySizeFlag = true; - Constant::eFuel compressorFuelType = Constant::eFuel::Invalid; - std::string compressorFuelTypeForOutput; - Real64 compressorFuelRate = 0.0; - Real64 compressorFuelConsumption = 0.0; - - enum CapControlMethod { - CONTINUOUS, - DISCRETE - }; - CapControlMethod capControlMethod = CapControlMethod::DISCRETE; - - Real64 evapCondBasinHeatCap = 0.0; - Real64 evapCondBasinHeatSetpoint = 0.0; - int evapCondBasinHeatSchedulIndex = 0; - Real64 basinHeaterElectricityConsumption = 0.0; - Real64 basinHeaterPower = 0.0; - Real64 powerUse = 0.0; - Real64 electricityConsumption = 0.0; - Real64 RTF = 0.0; - bool oneTimeEIOHeaderWrite = true; - Real64 wasteHeatRate = 0.0; - int OperatingMode = 0; - Real64 ModeRatio = 0.0; - Real64 recoveredEnergyRate = 0.0; - Real64 NormalSHR = 0.0; - - // standard rating stuff -- for now just 210/240 - Real64 standardRatingCoolingCapacity = 0.0; // net cooling capacity of single speed DX cooling coil - Real64 standardRatingSEER = 0.0; // seasonal energy efficiency ratio of single speed DX cooling coil - Real64 standardRatingSEER_Standard = 0.0; // seasonal energy efficiency ratio - Real64 standardRatingEER = 0.0; // energy efficiency ratio of single speed DX cooling coil - Real64 standardRatingIEER = 0.0; // Integrated energy efficiency ratio of single speed DX cooling coil - - // standard rating stuff -- for now just 210/240 2023 - Real64 standardRatingCoolingCapacity2023 = 0.0; // net cooling capacity of single speed DX cooling coil - Real64 standardRatingSEER2_User = 0.0; // seasonal energy efficiency ratio of single speed DX cooling coil - Real64 standardRatingSEER2_Standard = 0.0; - Real64 standardRatingEER2 = 0.0; // energy efficiency ratio of single speed DX cooling coil - Real64 standardRatingIEER2 = 0.0; // Integrated energy efficiency ratio of singgle speed DX cooling coil | AHRI Std.340/360-2022(IP) - - CoilCoolingDXCurveFitOperatingMode normalMode; - HVAC::CoilMode maxAvailCoilMode = HVAC::CoilMode::Normal; // max available coil mode, 0 Normal, 1 Enhanced, 2 SubcoolReheat - CoilCoolingDXCurveFitOperatingMode alternateMode; // enhanced dehumidifcation or Subcool mode - CoilCoolingDXCurveFitOperatingMode alternateMode2; // Reheat mode +struct EnergyPlusData; + +struct CoilCoolingDXCurveFitPerformanceInputSpecification +{ + std::string name; + Real64 crankcase_heater_capacity; + Real64 minimum_outdoor_dry_bulb_temperature_for_compressor_operation; + Real64 maximum_outdoor_dry_bulb_temperature_for_crankcase_heater_operation; + Real64 unit_internal_static_air_pressure; + Real64 basin_heater_capacity; + Real64 basin_heater_setpoint_temperature; + std::string basin_heater_operating_schedule_name; + std::string compressor_fuel_type; + std::string base_operating_mode_name; + std::string alternate_operating_mode_name; + std::string alternate_operating_mode2_name; + std::string outdoor_temperature_dependent_crankcase_heater_capacity_curve_name; + std::string capacity_control; +}; + +struct CoilCoolingDXCurveFitPerformance +{ + std::string object_name = "Coil:Cooling:DX:CurveFit:Performance"; + std::string parentName; + + void instantiateFromInputSpec(EnergyPlusData &state, const CoilCoolingDXCurveFitPerformanceInputSpecification &input_data); + + void simulate(EnergyPlusData &state, + const DataLoopNode::NodeData &inletNode, + DataLoopNode::NodeData &outletNode, + HVAC::CoilMode currentCoilMode, + int speedNum, + Real64 speedRatio, + HVAC::FanOp const fanOp, + DataLoopNode::NodeData &condInletNode, + DataLoopNode::NodeData &condOutletNode, + bool singleMode, + Real64 LoadSHR = 0.0); + + void calculate(EnergyPlusData &state, + CoilCoolingDXCurveFitOperatingMode ¤tMode, + const DataLoopNode::NodeData &inletNode, + DataLoopNode::NodeData &outletNode, + int speedNum, + Real64 speedRatio, + HVAC::FanOp const fanOp, + DataLoopNode::NodeData &condInletNode, + DataLoopNode::NodeData &condOutletNode, + bool singleMode); + + void calcStandardRatings210240(EnergyPlusData &state); + + CoilCoolingDXCurveFitPerformanceInputSpecification original_input_specs; + + CoilCoolingDXCurveFitPerformance() = default; + + explicit CoilCoolingDXCurveFitPerformance(EnergyPlusData &state, const std::string &name); + + void size(EnergyPlusData &state); + + void setOperMode(EnergyPlusData &state, CoilCoolingDXCurveFitOperatingMode ¤tMode, int const mode); + + std::string name; + Real64 crankcaseHeaterCap = 0.0; + Real64 crankcaseHeaterPower = 0.0; + int crankcaseHeaterCapacityCurveIndex = 0; + Real64 crankcaseHeaterElectricityConsumption = 0.0; + Real64 minOutdoorDrybulb = 0.0; + Real64 maxOutdoorDrybulbForBasin = 0.0; + bool mySizeFlag = true; + Constant::eFuel compressorFuelType = Constant::eFuel::Invalid; + std::string compressorFuelTypeForOutput; + Real64 compressorFuelRate = 0.0; + Real64 compressorFuelConsumption = 0.0; + + enum CapControlMethod + { + CONTINUOUS, + DISCRETE }; + CapControlMethod capControlMethod = CapControlMethod::DISCRETE; + + Real64 evapCondBasinHeatCap = 0.0; + Real64 evapCondBasinHeatSetpoint = 0.0; + int evapCondBasinHeatSchedulIndex = 0; + Real64 basinHeaterElectricityConsumption = 0.0; + Real64 basinHeaterPower = 0.0; + Real64 powerUse = 0.0; + Real64 electricityConsumption = 0.0; + Real64 RTF = 0.0; + bool oneTimeEIOHeaderWrite = true; + Real64 wasteHeatRate = 0.0; + int OperatingMode = 0; + Real64 ModeRatio = 0.0; + Real64 recoveredEnergyRate = 0.0; + Real64 NormalSHR = 0.0; + + // standard rating stuff -- for now just 210/240 + Real64 standardRatingCoolingCapacity = 0.0; // net cooling capacity of single speed DX cooling coil + Real64 standardRatingSEER = 0.0; // seasonal energy efficiency ratio of single speed DX cooling coil + Real64 standardRatingSEER_Standard = 0.0; // seasonal energy efficiency ratio + Real64 standardRatingEER = 0.0; // energy efficiency ratio of single speed DX cooling coil + Real64 standardRatingIEER = 0.0; // Integrated energy efficiency ratio of single speed DX cooling coil + + // standard rating stuff -- for now just 210/240 2023 + Real64 standardRatingCoolingCapacity2023 = 0.0; // net cooling capacity of single speed DX cooling coil + Real64 standardRatingSEER2_User = 0.0; // seasonal energy efficiency ratio of single speed DX cooling coil + Real64 standardRatingSEER2_Standard = 0.0; + Real64 standardRatingEER2 = 0.0; // energy efficiency ratio of single speed DX cooling coil + Real64 standardRatingIEER2 = 0.0; // Integrated energy efficiency ratio of singgle speed DX cooling coil | AHRI Std.340/360-2022(IP) + + CoilCoolingDXCurveFitOperatingMode normalMode; + HVAC::CoilMode maxAvailCoilMode = HVAC::CoilMode::Normal; // max available coil mode, 0 Normal, 1 Enhanced, 2 SubcoolReheat + CoilCoolingDXCurveFitOperatingMode alternateMode; // enhanced dehumidifcation or Subcool mode + CoilCoolingDXCurveFitOperatingMode alternateMode2; // Reheat mode +}; } // namespace EnergyPlus diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc index 46c814fadaa..faaa743ec33 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc @@ -65,7 +65,8 @@ using namespace EnergyPlus; void CoilCoolingDXCurveFitSpeed::instantiateFromInputSpec(EnergyPlus::EnergyPlusData &state, - const CoilCoolingDXCurveFitSpeedInputSpecification &input_data) { + const CoilCoolingDXCurveFitSpeedInputSpecification &input_data) +{ bool errorsFound(false); static constexpr std::string_view routineName = "CoilCoolingDXCurveFitSpeed::instantiateFromInputSpec: "; static constexpr std::string_view fieldName = "Part Load Fraction Correlation Curve Name"; @@ -142,14 +143,11 @@ void CoilCoolingDXCurveFitSpeed::instantiateFromInputSpec(EnergyPlus::EnergyPlus if (!errorsFound && !input_data.waste_heat_function_of_temperature_curve_name.empty()) { Real64 CurveVal = Curve::CurveValue(state, this->indexWHFT, RatedOutdoorAirTemp, RatedInletAirTemp); if (CurveVal > 1.10 || CurveVal < 0.90) { - ShowWarningError(state, - std::string{routineName} + this->object_name + "=\"" + this->name + "\", curve values"); + ShowWarningError(state, std::string{routineName} + this->object_name + "=\"" + this->name + "\", curve values"); ShowContinueError(state, - "Waste Heat Modifier Function of Temperature Curve Name = " + - input_data.waste_heat_function_of_temperature_curve_name); + "Waste Heat Modifier Function of Temperature Curve Name = " + input_data.waste_heat_function_of_temperature_curve_name); ShowContinueError( - state, - "...Waste Heat Modifier Function of Temperature Curve Name output is not equal to 1.0 (+ or - 10%) at rated conditions."); + state, "...Waste Heat Modifier Function of Temperature Curve Name output is not equal to 1.0 (+ or - 10%) at rated conditions."); ShowContinueError(state, format("...Curve output at rated conditions = {:.3T}", CurveVal)); } } @@ -182,20 +180,16 @@ void CoilCoolingDXCurveFitSpeed::instantiateFromInputSpec(EnergyPlus::EnergyPlus } if (MinCurveVal < 0.7) { ShowWarningError(state, format("{}{}=\"{}\", invalid", routineName, this->object_name, this->name)); - ShowContinueError(state, format("...{}=\"{}\" has out of range value.", fieldName, - input_data.part_load_fraction_correlation_curve_name)); - ShowContinueError(state, format("...Curve minimum must be >= 0.7, curve min at PLR = {:.2T} is {:.3T}", - MinCurvePLR, MinCurveVal)); + ShowContinueError(state, format("...{}=\"{}\" has out of range value.", fieldName, input_data.part_load_fraction_correlation_curve_name)); + ShowContinueError(state, format("...Curve minimum must be >= 0.7, curve min at PLR = {:.2T} is {:.3T}", MinCurvePLR, MinCurveVal)); ShowContinueError(state, "...Setting curve minimum to 0.7 and simulation continues."); Curve::SetCurveOutputMinValue(state, this->indexPLRFPLF, errorsFound, 0.7); } if (MaxCurveVal > 1.0) { ShowWarningError(state, format("{}{}=\"{}\", invalid", routineName, this->object_name, this->name)); - ShowContinueError(state, format("...{}=\"{}\" has out of range value.", fieldName, - input_data.part_load_fraction_correlation_curve_name)); - ShowContinueError(state, format("...Curve maximum must be <= 1.0, curve max at PLR = {:.2T} is {:.3T}", - MaxCurvePLR, MaxCurveVal)); + ShowContinueError(state, format("...{}=\"{}\" has out of range value.", fieldName, input_data.part_load_fraction_correlation_curve_name)); + ShowContinueError(state, format("...Curve maximum must be <= 1.0, curve max at PLR = {:.2T} is {:.3T}", MaxCurvePLR, MaxCurveVal)); ShowContinueError(state, "...Setting curve maximum to 1.0 and simulation continues."); Curve::SetCurveOutputMaxValue(state, this->indexPLRFPLF, errorsFound, 1.0); } @@ -203,8 +197,7 @@ void CoilCoolingDXCurveFitSpeed::instantiateFromInputSpec(EnergyPlus::EnergyPlus if (errorsFound) { ShowFatalError( - state, std::string{routineName} + "Errors found in getting " + this->object_name + - " input. Preceding condition(s) causes termination."); + state, std::string{routineName} + "Errors found in getting " + this->object_name + " input. Preceding condition(s) causes termination."); } } @@ -237,12 +230,10 @@ bool CoilCoolingDXCurveFitSpeed::processCurve(EnergyPlus::EnergyPlusData &state, if (!errorFound) { if (Var2.present()) { Curve::checkCurveIsNormalizedToOne( - state, std::string{routineName} + this->object_name, this->name, curveIndex, fieldName, - curveName, Var1, Var2); + state, std::string{routineName} + this->object_name, this->name, curveIndex, fieldName, curveName, Var1, Var2); } else { Curve::checkCurveIsNormalizedToOne( - state, std::string{routineName} + this->object_name, this->name, curveIndex, fieldName, - curveName, Var1); + state, std::string{routineName} + this->object_name, this->name, curveIndex, fieldName, curveName, Var1); } } return errorFound; @@ -252,47 +243,44 @@ bool CoilCoolingDXCurveFitSpeed::processCurve(EnergyPlus::EnergyPlusData &state, CoilCoolingDXCurveFitSpeed::CoilCoolingDXCurveFitSpeed(EnergyPlus::EnergyPlusData &state, const std::string &name_to_find) - : // model inputs - indexCapFT(0), indexCapFFF(0), indexEIRFT(0), indexEIRFFF(0), indexPLRFPLF(0), indexWHFT(0), indexSHRFT(0), - indexSHRFFF(0), - - // speed class inputs - RatedAirMassFlowRate(0.0), // rated air mass flow rate at speed {kg/s} - RatedCondAirMassFlowRate(0.0), // condenser air mass flow rate at speed {kg/s} - grossRatedSHR(0.0), // rated sensible heat ratio at speed - RatedCBF(0.0), // rated coil bypass factor at speed - RatedEIR(0.0), // rated energy input ratio at speed {W/W} - ratedCOP(0.0), rated_total_capacity(0.0), rated_evap_fan_power_per_volume_flow_rate(0.0), - ratedWasteHeatFractionOfPowerInput(0.0), // rated waste heat fraction of power input - evap_condenser_pump_power_fraction(0.0), evap_condenser_effectiveness(0.0), - - parentModeRatedGrossTotalCap(0.0), parentModeRatedEvapAirFlowRate(0.0), parentModeRatedCondAirFlowRate(0.0), - parentOperatingMode(0), - - ambPressure(0.0), // outdoor pressure {Pa} - PLR(0.0), // coil operating part load ratio - AirFF(0.0), // ratio of air mass flow rate to rated air mass flow rate - // RatedTotCap( 0.0 ), // rated total capacity at speed {W} - - fullLoadPower(0.0), // full load power at speed {W} - fullLoadWasteHeat(0.0), // full load waste heat at speed {W} - RTF(0.0), // coil runtime fraction at speed - AirMassFlow(0.0), // coil inlet air mass flow rate {kg/s} - - // other data members - evap_air_flow_rate(0.0), condenser_air_flow_rate(0.0), active_fraction_of_face_coil_area(0.0), - ratedLatentCapacity(0.0), // Latent capacity at rated conditions {W} - - // rating data - RatedInletAirTemp(26.6667), // 26.6667C or 80F - RatedInletWetBulbTemp(19.4444), // 19.44 or 67F - RatedInletAirHumRat(0.0111847), // Humidity ratio corresponding to 80F dry bulb/67F wet bulb - RatedOutdoorAirTemp(35.0), // 35 C or 95F - DryCoilOutletHumRatioMin(0.00001) // dry coil outlet minimum hum ratio kgH2O/kgdry air + : // model inputs + indexCapFT(0), indexCapFFF(0), indexEIRFT(0), indexEIRFFF(0), indexPLRFPLF(0), indexWHFT(0), indexSHRFT(0), indexSHRFFF(0), + + // speed class inputs + RatedAirMassFlowRate(0.0), // rated air mass flow rate at speed {kg/s} + RatedCondAirMassFlowRate(0.0), // condenser air mass flow rate at speed {kg/s} + grossRatedSHR(0.0), // rated sensible heat ratio at speed + RatedCBF(0.0), // rated coil bypass factor at speed + RatedEIR(0.0), // rated energy input ratio at speed {W/W} + ratedCOP(0.0), rated_total_capacity(0.0), rated_evap_fan_power_per_volume_flow_rate(0.0), + ratedWasteHeatFractionOfPowerInput(0.0), // rated waste heat fraction of power input + evap_condenser_pump_power_fraction(0.0), evap_condenser_effectiveness(0.0), + + parentModeRatedGrossTotalCap(0.0), parentModeRatedEvapAirFlowRate(0.0), parentModeRatedCondAirFlowRate(0.0), parentOperatingMode(0), + + ambPressure(0.0), // outdoor pressure {Pa} + PLR(0.0), // coil operating part load ratio + AirFF(0.0), // ratio of air mass flow rate to rated air mass flow rate + // RatedTotCap( 0.0 ), // rated total capacity at speed {W} + + fullLoadPower(0.0), // full load power at speed {W} + fullLoadWasteHeat(0.0), // full load waste heat at speed {W} + RTF(0.0), // coil runtime fraction at speed + AirMassFlow(0.0), // coil inlet air mass flow rate {kg/s} + + // other data members + evap_air_flow_rate(0.0), condenser_air_flow_rate(0.0), active_fraction_of_face_coil_area(0.0), + ratedLatentCapacity(0.0), // Latent capacity at rated conditions {W} + + // rating data + RatedInletAirTemp(26.6667), // 26.6667C or 80F + RatedInletWetBulbTemp(19.4444), // 19.44 or 67F + RatedInletAirHumRat(0.0111847), // Humidity ratio corresponding to 80F dry bulb/67F wet bulb + RatedOutdoorAirTemp(35.0), // 35 C or 95F + DryCoilOutletHumRatioMin(0.00001) // dry coil outlet minimum hum ratio kgH2O/kgdry air { - int numSpeeds = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, - CoilCoolingDXCurveFitSpeed::object_name); + int numSpeeds = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CoilCoolingDXCurveFitSpeed::object_name); if (numSpeeds <= 0) { // error } @@ -328,17 +316,14 @@ CoilCoolingDXCurveFitSpeed::CoilCoolingDXCurveFitSpeed(EnergyPlus::EnergyPlusDat input_specs.rated_evaporative_condenser_pump_power_fraction = state.dataIPShortCut->rNumericArgs(9); input_specs.evaporative_condenser_effectiveness = state.dataIPShortCut->rNumericArgs(10); input_specs.total_cooling_capacity_function_of_temperature_curve_name = state.dataIPShortCut->cAlphaArgs(2); - input_specs.total_cooling_capacity_function_of_air_flow_fraction_curve_name = state.dataIPShortCut->cAlphaArgs( - 3); + input_specs.total_cooling_capacity_function_of_air_flow_fraction_curve_name = state.dataIPShortCut->cAlphaArgs(3); input_specs.energy_input_ratio_function_of_temperature_curve_name = state.dataIPShortCut->cAlphaArgs(4); input_specs.energy_input_ratio_function_of_air_flow_fraction_curve_name = state.dataIPShortCut->cAlphaArgs(5); input_specs.part_load_fraction_correlation_curve_name = state.dataIPShortCut->cAlphaArgs(6); input_specs.rated_waste_heat_fraction_of_power_input = state.dataIPShortCut->rNumericArgs(11); input_specs.waste_heat_function_of_temperature_curve_name = state.dataIPShortCut->cAlphaArgs(7); - input_specs.sensible_heat_ratio_modifier_function_of_temperature_curve_name = state.dataIPShortCut->cAlphaArgs( - 8); - input_specs.sensible_heat_ratio_modifier_function_of_flow_fraction_curve_name = state.dataIPShortCut->cAlphaArgs( - 9); + input_specs.sensible_heat_ratio_modifier_function_of_temperature_curve_name = state.dataIPShortCut->cAlphaArgs(8); + input_specs.sensible_heat_ratio_modifier_function_of_flow_fraction_curve_name = state.dataIPShortCut->cAlphaArgs(9); this->instantiateFromInputSpec(state, input_specs); break; @@ -349,26 +334,22 @@ CoilCoolingDXCurveFitSpeed::CoilCoolingDXCurveFitSpeed(EnergyPlus::EnergyPlusDat } } -void CoilCoolingDXCurveFitSpeed::size(EnergyPlus::EnergyPlusData &state) { +void CoilCoolingDXCurveFitSpeed::size(EnergyPlus::EnergyPlusData &state) +{ static constexpr std::string_view RoutineName = "sizeSpeed"; - this->rated_total_capacity = this->original_input_specs.gross_rated_total_cooling_capacity_ratio_to_nominal * - this->parentModeRatedGrossTotalCap; - this->evap_air_flow_rate = - this->original_input_specs.evaporator_air_flow_fraction * this->parentModeRatedEvapAirFlowRate; - this->condenser_air_flow_rate = - this->original_input_specs.condenser_air_flow_fraction * this->parentModeRatedCondAirFlowRate; + this->rated_total_capacity = this->original_input_specs.gross_rated_total_cooling_capacity_ratio_to_nominal * this->parentModeRatedGrossTotalCap; + this->evap_air_flow_rate = this->original_input_specs.evaporator_air_flow_fraction * this->parentModeRatedEvapAirFlowRate; + this->condenser_air_flow_rate = this->original_input_specs.condenser_air_flow_fraction * this->parentModeRatedCondAirFlowRate; this->grossRatedSHR = this->original_input_specs.gross_rated_sensible_heat_ratio; this->RatedAirMassFlowRate = - this->evap_air_flow_rate * - Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, - RatedInletAirHumRat, RoutineName); + this->evap_air_flow_rate * + Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); this->RatedCondAirMassFlowRate = - this->condenser_air_flow_rate * - Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, - RatedInletAirHumRat, RoutineName); + this->condenser_air_flow_rate * + Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, RatedInletAirTemp, RatedInletAirHumRat, RoutineName); bool PrintFlag = true; bool errorsFound = false; @@ -449,7 +430,8 @@ void CoilCoolingDXCurveFitSpeed::CalcSpeedOutput(EnergyPlus::EnergyPlusData &sta DataLoopNode::NodeData &outletNode, Real64 const _PLR, HVAC::FanOp const fanOp, - const Real64 condInletTemp) { + const Real64 condInletTemp) +{ // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("CalcSpeedOutput: "); @@ -472,8 +454,7 @@ void CoilCoolingDXCurveFitSpeed::CalcSpeedOutput(EnergyPlus::EnergyPlusData &sta A0 = -std::log(RatedCBF) * RatedAirMassFlowRate; } else { // This is bad - results in CBF = 1.0 which results in divide by zero below: hADP = inletState.h - hDelta / (1.0 - CBF) - ShowFatalError(state, - format("{}Rated CBF={:.6R} is <= 0.0 for {}={}", RoutineName, RatedCBF, object_name, name)); + ShowFatalError(state, format("{}Rated CBF={:.6R} is <= 0.0 for {}={}", RoutineName, RatedCBF, object_name, name)); A0 = 0.0; } Real64 ADiff = -A0 / AirMassFlow; @@ -633,16 +614,11 @@ Real64 CoilCoolingDXCurveFitSpeed::CalcBypassFactor(EnergyPlus::EnergyPlusData & Real64 outrh = Psychrometrics::PsyRhFnTdbWPb(state, outtdb, outw, outp); if (outrh >= 1.0) { - ShowWarningError(state, - std::string{RoutineName} + ": For object = " + this->object_name + ", name = \"" + this->name + - "\""); + ShowWarningError(state, std::string{RoutineName} + ": For object = " + this->object_name + ", name = \"" + this->name + "\""); ShowContinueError(state, "Calculated outlet air relative humidity greater than 1. The combination of"); - ShowContinueError(state, - "rated air volume flow rate, total cooling capacity and sensible heat ratio yields coil exiting"); - ShowContinueError(state, - "air conditions above the saturation curve. Possible fixes are to reduce the rated total cooling"); - ShowContinueError(state, - "capacity, increase the rated air volume flow rate, or reduce the rated sensible heat ratio for this coil."); + ShowContinueError(state, "rated air volume flow rate, total cooling capacity and sensible heat ratio yields coil exiting"); + ShowContinueError(state, "air conditions above the saturation curve. Possible fixes are to reduce the rated total cooling"); + ShowContinueError(state, "capacity, increase the rated air volume flow rate, or reduce the rated sensible heat ratio for this coil."); ShowContinueError(state, "If autosizing, it is recommended that all three of these values be autosized."); ShowContinueError(state, "...Inputs used for calculating cooling coil bypass factor."); ShowContinueError(state, format("...Inlet Air Temperature = {:.2R} C", tdb)); @@ -650,10 +626,8 @@ Real64 CoilCoolingDXCurveFitSpeed::CalcBypassFactor(EnergyPlus::EnergyPlusData & ShowContinueError(state, format("...Inlet Air Humidity Ratio = {:.6R} kgWater/kgDryAir", w)); ShowContinueError(state, format("...Outlet Air Humidity Ratio = {:.6R} kgWater/kgDryAir", outw)); ShowContinueError(state, format("...Total Cooling Capacity used in calculation = {:.2R} W", q)); - ShowContinueError(state, - format("...Air Mass Flow Rate used in calculation = {:.6R} kg/s", airMassFlowRate)); - ShowContinueError(state, format("...Air Volume Flow Rate used in calculation = {:.6R} m3/s", - this->evap_air_flow_rate)); + ShowContinueError(state, format("...Air Mass Flow Rate used in calculation = {:.6R} kg/s", airMassFlowRate)); + ShowContinueError(state, format("...Air Volume Flow Rate used in calculation = {:.6R} m3/s", this->evap_air_flow_rate)); if (q > 0.0) { if (((this->minRatedVolFlowPerRatedTotCap - this->evap_air_flow_rate / q) > SmallDifferenceTest) || ((this->evap_air_flow_rate / q - this->maxRatedVolFlowPerRatedTotCap) > SmallDifferenceTest)) { @@ -669,7 +643,7 @@ Real64 CoilCoolingDXCurveFitSpeed::CalcBypassFactor(EnergyPlus::EnergyPlusData & Real64 adjustedSHR = (Psychrometrics::PsyHFnTdbW(tdb, outw) - outh) / deltaH; ShowWarningError(state, std::string{RoutineName} + object_name + " \"" + name + - "\", SHR adjusted to achieve valid outlet air properties and the simulation continues."); + "\", SHR adjusted to achieve valid outlet air properties and the simulation continues."); ShowContinueError(state, format("Initial SHR = {:.5R}", this->grossRatedSHR)); ShowContinueError(state, format("Adjusted SHR = {:.5R}", adjustedSHR)); } @@ -684,18 +658,15 @@ Real64 CoilCoolingDXCurveFitSpeed::CalcBypassFactor(EnergyPlus::EnergyPlusData & if (deltaT > 0.0) slopeAtConds = deltaHumRat / deltaT; if (slopeAtConds <= 0.0) { ShowSevereError(state, this->object_name + " \"" + this->name + "\""); - ShowContinueError(state, - "...Invalid slope or outlet air condition when calculating cooling coil bypass factor."); + ShowContinueError(state, "...Invalid slope or outlet air condition when calculating cooling coil bypass factor."); ShowContinueError(state, format("...Slope = {:.8R}", slopeAtConds)); ShowContinueError(state, format("...Inlet Air Temperature = {:.2R} C", tdb)); ShowContinueError(state, format("...Outlet Air Temperature = {:.2R} C", outtdb)); ShowContinueError(state, format("...Inlet Air Humidity Ratio = {:.6R} kgWater/kgDryAir", w)); ShowContinueError(state, format("...Outlet Air Humidity Ratio = {:.6R} kgWater/kgDryAir", outw)); ShowContinueError(state, format("...Total Cooling Capacity used in calculation = {:.2R} W", q)); - ShowContinueError(state, - format("...Air Mass Flow Rate used in calculation = {:.6R} kg/s", airMassFlowRate)); - ShowContinueError(state, format("...Air Volume Flow Rate used in calculation = {:.6R} m3/s", - this->evap_air_flow_rate)); + ShowContinueError(state, format("...Air Mass Flow Rate used in calculation = {:.6R} kg/s", airMassFlowRate)); + ShowContinueError(state, format("...Air Volume Flow Rate used in calculation = {:.6R} m3/s", this->evap_air_flow_rate)); if (q > 0.0) { if (((this->minRatedVolFlowPerRatedTotCap - this->evap_air_flow_rate / q) > SmallDifferenceTest) || ((this->evap_air_flow_rate / q - this->maxRatedVolFlowPerRatedTotCap) > SmallDifferenceTest)) { @@ -743,36 +714,27 @@ Real64 CoilCoolingDXCurveFitSpeed::CalcBypassFactor(EnergyPlus::EnergyPlusData & if (iter > maxIter) { ShowSevereError(state, std::string{RoutineName} + object_name + " \"" + name + - "\" -- coil bypass factor calculation did not converge after max iterations."); - ShowContinueError(state, format("The RatedSHR of [{:.3R}], entered by the user or autosized (see *.eio file),", - this->grossRatedSHR)); + "\" -- coil bypass factor calculation did not converge after max iterations."); + ShowContinueError(state, format("The RatedSHR of [{:.3R}], entered by the user or autosized (see *.eio file),", this->grossRatedSHR)); ShowContinueError(state, "may be causing this. The line defined by the coil rated inlet air conditions"); - ShowContinueError(state, - "(26.7C drybulb and 19.4C wetbulb) and the RatedSHR (i.e., slope of the line) must intersect"); - ShowContinueError(state, - "the saturation curve of the psychrometric chart. If the RatedSHR is too low, then this"); - ShowContinueError(state, - "intersection may not occur and the coil bypass factor calculation will not converge."); - ShowContinueError(state, - "If autosizing the SHR, recheck the design supply air humidity ratio and design supply air"); - ShowContinueError(state, - "temperature values in the Sizing:System and Sizing:Zone objects. In general, the temperatures"); - ShowContinueError(state, - "and humidity ratios specified in these two objects should be the same for each system"); + ShowContinueError(state, "(26.7C drybulb and 19.4C wetbulb) and the RatedSHR (i.e., slope of the line) must intersect"); + ShowContinueError(state, "the saturation curve of the psychrometric chart. If the RatedSHR is too low, then this"); + ShowContinueError(state, "intersection may not occur and the coil bypass factor calculation will not converge."); + ShowContinueError(state, "If autosizing the SHR, recheck the design supply air humidity ratio and design supply air"); + ShowContinueError(state, "temperature values in the Sizing:System and Sizing:Zone objects. In general, the temperatures"); + ShowContinueError(state, "and humidity ratios specified in these two objects should be the same for each system"); ShowContinueError(state, "and the zones that it serves."); ShowContinueErrorTimeStamp(state, ""); cbfErrors = true; // Didn't converge within MaxIter iterations } if (calcCBF < 0.0) { - ShowSevereError(state, std::string{RoutineName} + object_name + " \"" + name + - "\" -- negative coil bypass factor calculated."); + ShowSevereError(state, std::string{RoutineName} + object_name + " \"" + name + "\" -- negative coil bypass factor calculated."); ShowContinueErrorTimeStamp(state, ""); cbfErrors = true; // Negative CBF not valid } // Show fatal error for specific coil that caused a CBF error if (cbfErrors) { - ShowFatalError(state, std::string{RoutineName} + object_name + " \"" + name + - "\" Errors found in calculating coil bypass factors"); + ShowFatalError(state, std::string{RoutineName} + object_name + " \"" + name + "\" Errors found in calculating coil bypass factors"); } return calcCBF; } @@ -784,7 +746,8 @@ Real64 CoilCoolingDXCurveFitSpeed::calcEffectiveSHR(const DataLoopNode::NodeData Real64 const QLatRated, // Rated latent capacity Real64 const QLatActual, // Actual latent capacity Real64 const HeatingRTF // Used to recalculate Toff for cycling fan systems -) { +) +{ // PURPOSE OF THIS FUNCTION: // Adjust sensible heat ratio to account for degradation of DX coil latent // capacity at part-load (cycling) conditions. diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh index 7c2f7121c52..88450318464 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh @@ -60,143 +60,144 @@ namespace EnergyPlus { // Forward declarations - struct EnergyPlusData; - - struct CoilCoolingDXCurveFitSpeedInputSpecification { - std::string name; - Real64 gross_rated_total_cooling_capacity_ratio_to_nominal; - Real64 gross_rated_sensible_heat_ratio; - Real64 gross_rated_cooling_COP; - Real64 evaporator_air_flow_fraction; - Real64 condenser_air_flow_fraction; - Real64 active_fraction_of_coil_face_area; - Real64 rated_evaporative_condenser_pump_power_fraction; - Real64 rated_evaporator_fan_power_per_volume_flow_rate; - Real64 rated_evaporator_fan_power_per_volume_flow_rate_2023; - Real64 evaporative_condenser_effectiveness; - std::string total_cooling_capacity_function_of_temperature_curve_name; - std::string total_cooling_capacity_function_of_air_flow_fraction_curve_name; - std::string energy_input_ratio_function_of_temperature_curve_name; - std::string energy_input_ratio_function_of_air_flow_fraction_curve_name; - std::string part_load_fraction_correlation_curve_name; - Real64 rated_waste_heat_fraction_of_power_input; - std::string waste_heat_function_of_temperature_curve_name; - std::string sensible_heat_ratio_modifier_function_of_temperature_curve_name; - std::string sensible_heat_ratio_modifier_function_of_flow_fraction_curve_name; - }; - - struct CoilCoolingDXCurveFitSpeed { - std::string const object_name = "Coil:Cooling:DX:CurveFit:Speed"; - std::string parentName; - - CoilCoolingDXCurveFitSpeed() = default; - - explicit CoilCoolingDXCurveFitSpeed(EnergyPlusData &state, const std::string &name); - - void - instantiateFromInputSpec(EnergyPlusData &state, const CoilCoolingDXCurveFitSpeedInputSpecification &input_data); - - CoilCoolingDXCurveFitSpeedInputSpecification original_input_specs; - - // curve IDs - int indexCapFT = 0; - int indexCapFFF = 0; - int indexEIRFT = 0; - int indexEIRFFF = 0; - int indexPLRFPLF = 0; - int indexWHFT = 0; - int indexSHRFT = 0; - int indexSHRFFF = 0; - - // fixed values - std::string name; - Real64 RatedAirMassFlowRate = 0.0; // rated air mass flow rate at speed {kg/s} - Real64 RatedCondAirMassFlowRate = 0.0; // rated condenser air mass flow rate at speed {kg/s} - Real64 grossRatedSHR = 0.0; // rated sensible heat ratio at speed - bool ratedGrossTotalCapIsAutosized = false; - bool ratedEvapAirFlowRateIsAutosized = false; - Real64 RatedCBF = 0.0; // rated coil bypass factor at speed - Real64 RatedEIR = 0.0; // rated energy input ratio at speed {W/W} - Real64 ratedCOP = 0.0; - Real64 rated_total_capacity = 0.0; - Real64 rated_evap_fan_power_per_volume_flow_rate = 0.0; - Real64 rated_evap_fan_power_per_volume_flow_rate_2023 = 0.0; - Real64 ratedWasteHeatFractionOfPowerInput = 0.0; // rated waste heat fraction of power input - Real64 evap_condenser_pump_power_fraction = 0.0; - Real64 evap_condenser_effectiveness = 0.0; - - // stuff getting assigned by the parent mode - Real64 parentModeRatedGrossTotalCap = 0.0; // [W] - Real64 parentModeRatedEvapAirFlowRate = 0.0; // [m3/s] - Real64 parentModeRatedCondAirFlowRate = 0.0; // [m3/s] - int parentOperatingMode = 0; - Real64 parentModeTimeForCondensateRemoval = 0.0; - Real64 parentModeEvapRateRatio = 0.0; - Real64 parentModeMaxCyclingRate = 0.0; - Real64 parentModeLatentTimeConst = 0.0; - bool doLatentDegradation = false; // True if latent degradation is enabled for this speed - - // speed class objects - Real64 ambPressure = 0.0; // outdoor pressure {Pa] - Real64 PLR = 0.0; - Real64 AirFF = 0.0; // ratio of air mass flow rate to rated air mass flow rate - Real64 fullLoadPower = 0.0; // full load power at speed {W} - Real64 fullLoadWasteHeat = 0.0; // full load waste heat at speed {W} - Real64 RTF = 0.0; // coil runtime fraction at speed - Real64 AirMassFlow = 0.0; // coil inlet air mass flow rate {kg/s} - Real64 evap_air_flow_rate = 0.0; // evaporator air volume flow rate [m3/s] - Real64 condenser_air_flow_rate = 0.0; // condenser air volume flow rate [m3/s] - Real64 active_fraction_of_face_coil_area = 0.0; - bool adjustForFaceArea = false; - Real64 ratedLatentCapacity = 0.0; // Latent capacity at rated conditions {W} - - // rating data - Real64 RatedInletAirTemp = 26.6667; // 26.6667C or 80F - Real64 RatedInletWetBulbTemp = 19.4444; // 19.44 or 67F - Real64 RatedInletAirHumRat = 0.0111847; // Humidity ratio corresponding to 80F dry bulb/67F wet bulb - Real64 RatedOutdoorAirTemp = 35.0; // 35 C or 95F - Real64 DryCoilOutletHumRatioMin = 0.00001; // dry coil outlet minimum hum ratio kgH2O/kgdry air - - // flow per capacity values, they will be overridden with alternate values later if it is 100% OA coil - Real64 minRatedVolFlowPerRatedTotCap = HVAC::MinRatedVolFlowPerRatedTotCap1; - Real64 maxRatedVolFlowPerRatedTotCap = HVAC::MaxRatedVolFlowPerRatedTotCap1; - - void CalcSpeedOutput(EnergyPlusData &state, - const DataLoopNode::NodeData &inletNode, - DataLoopNode::NodeData &outletNode, - Real64 const _PLR, - HVAC::FanOp const fanOp, - Real64 condInletTemp); - - void size(EnergyPlusData &state); - - Real64 CalcBypassFactor(EnergyPlusData &state, - Real64 const tdb, // Inlet dry-bulb temperature {C} - Real64 const w, // Inlet humidity ratio {kg-H2O/kg-dryair} - Real64 const q, // Total capacity {W} - Real64 const shr, // SHR - Real64 const h, // Inlet enthalpy {J/kg-dryair} - Real64 const p); // Outlet node pressure {Pa} - - Real64 calcEffectiveSHR(const DataLoopNode::NodeData &inletNode, - Real64 const inletWetBulb, - Real64 const SHRss, // Steady-state sensible heat ratio - Real64 const RTF, // Compressor run-time fraction - Real64 const QLatRated, // Rated latent capacity - Real64 const QLatActual, // Actual latent capacity - Real64 const HeatingRTF // Used to recalculate Toff for cycling fan systems - ); - - private: - bool processCurve(EnergyPlusData &state, - const std::string &curveName, - int &curveIndex, - std::vector validDims, - std::string_view const routineName, - const std::string &fieldName, - Real64 Var1, // required 1st independent variable - ObjexxFCL::Optional Var2 = _); // 2nd independent variable - }; +struct EnergyPlusData; + +struct CoilCoolingDXCurveFitSpeedInputSpecification +{ + std::string name; + Real64 gross_rated_total_cooling_capacity_ratio_to_nominal; + Real64 gross_rated_sensible_heat_ratio; + Real64 gross_rated_cooling_COP; + Real64 evaporator_air_flow_fraction; + Real64 condenser_air_flow_fraction; + Real64 active_fraction_of_coil_face_area; + Real64 rated_evaporative_condenser_pump_power_fraction; + Real64 rated_evaporator_fan_power_per_volume_flow_rate; + Real64 rated_evaporator_fan_power_per_volume_flow_rate_2023; + Real64 evaporative_condenser_effectiveness; + std::string total_cooling_capacity_function_of_temperature_curve_name; + std::string total_cooling_capacity_function_of_air_flow_fraction_curve_name; + std::string energy_input_ratio_function_of_temperature_curve_name; + std::string energy_input_ratio_function_of_air_flow_fraction_curve_name; + std::string part_load_fraction_correlation_curve_name; + Real64 rated_waste_heat_fraction_of_power_input; + std::string waste_heat_function_of_temperature_curve_name; + std::string sensible_heat_ratio_modifier_function_of_temperature_curve_name; + std::string sensible_heat_ratio_modifier_function_of_flow_fraction_curve_name; +}; + +struct CoilCoolingDXCurveFitSpeed +{ + std::string const object_name = "Coil:Cooling:DX:CurveFit:Speed"; + std::string parentName; + + CoilCoolingDXCurveFitSpeed() = default; + + explicit CoilCoolingDXCurveFitSpeed(EnergyPlusData &state, const std::string &name); + + void instantiateFromInputSpec(EnergyPlusData &state, const CoilCoolingDXCurveFitSpeedInputSpecification &input_data); + + CoilCoolingDXCurveFitSpeedInputSpecification original_input_specs; + + // curve IDs + int indexCapFT = 0; + int indexCapFFF = 0; + int indexEIRFT = 0; + int indexEIRFFF = 0; + int indexPLRFPLF = 0; + int indexWHFT = 0; + int indexSHRFT = 0; + int indexSHRFFF = 0; + + // fixed values + std::string name; + Real64 RatedAirMassFlowRate = 0.0; // rated air mass flow rate at speed {kg/s} + Real64 RatedCondAirMassFlowRate = 0.0; // rated condenser air mass flow rate at speed {kg/s} + Real64 grossRatedSHR = 0.0; // rated sensible heat ratio at speed + bool ratedGrossTotalCapIsAutosized = false; + bool ratedEvapAirFlowRateIsAutosized = false; + Real64 RatedCBF = 0.0; // rated coil bypass factor at speed + Real64 RatedEIR = 0.0; // rated energy input ratio at speed {W/W} + Real64 ratedCOP = 0.0; + Real64 rated_total_capacity = 0.0; + Real64 rated_evap_fan_power_per_volume_flow_rate = 0.0; + Real64 rated_evap_fan_power_per_volume_flow_rate_2023 = 0.0; + Real64 ratedWasteHeatFractionOfPowerInput = 0.0; // rated waste heat fraction of power input + Real64 evap_condenser_pump_power_fraction = 0.0; + Real64 evap_condenser_effectiveness = 0.0; + + // stuff getting assigned by the parent mode + Real64 parentModeRatedGrossTotalCap = 0.0; // [W] + Real64 parentModeRatedEvapAirFlowRate = 0.0; // [m3/s] + Real64 parentModeRatedCondAirFlowRate = 0.0; // [m3/s] + int parentOperatingMode = 0; + Real64 parentModeTimeForCondensateRemoval = 0.0; + Real64 parentModeEvapRateRatio = 0.0; + Real64 parentModeMaxCyclingRate = 0.0; + Real64 parentModeLatentTimeConst = 0.0; + bool doLatentDegradation = false; // True if latent degradation is enabled for this speed + + // speed class objects + Real64 ambPressure = 0.0; // outdoor pressure {Pa] + Real64 PLR = 0.0; + Real64 AirFF = 0.0; // ratio of air mass flow rate to rated air mass flow rate + Real64 fullLoadPower = 0.0; // full load power at speed {W} + Real64 fullLoadWasteHeat = 0.0; // full load waste heat at speed {W} + Real64 RTF = 0.0; // coil runtime fraction at speed + Real64 AirMassFlow = 0.0; // coil inlet air mass flow rate {kg/s} + Real64 evap_air_flow_rate = 0.0; // evaporator air volume flow rate [m3/s] + Real64 condenser_air_flow_rate = 0.0; // condenser air volume flow rate [m3/s] + Real64 active_fraction_of_face_coil_area = 0.0; + bool adjustForFaceArea = false; + Real64 ratedLatentCapacity = 0.0; // Latent capacity at rated conditions {W} + + // rating data + Real64 RatedInletAirTemp = 26.6667; // 26.6667C or 80F + Real64 RatedInletWetBulbTemp = 19.4444; // 19.44 or 67F + Real64 RatedInletAirHumRat = 0.0111847; // Humidity ratio corresponding to 80F dry bulb/67F wet bulb + Real64 RatedOutdoorAirTemp = 35.0; // 35 C or 95F + Real64 DryCoilOutletHumRatioMin = 0.00001; // dry coil outlet minimum hum ratio kgH2O/kgdry air + + // flow per capacity values, they will be overridden with alternate values later if it is 100% OA coil + Real64 minRatedVolFlowPerRatedTotCap = HVAC::MinRatedVolFlowPerRatedTotCap1; + Real64 maxRatedVolFlowPerRatedTotCap = HVAC::MaxRatedVolFlowPerRatedTotCap1; + + void CalcSpeedOutput(EnergyPlusData &state, + const DataLoopNode::NodeData &inletNode, + DataLoopNode::NodeData &outletNode, + Real64 const _PLR, + HVAC::FanOp const fanOp, + Real64 condInletTemp); + + void size(EnergyPlusData &state); + + Real64 CalcBypassFactor(EnergyPlusData &state, + Real64 const tdb, // Inlet dry-bulb temperature {C} + Real64 const w, // Inlet humidity ratio {kg-H2O/kg-dryair} + Real64 const q, // Total capacity {W} + Real64 const shr, // SHR + Real64 const h, // Inlet enthalpy {J/kg-dryair} + Real64 const p); // Outlet node pressure {Pa} + + Real64 calcEffectiveSHR(const DataLoopNode::NodeData &inletNode, + Real64 const inletWetBulb, + Real64 const SHRss, // Steady-state sensible heat ratio + Real64 const RTF, // Compressor run-time fraction + Real64 const QLatRated, // Rated latent capacity + Real64 const QLatActual, // Actual latent capacity + Real64 const HeatingRTF // Used to recalculate Toff for cycling fan systems + ); + +private: + bool processCurve(EnergyPlusData &state, + const std::string &curveName, + int &curveIndex, + std::vector validDims, + std::string_view const routineName, + const std::string &fieldName, + Real64 Var1, // required 1st independent variable + ObjexxFCL::Optional Var2 = _); // 2nd independent variable +}; } // namespace EnergyPlus #endif // ENERGYPLUS_COILS_COILCOOLINGDXCURVEFITSPEED diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 4453451c4ed..6448ba4b1e7 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -13673,7 +13673,7 @@ namespace UnitarySystems { this->m_CoolingSpeedNum = speedNum; state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].simulate( state, coilMode, this->m_CoolingSpeedNum, this->m_CoolingSpeedRatio, this->m_FanOpMode, singleMode); - // Cooling: break if outlet humrat is lower than DesOutHumRat or approaches DesOutHumRat to within HumRatAcc from above + // Cooling: break if outlet humrat is lower than DesOutHumRat or approaches DesOutHumRat to within HumRatAcc from above if ((state.dataLoopNodes->Node(OutletNode).HumRat - DesOutHumRat) < HumRatAcc) break; } // make sure outlet HumRat is below set point before calling SolveRoot From f7e0e512bab0e60c32767c576cc50397a35c9d11 Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Tue, 30 Jul 2024 10:26:22 -0600 Subject: [PATCH 11/21] Small corrections after develop merge. --- src/EnergyPlus/Coils/CoilCoolingDX.cc | 2 -- src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc | 8 ++++---- src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh | 2 +- src/EnergyPlus/UnitarySystem.hh | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.cc b/src/EnergyPlus/Coils/CoilCoolingDX.cc index 5ca3800eedc..34831ca446c 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDX.cc @@ -664,8 +664,6 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, bool const singleMode, Real64 const LoadSHR) { - assert(speedNum != 0); - if (this->myOneTimeInitFlag) { this->oneTimeInit(state); this->myOneTimeInitFlag = false; diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc index faaa743ec33..68b506e6de4 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc @@ -428,7 +428,7 @@ void CoilCoolingDXCurveFitSpeed::size(EnergyPlus::EnergyPlusData &state) void CoilCoolingDXCurveFitSpeed::CalcSpeedOutput(EnergyPlus::EnergyPlusData &state, const DataLoopNode::NodeData &inletNode, DataLoopNode::NodeData &outletNode, - Real64 const _PLR, + Real64 const PLR, HVAC::FanOp const fanOp, const Real64 condInletTemp) { @@ -436,7 +436,7 @@ void CoilCoolingDXCurveFitSpeed::CalcSpeedOutput(EnergyPlus::EnergyPlusData &sta // SUBROUTINE PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("CalcSpeedOutput: "); - if ((_PLR == 0.0) || (AirMassFlow == 0.0)) { + if ((PLR == 0.0) || (AirMassFlow == 0.0)) { outletNode.Temp = inletNode.Temp; outletNode.HumRat = inletNode.HumRat; outletNode.Enthalpy = inletNode.Enthalpy; @@ -533,7 +533,7 @@ void CoilCoolingDXCurveFitSpeed::CalcSpeedOutput(EnergyPlus::EnergyPlusData &sta Real64 PLF = 1.0; // part load factor as a function of PLR, RTF = PLR / PLF if (indexPLRFPLF > 0) { - PLF = Curve::CurveValue(state, indexPLRFPLF, _PLR); // Calculate part-load factor + PLF = Curve::CurveValue(state, indexPLRFPLF, PLR); // Calculate part-load factor } if (fanOp == HVAC::FanOp::Cycling) state.dataHVACGlobal->OnOffFanPartLoadFraction = PLF; @@ -556,7 +556,7 @@ void CoilCoolingDXCurveFitSpeed::CalcSpeedOutput(EnergyPlus::EnergyPlusData &sta } Real64 EIR = RatedEIR * EIRFlowModFac * EIRTempModFac; - RTF = _PLR / PLF; + RTF = PLR / PLF; fullLoadPower = TotCap * EIR; fullLoadWasteHeat = ratedWasteHeatFractionOfPowerInput * wasteHeatTempModFac * fullLoadPower; diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh index 88450318464..87ae656e46d 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.hh @@ -165,7 +165,7 @@ struct CoilCoolingDXCurveFitSpeed void CalcSpeedOutput(EnergyPlusData &state, const DataLoopNode::NodeData &inletNode, DataLoopNode::NodeData &outletNode, - Real64 const _PLR, + Real64 PLR, HVAC::FanOp const fanOp, Real64 condInletTemp); diff --git a/src/EnergyPlus/UnitarySystem.hh b/src/EnergyPlus/UnitarySystem.hh index 7fa2829c56e..287bd57cac3 100644 --- a/src/EnergyPlus/UnitarySystem.hh +++ b/src/EnergyPlus/UnitarySystem.hh @@ -365,7 +365,7 @@ namespace UnitarySystems { Real64 m_CoolingCycRatio = 0.0; Real64 m_CoolingSpeedRatio = 0.0; - int m_CoolingSpeedNum = 1; + int m_CoolingSpeedNum = 0; int m_EconoSpeedNum = 0; Real64 m_EconoPartLoadRatio = 0; From 37ddbeb7c037b9b04f7125a4fd77febb4c1adfb5 Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Wed, 31 Jul 2024 16:58:46 -0600 Subject: [PATCH 12/21] Allow coil speed == 0. --- src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc index f0ec0522120..78b81a91ceb 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitOperatingMode.cc @@ -290,7 +290,7 @@ void CoilCoolingDXCurveFitOperatingMode::CalcOperatingMode(EnergyPlus::EnergyPlu // Currently speedNum is 1-based, while this->speeds are zero-based auto &thisspeed(this->speeds[max(speedNum - 1, 0)]); - if ((speedNum == 0) || ((speedNum == 1) && (speedRatio == 0.0)) || (inletNode.MassFlowRate == 0.0)) { + if ((speedNum == 1) && (speedRatio == 0.0) || (inletNode.MassFlowRate == 0.0)) { outletNode.Temp = inletNode.Temp; outletNode.HumRat = inletNode.HumRat; outletNode.Enthalpy = inletNode.Enthalpy; From 12eedcfcb46d3ab1d4e13c41cd33325538dbb100 Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Thu, 1 Aug 2024 07:10:16 -0600 Subject: [PATCH 13/21] Remove zero-speed unit test. --- tst/EnergyPlus/unit/UnitarySystem.unit.cc | 256 ---------------------- 1 file changed, 256 deletions(-) diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index 90778dbf4ea..741c2a7d0dd 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -23957,259 +23957,3 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedFanWSHP_Test) EXPECT_EQ(thisSys1.m_SpeedNum, 2); EXPECT_NEAR(sensOut, 500.0, 2); } - -TEST_F(ZoneUnitarySysTest, ZeroCoolingSpeedTest) -{ - std::string_view constexpr idf_objects = R"IDF( - - AirLoopHVAC:UnitarySystem, - Sys 1 Furnace DX Cool Unitary System, !- Name - Load, !- Control Type - SPACE1-1, !- Controlling Zone or Thermostat Location - None, !- Dehumidification Control Type - , !- Availability Schedule Name - Sys 1 Furnace DX Cool Mixed Air Outlet, !- Air Inlet Node Name - Sys 1 Furnace DX Cool Heating Coil Outlet, !- Air Outlet Node Name - , !- Supply Fan Object Type - , !- Supply Fan Name - , !- Fan Placement - , !- Supply Air Fan Operating Mode Schedule Name - , !- Heating Coil Object Type - , !- Heating Coil Name - , !- DX Heating Coil Sizing Ratio - Coil:Cooling:DX, !- Cooling Coil Object Type - Sys 1 Furnace DX Cool Cooling Coil, !- Cooling Coil Name - , !- Use DOAS DX Cooling Coil - , !- Minimum Supply Air Temperature {C} - , !- Latent Load Control - , !- Supplemental Heating Coil Object Type - , !- Supplemental Heating Coil Name - SupplyAirFlowRate, !- Cooling Supply Air Flow Rate Method - autosize, !- Cooling Supply Air Flow Rate {m3/s} - , !- Cooling Supply Air Flow Rate Per Floor Area {m3/s-m2} - , !- Cooling Fraction of Autosized Cooling Supply Air Flow Rate - , !- Cooling Supply Air Flow Rate Per Unit of Capacity {m3/s-W} - SupplyAirFlowRate, !- Heating Supply Air Flow Rate Method - autosize, !- Heating Supply Air Flow Rate {m3/s} - , !- Heating Supply Air Flow Rate Per Floor Area {m3/s-m2} - , !- Heating Fraction of Autosized Heating Supply Air Flow Rate - , !- Heating Supply Air Flow Rate Per Unit of Capacity {m3/s-W} - SupplyAirFlowRate, !- No Load Supply Air Flow Rate Method - autosize, !- No Load Supply Air Flow Rate {m3/s} - , !- No Load Supply Air Flow Rate Per Floor Area {m3/s-m2} - , !- No Load Fraction of Autosized Cooling Supply Air Flow Rate - , !- No Load Fraction of Autosized Heating Supply Air Flow Rate - , !- No Load Supply Air Flow Rate Per Unit of Capacity During Cooling Operation {m3/s-W} - , !- No Load Supply Air Flow Rate Per Unit of Capacity During Heating Operation {m3/s-W} - , !- No Load Supply Air Flow Rate Control Set To Low Speed - Autosize, !- Maximum Supply Air Temperature {C} - 21, !- Maximum Outdoor Dry-Bulb Temperature for Supplemental Heater Operation {C} - , !- Outdoor Dry-Bulb Temperature Sensor Node Name - , !- Ancillary On-Cycle Electric Power {W} - , !- Ancillary Off-Cycle Electric Power {W} - , !- Design Heat Recovery Water Flow Rate {m3/s} - , !- Maximum Temperature for Heat Recovery {C} - , !- Heat Recovery Water Inlet Node Name - , !- Heat Recovery Water Outlet Node Name - UnitarySystemPerformance:Multispeed, !- Design Specification Multispeed Object Type - Sys 1 Furnace DX Cool Unitary System MultiSpeed Performance; !- Design Specification Multispeed Object Name - Coil:Cooling:DX, - Sys 1 Furnace DX Cool Cooling Coil, !- Name - Sys 1 Furnace DX Cool Supply Fan Outlet, !- Evaporator Inlet Node Name - Sys 1 Furnace DX Cool Cooling Coil Outlet, !- Evaporator Outlet Node Name - , !- Availability Schedule Name - , !- Condenser Zone Name - Sys 1 Furnace DX Cool Cooling Coil Condenser Inlet, !- Condenser Inlet Node Name - Sys 1 Furnace DX Cool Cooling Coil Condenser Outlet Node, !- Condenser Outlet Node Name - Sys 1 Furnace DX Cool Cooling Coil Performance; !- Performance Object Name - - Coil:Cooling:DX:CurveFit:Performance, - Sys 1 Furnace DX Cool Cooling Coil Performance, !- Name - 0.0, !- Crankcase Heater Capacity {W} - , !- Crankcase Heater Capacity Function of Temperature Curve Name - , !- Minimum Outdoor Dry-Bulb Temperature for Compressor Operation {C} - 10.0, !- Maximum Outdoor Dry-Bulb Temperature for Crankcase Heater Operation {C} - , !- Unit Internal Static Air Pressure {Pa} - Discrete, !- Capacity Control Method - , !- Evaporative Condenser Basin Heater Capacity {W/K} - , !- Evaporative Condenser Basin Heater Setpoint Temperature {C} - , !- Evaporative Condenser Basin Heater Operating Schedule Name - Electricity, !- Compressor Fuel Type - Sys 1 Furnace DX Cool Cooling Coil Operating Mode; !- Base Operating Mode - - Coil:Cooling:DX:CurveFit:OperatingMode, - Sys 1 Furnace DX Cool Cooling Coil Operating Mode, !- Name - autosize, !- Rated Gross Total Cooling Capacity {W} - autosize, !- Rated Evaporator Air Flow Rate {m3/s} - , !- Rated Condenser Air Flow Rate {m3/s} - 0, !- Maximum Cycling Rate {cycles/hr} - 0, !- Ratio of Initial Moisture Evaporation Rate and Steady State Latent Capacity {dimensionless} - 0, !- Latent Capacity Time Constant {s} - 0, !- Nominal Time for Condensate Removal to Begin {s} - No, !- Apply Latent Degradation to Speeds Greater than 1 - AirCooled, !- Condenser Type - , !- Nominal Evaporative Condenser Pump Power {W} - 2, !- Nominal Speed Number - Sys 1 Furnace DX Cool Cooling Coil Speed 1 Performance, !- Speed 1 Name - Sys 1 Furnace DX Cool Cooling Coil Speed 2 Performance; !- Speed 2 Name - - Coil:Cooling:DX:CurveFit:Speed, - Sys 1 Furnace DX Cool Cooling Coil Speed 1 Performance, !- Name - 0.5000, !- Gross Total Cooling Capacity Fraction - 0.5000, !- Evaporator Air Flow Rate Fraction - , !- Condenser Air Flow Rate Fraction - autosize, !- Gross Sensible Heat Ratio - 3, !- Gross Cooling COP {W/W} - 1.0, !- Active Fraction of Coil Face Area - , !- 2017 Rated Evaporator Fan Power Per Volume Flow Rate {W/(m3/s)} - 934.4, !- 2023 Rated Evaporator Fan Power Per Volume Flow Rate {W/(m3/s)} - , !- Evaporative Condenser Pump Power Fraction - , !- Evaporative Condenser Effectiveness {dimensionless} - Sys 1 Furnace DX Cool Cool Coil Cap-FT, !- Total Cooling Capacity Modifier Function of Temperature Curve Name - Sys 1 Furnace DX Cool Cool Coil Cap-FF, !- Total Cooling Capacity Modifier Function of Air Flow Fraction Curve Name - Sys 1 Furnace DX Cool Cool Coil EIR-FT, !- Energy Input Ratio Modifier Function of Temperature Curve Name - Sys 1 Furnace DX Cool Cool Coil EIR-FF, !- Energy Input Ratio Modifier Function of Air Flow Fraction Curve Name - Sys 1 Furnace DX Cool Cool Coil PLF, !- Part Load Fraction Correlation Curve Name - 0.2, !- Rated Waste Heat Fraction of Power Input {dimensionless} - Sys 1 Furnace DX Cool Cool Coil WH-FT; !- Waste Heat Modifier Function of Temperature Curve Name - - Coil:Cooling:DX:CurveFit:Speed, - Sys 1 Furnace DX Cool Cooling Coil Speed 2 Performance, !- Name - 1.0000, !- Gross Total Cooling Capacity Fraction - 1.0000, !- Evaporator Air Flow Rate Fraction - , !- Condenser Air Flow Rate Fraction - autosize, !- Gross Sensible Heat Ratio - 3, !- Gross Cooling COP {W/W} - 1.0, !- Active Fraction of Coil Face Area - , !- 2017 Rated Evaporator Fan Power Per Volume Flow Rate {W/(m3/s)} - 934.4, !- 2023 Rated Evaporator Fan Power Per Volume Flow Rate {W/(m3/s)} - , !- Evaporative Condenser Pump Power Fraction - , !- Evaporative Condenser Effectiveness {dimensionless} - Sys 1 Furnace DX Cool Cool Coil Cap-FT, !- Total Cooling Capacity Modifier Function of Temperature Curve Name - Sys 1 Furnace DX Cool Cool Coil Cap-FF, !- Total Cooling Capacity Modifier Function of Air Flow Fraction Curve Name - Sys 1 Furnace DX Cool Cool Coil EIR-FT, !- Energy Input Ratio Modifier Function of Temperature Curve Name - Sys 1 Furnace DX Cool Cool Coil EIR-FF, !- Energy Input Ratio Modifier Function of Air Flow Fraction Curve Name - Sys 1 Furnace DX Cool Cool Coil PLF, !- Part Load Fraction Correlation Curve Name - 0.2, !- Rated Waste Heat Fraction of Power Input {dimensionless} - Sys 1 Furnace DX Cool Cool Coil WH-FT; !- Waste Heat Modifier Function of Temperature Curve Name - -! Curves from example file MultiSpeedHeatPump.idf, Sep 2013, same curves for all speeds. - - Curve:Biquadratic, - Sys 1 Furnace DX Cool Cool Coil Cap-FT, !- Name - 0.476428E+00, !- Coefficient1 Constant - 0.401147E-01, !- Coefficient2 x - 0.226411E-03, !- Coefficient3 x**2 - -0.827136E-03, !- Coefficient4 y - -0.732240E-05, !- Coefficient5 y**2 - -0.446278E-03, !- Coefficient6 x*y - 0.0, !- Minimum Value of x - 50.0, !- Maximum Value of x - 0.0, !- Minimum Value of y - 50.0, !- Maximum Value of y - 0.0, !- Minimum Curve Output - 5.0, !- Maximum Curve Output - Temperature, !- Input Unit Type for X - Temperature, !- Input Unit Type for Y - Dimensionless; !- Output Unit Type - - Curve:Cubic, - Sys 1 Furnace DX Cool Cool Coil Cap-FF, !- Name - 0.47278589, !- Coefficient1 Constant - 1.2433415, !- Coefficient2 x - -1.0387055, !- Coefficient3 x**2 - 0.32257813, !- Coefficient4 x**3 - 0.5, !- Minimum Value of x - 1.5; !- Maximum Value of x - - Curve:Biquadratic, - Sys 1 Furnace DX Cool Cool Coil EIR-FT, !- Name - 0.632475E+00, !- Coefficient1 Constant - -0.121321E-01, !- Coefficient2 x - 0.507773E-03, !- Coefficient3 x**2 - 0.155377E-01, !- Coefficient4 y - 0.272840E-03, !- Coefficient5 y**2 - -0.679201E-03, !- Coefficient6 x*y - 0.0, !- Minimum Value of x - 50.0, !- Maximum Value of x - 0.0, !- Minimum Value of y - 50.0, !- Maximum Value of y - 0.0, !- Minimum Curve Output - 5.0, !- Maximum Curve Output - Temperature, !- Input Unit Type for X - Temperature, !- Input Unit Type for Y - Dimensionless; !- Output Unit Type - - Curve:Cubic, - Sys 1 Furnace DX Cool Cool Coil EIR-FF, !- Name - 0.47278589, !- Coefficient1 Constant - 1.2433415, !- Coefficient2 x - -1.0387055, !- Coefficient3 x**2 - 0.32257813, !- Coefficient4 x**3 - 0.5, !- Minimum Value of x - 1.5; !- Maximum Value of x - -! PLF = l.- Cd(1.-PLR) where Cd = 0.15 - - Curve:Quadratic, - Sys 1 Furnace DX Cool Cool Coil PLF, !- Name - 0.85, !- Coefficient1 Constant - 0.15, !- Coefficient2 x - 0, !- Coefficient3 x**2 - 0, !- Minimum Value of x - 1; !- Maximum Value of x - - Curve:Biquadratic, - Sys 1 Furnace DX Cool Cool Coil WH-FT, !- Name - 1.0, !- Coefficient1 Constant - 0.0, !- Coefficient2 x - 0.0, !- Coefficient3 x**2 - 0.0, !- Coefficient4 y - 0.0, !- Coefficient5 y**2 - 0.0, !- Coefficient6 x*y - 0, !- Minimum Value of x - 50, !- Maximum Value of x - 0, !- Minimum Value of y - 50, !- Maximum Value of y - , !- Minimum Curve Output - , !- Maximum Curve Output - Temperature, !- Input Unit Type for X - Temperature, !- Input Unit Type for Y - Dimensionless; !- Output Unit Type - -)IDF"; - - EXPECT_TRUE(process_idf(idf_objects, false)); - - bool zoneEquipment = true; - state->dataZoneEquip->ZoneEquipInputsFilled = true; - bool ErrorsFound(false); - std::string compName = "SYS 1 FURNACE DX COOL UNITARY SYSTEM"; - UnitarySystems::UnitarySys::factory(*state, HVAC::UnitarySysType::Unitary_AnyCoilType, compName, zoneEquipment, 0); - auto thisSys = &state->dataUnitarySystems->unitarySys[0]; - thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); - - OutputReportPredefined::SetPredefinedTables(*state); - - state->dataGlobal->BeginEnvrnFlag = false; - state->dataLoopNodes->Node(thisSys->CoolCoilInletNodeNum).MassFlowRate = 0.05; - state->dataZoneEnergyDemand->ZoneSysEnergyDemand.allocate(1); - state->dataZoneEnergyDemand->ZoneSysMoistureDemand.allocate(1); - state->dataUnitarySystems->CoolingLoad = true; - state->dataHVACGlobal->MSHPMassFlowRateLow = 0.15; - - int AirLoopNum(0); - bool FirstHVACIteration = false; - thisSys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); - - Real64 OnOffAirFlowRatio(1.0); - Real64 CoilCoolHeatRat(1.0); - HVAC::CompressorOp CompressorOn(HVAC::CompressorOp::On); - thisSys->m_CoolingSpeedNum = 0; - thisSys->m_SingleMode = 0; - thisSys->m_CoolingPartLoadFrac = 0.5; - thisSys->calcUnitaryCoolingSystem(*state, AirLoopNum, FirstHVACIteration, thisSys->m_CoolingPartLoadFrac, CompressorOn, OnOffAirFlowRatio, CoilCoolHeatRat, false); - EXPECT_EQ(state->dataLoopNodes->Node(thisSys->CoolCoilInletNodeNum).Temp, state->dataLoopNodes->Node(thisSys->CoolCoilOutletNodeNum).Temp); - EXPECT_EQ(state->dataLoopNodes->Node(thisSys->CoolCoilInletNodeNum).HumRat, state->dataLoopNodes->Node(thisSys->CoolCoilOutletNodeNum).HumRat); - EXPECT_EQ(state->dataLoopNodes->Node(thisSys->CoolCoilInletNodeNum).Enthalpy, state->dataLoopNodes->Node(thisSys->CoolCoilOutletNodeNum).Enthalpy); -} From c63253d7c899e8389b90ef7261edb678b868cf55 Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Thu, 1 Aug 2024 12:50:34 -0600 Subject: [PATCH 14/21] Remove line from accidental merge. --- src/EnergyPlus/Coils/CoilCoolingDX.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.cc b/src/EnergyPlus/Coils/CoilCoolingDX.cc index 5ca3800eedc..34831ca446c 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDX.cc @@ -664,8 +664,6 @@ void CoilCoolingDX::simulate(EnergyPlusData &state, bool const singleMode, Real64 const LoadSHR) { - assert(speedNum != 0); - if (this->myOneTimeInitFlag) { this->oneTimeInit(state); this->myOneTimeInitFlag = false; From 641d6234dd69daae89151b33cdeb2c7db1d5856a Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Tue, 6 Aug 2024 08:33:50 -0600 Subject: [PATCH 15/21] Simplify PLR assignment. --- src/EnergyPlus/HVACHXAssistedCoolingCoil.cc | 24 +++++++++------------ 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc index bec761510ee..eec3b45dc8e 100644 --- a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc +++ b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc @@ -943,27 +943,23 @@ namespace HVACHXAssistedCoolingCoil { coilMode = HVAC::CoilMode::Enhanced; } - Real64 mCoolingSpeedRatio = 0.0; // used same setting as the original variable speed coil - Real64 mCoolCompPartLoadRatio = (compressorOp == HVAC::CompressorOp::On) ? 1.0 : 0.0; - - Real64 CoilPLR; - if (mCoolingSpeedNum > 1) { - if (mSingleMode == 0) { - mCoolCompPartLoadRatio = (compressorOp == HVAC::CompressorOp::On) ? 1.0 : 0.0; + Real64 CoilPLR = 1.0; + if (compressorOp == HVAC::CompressorOp::Off) { + mCoolingSpeedNum = 1; // Bypass mixed-speed calculations in called functions + } else { + if (singleMode) { + CoilPLR = (mCoolingSpeedNum == 1) + ? PartLoadRatio + : 0.0; // singleMode allows cycling, but not part load operation at higher speeds } else { - mCoolCompPartLoadRatio = PartLoadRatio * ((compressorOp == HVAC::CompressorOp::On) ? 1.0 : 0.0); - mCoolingSpeedRatio = 1.0; + CoilPLR = PartLoadRatio; } - CoilPLR = 1.0; - } else { - mCoolingSpeedRatio = 1.0; - CoilPLR = PartLoadRatio * ((compressorOp == HVAC::CompressorOp::On) ? 1.0 : 0.0); } state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].simulate(state, coilMode, // partially implemented for HXAssistedCoil mCoolingSpeedNum, - mCoolingSpeedRatio, + CoilPLR, fanOp, singleMode); // From 45b87e5ca95305c33c5096e0df1fa1e6181b501f Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Fri, 4 Oct 2024 16:26:48 -0600 Subject: [PATCH 16/21] Fix clang-format. --- src/EnergyPlus/HVACHXAssistedCoolingCoil.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc index eec3b45dc8e..f1628582202 100644 --- a/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc +++ b/src/EnergyPlus/HVACHXAssistedCoolingCoil.cc @@ -948,9 +948,8 @@ namespace HVACHXAssistedCoolingCoil { mCoolingSpeedNum = 1; // Bypass mixed-speed calculations in called functions } else { if (singleMode) { - CoilPLR = (mCoolingSpeedNum == 1) - ? PartLoadRatio - : 0.0; // singleMode allows cycling, but not part load operation at higher speeds + CoilPLR = + (mCoolingSpeedNum == 1) ? PartLoadRatio : 0.0; // singleMode allows cycling, but not part load operation at higher speeds } else { CoilPLR = PartLoadRatio; } From 59b222f32aef5893fc00adcf58e6d37a08caf07e Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Wed, 9 Oct 2024 11:16:44 -0600 Subject: [PATCH 17/21] Reassess how singlemode interprets PLR. --- src/EnergyPlus/UnitarySystem.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index d238cf6308e..ac20b2fe601 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -11553,7 +11553,7 @@ namespace UnitarySystems { } else { if (singleMode) { CoilPLR = (m_CoolingSpeedNum == 1) ? PartLoadRatio - : 0.0; // singleMode allows cycling, but not part load operation at higher speeds + : 1.0; // singleMode allows cycling, but not part load operation at higher speeds } else { CoilPLR = PartLoadRatio; } From e3d4abe1d4c0540da3d356429c1988bfe4468fab Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Sun, 10 Nov 2024 14:48:08 -0700 Subject: [PATCH 18/21] Fix setpoint-based plr. --- src/EnergyPlus/UnitarySystem.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index ac20b2fe601..3f9a9ebfd35 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -11541,7 +11541,7 @@ namespace UnitarySystems { CoilPLR = 0.0; if (this->m_ControlType == UnitarySysCtrlType::Setpoint) { if (CompressorOn == HVAC::CompressorOp::On) { - CoilPLR = (this->m_CoolingSpeedNum > 1) ? 1.0 : PartLoadRatio; + CoilPLR = (this->m_CoolingSpeedNum > 1) ? m_CoolingSpeedRatio : PartLoadRatio; } } else { if (this->m_EMSOverrideCoilSpeedNumOn) { @@ -11552,8 +11552,9 @@ namespace UnitarySystems { this->m_CoolingSpeedNum = 1; // Bypass mixed-speed calculations in called functions } else { if (singleMode) { - CoilPLR = (m_CoolingSpeedNum == 1) ? PartLoadRatio - : 1.0; // singleMode allows cycling, but not part load operation at higher speeds + CoilPLR = (this->m_CoolingSpeedNum == 1) + ? PartLoadRatio + : 1.0; // singleMode allows cycling, but not part load operation at higher speeds } else { CoilPLR = PartLoadRatio; } From be230f3d7ac90a02c1cee28c8fdfe010079523f8 Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Mon, 18 Nov 2024 09:43:20 -0700 Subject: [PATCH 19/21] Allow speed=0 if compressor is off. --- src/EnergyPlus/UnitarySystem.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 3f9a9ebfd35..f1d79708593 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -11548,8 +11548,10 @@ namespace UnitarySystems { CoilPLR = this->m_CoolingSpeedRatio; } else { if (state.dataUnitarySystems->CoolingLoad) { - if (CompressorOn == HVAC::CompressorOp::Off) { - this->m_CoolingSpeedNum = 1; // Bypass mixed-speed calculations in called functions + if (CompressorOn == HVAC::CompressorOp::Off && + this->m_CoolingSpeedNum > 1) { // NOTE: Cooling speed 0 should behave the same as speed 1, but doesn't, and must be + // allowed to pass into the simulation code + this->m_CoolingSpeedNum = 1; // Bypass mixed-speed calculations in called functions } else { if (singleMode) { CoilPLR = (this->m_CoolingSpeedNum == 1) From 182336fa85a05c2b907e6a5d8f17b3ac905f0e43 Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Mon, 9 Dec 2024 15:04:26 -0700 Subject: [PATCH 20/21] Fix compound condition so compressor isn't accidentally seen as on. --- src/EnergyPlus/UnitarySystem.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index f1d79708593..79d6ff9bb41 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -11548,10 +11548,10 @@ namespace UnitarySystems { CoilPLR = this->m_CoolingSpeedRatio; } else { if (state.dataUnitarySystems->CoolingLoad) { - if (CompressorOn == HVAC::CompressorOp::Off && - this->m_CoolingSpeedNum > 1) { // NOTE: Cooling speed 0 should behave the same as speed 1, but doesn't, and must be - // allowed to pass into the simulation code - this->m_CoolingSpeedNum = 1; // Bypass mixed-speed calculations in called functions + if (CompressorOn == HVAC::CompressorOp::Off) { + if (this->m_CoolingSpeedNum > 1) // NOTE: Cooling speed 0 should behave the same as speed 1, but doesn't, and must be + // allowed to pass into the simulation code + this->m_CoolingSpeedNum = 1; // Bypass mixed-speed calculations in called functions } else { if (singleMode) { CoilPLR = (this->m_CoolingSpeedNum == 1) From 1db2fa7c65eb8e90912518cb8e26cf054ed6601d Mon Sep 17 00:00:00 2001 From: Tanaya Mankad Date: Tue, 17 Dec 2024 07:51:26 -0700 Subject: [PATCH 21/21] Remove unneeded calculations for local variables. --- src/EnergyPlus/UnitarySystem.cc | 44 --------------------------------- 1 file changed, 44 deletions(-) diff --git a/src/EnergyPlus/UnitarySystem.cc b/src/EnergyPlus/UnitarySystem.cc index 79d6ff9bb41..898841958aa 100644 --- a/src/EnergyPlus/UnitarySystem.cc +++ b/src/EnergyPlus/UnitarySystem.cc @@ -15037,54 +15037,10 @@ namespace UnitarySystems { this->calcPassiveSystem(state, AirLoopNum, FirstHVACIteration); if ((CoilTypeNum == HVAC::CoilDX_MultiSpeedCooling) || (CoilTypeNum == HVAC::CoilDX_MultiSpeedHeating)) { - - // TODO: THIS IF SECTION DOES NOTHING - if (CoilType == HVAC::Cooling) { - if (this->m_CoolingSpeedNum <= 1.0) { - SpeedRatio = 0.0; - CycRatio = PartLoadFrac; - } else { - if (this->m_SingleMode == 0) { - SpeedRatio = PartLoadFrac; - CycRatio = 0.0; - } else { - SpeedRatio = 1.0; - CycRatio = PartLoadFrac; - } - } - } else { - if (this->m_HeatingSpeedNum <= 1.0) { - SpeedRatio = 0.0; - CycRatio = PartLoadFrac; - } else { - if (this->m_SingleMode == 0) { - SpeedRatio = PartLoadFrac; - CycRatio = 0.0; - } else { - SpeedRatio = 1.0; - CycRatio = PartLoadFrac; - } - } - } DXCoils::SimDXCoilMultiSpeed( state, CompName, 0.0, PartLoadFrac, CompIndex, SpeedNumber, this->m_FanOpMode, HVAC::CompressorOp::On, this->m_SingleMode); } else if (CoilTypeNum == HVAC::CoilDX_Cooling) { - - if (CoilType == HVAC::Cooling) { - if (this->m_CoolingSpeedNum <= 1.0) { - SpeedRatio = 0.0; - CycRatio = PartLoadFrac; - } else { - if (this->m_SingleMode == 0) { - SpeedRatio = PartLoadFrac; - CycRatio = 0.0; - } else { - SpeedRatio = 1.0; - CycRatio = PartLoadFrac; - } - } - } bool const singleMode = (this->m_SingleMode == 1); HVAC::CoilMode coilMode = HVAC::CoilMode::Normal; if (state.dataCoilCooingDX->coilCoolingDXs[this->m_CoolingCoilIndex].SubcoolReheatFlag) {